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 <tm>Linux</tm> Operating Environment, an agent library is a shared object 430 (<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 <tm>Linux</tm>. 501 If the agent library is statically linked into the executable 502 then no actual loading takes place. 503 <p/> 504 </dd> 505 <dt><code>-agentpath:</code><i><path-to-agent></i><code>=</code><i><options></i></dt> 506 <dd> 507 The path following <code>-agentpath:</code> is the absolute path from which 508 to load the library. 509 No library name expansion will occur. 510 The <i><options></i> will be passed to the agent on start-up. 511 For example, if the option 512 <code>-agentpath:c:\myLibs\foo.dll=opt1,opt2</code> is specified, the VM will attempt to 513 load the shared library <code>c:\myLibs\foo.dll</code>. If the agent 514 library is statically linked into the executable 515 then no actual loading takes place. 516 <p/> 517 </dd> 518 </dl> 519 For a dynamic shared library agent, the start-up routine 520 <internallink id="onload"><code>Agent_OnLoad</code></internallink> 521 in the library will be invoked. If the agent library is statically linked 522 into the executable then the system will attempt to invoke the 523 <code>Agent_OnLoad_<agent-lib-name></code> entry point where 524 <agent-lib-name> is the basename of the 525 agent. In the above example <code>-agentpath:c:\myLibs\foo.dll=opt1,opt2</code>, 526 the system will attempt to find and call the <code>Agent_OnLoad_foo</code> start-up routine. 527 <p/> 528 Libraries loaded with <code>-agentlib:</code> or <code>-agentpath:</code> 529 will be searched for JNI native method implementations to facilitate the 530 use of Java programming language code in tools, as is needed for 531 <internallink id="bci">bytecode instrumentation</internallink>. 532 <p/> 533 The agent libraries will be searched after all other libraries have been 534 searched (agents wishing to override or intercept the native method 535 implementations of non-agent methods can use the 536 <eventlink id="NativeMethodBind">NativeMethodBind event</eventlink>). 537 <p/> 538 These switches do the above and nothing more - they do not change the 539 state of the VM or <jvmti/>. No command line options are needed 540 to enable <jvmti/> 541 or aspects of <jvmti/>, this is handled programmatically 542 by the use of 543 <internallink id="capability">capabilities</internallink>. 544 </intro> 545 546 <intro id="startup" label="Agent Start-Up"> 547 The VM starts each agent by invoking a start-up function. 548 If the agent is started in the <code>OnLoad</code> 549 <functionlink id="GetPhase">phase</functionlink> the function 550 <internallink id="onload"><code>Agent_OnLoad</code></internallink> 551 or <internallink id="onload"><code>Agent_OnLoad_L</code></internallink> 552 for statically linked agents will be invoked. 553 If the agent is started in the live 554 <functionlink id="GetPhase">phase</functionlink> the function 555 <internallink id="onattach"><code>Agent_OnAttach</code></internallink> 556 or <internallink id="onattach"><code>Agent_OnAttach_L</code></internallink> 557 for statically linked agents will be invoked. 558 Exactly one call to a start-up function is made per agent. 559 </intro> 560 561 <intro id="onload" label="Agent Start-Up (OnLoad phase)"> 562 If an agent is started during the <code>OnLoad</code> phase then its 563 agent library must export a start-up function with the following prototype: 564 <example> 565 JNIEXPORT jint JNICALL 566 Agent_OnLoad(JavaVM *vm, char *options, void *reserved)</example> 567 Or for a statically linked agent named 'L': 568 <example> 569 JNIEXPORT jint JNICALL 570 Agent_OnLoad_L(JavaVM *vm, char *options, void *reserved)</example> 571 572 The VM will start the agent by calling this function. 573 It will be called early enough in VM initialization that: 574 <ul> 575 <li><functionlink id="SetSystemProperty">system properties</functionlink> 576 may be set before they have been used in the start-up of the VM</li> 577 <li>the full set of 578 <internallink id="capability">capabilities</internallink> 579 is still available (note that capabilities that configure the VM 580 may only be available at this time--see the 581 <internallink id="capability">Capability function section</internallink>)</li> 582 <li>no bytecodes have executed</li> 583 <li>no classes have been loaded</li> 584 <li>no objects have been created</li> 585 </ul> 586 <p/> 587 The VM will call the <code>Agent_OnLoad</code> or 588 <code>Agent_OnLoad_<agent-lib-name></code> function with 589 <i><options></i> as the second argument - 590 that is, using the command-line option examples, 591 <code>"opt1,opt2"</code> will be passed to the <code>char *options</code> 592 argument of <code>Agent_OnLoad</code>. 593 The <code>options</code> argument is encoded as a 594 <internallink id="mUTF">modified UTF-8</internallink> string. 595 If <i>=<options></i> is not specified, 596 a zero length string is passed to <code>options</code>. 597 The lifespan of the <code>options</code> string is the 598 <code>Agent_OnLoad</code> or <code>Agent_OnLoad_<agent-lib-name></code> 599 call. If needed beyond this time the string or parts of the string must 600 be copied. 601 The period between when <code>Agent_OnLoad</code> is called and when it 602 returns is called the <i>OnLoad phase</i>. 603 Since the VM is not initialized during the OnLoad 604 <functionlink id="GetPhase">phase</functionlink>, 605 the set of allowed operations 606 inside <code>Agent_OnLoad</code> is restricted (see the function descriptions for the 607 functionality available at this time). 608 The agent can safely process the options and set 609 event callbacks with <functionlink id="SetEventCallbacks"></functionlink>. Once 610 the VM initialization event is received 611 (that is, the <eventlink id="VMInit">VMInit</eventlink> 612 callback is invoked), the agent 613 can complete its initialization. 614 <rationale> 615 Early startup is required so that agents can set the desired capabilities, 616 many of which must be set before the VM is initialized. 617 In JVMDI, the -Xdebug command-line option provided 618 very coarse-grain control of capabilities. 619 JVMPI implementations use various tricks to provide a single "JVMPI on" switch. 620 No reasonable command-line 621 option could provide the fine-grain of control required to balance needed capabilities vs 622 performance impact. 623 Early startup is also needed so that agents can control the execution 624 environment - modifying the file system and system properties to install 625 their functionality. 626 </rationale> 627 <p/> 628 The return value from <code>Agent_OnLoad</code> or 629 <code>Agent_OnLoad_<agent-lib-name></code> is used to indicate an error. 630 Any value other than zero indicates an error and causes termination of the VM. 631 </intro> 632 633 <intro id="onattach" label="Agent Start-Up (Live phase)"> 634 A VM may support a mechanism that allows agents to be started in the VM during the live 635 <functionlink id="GetPhase">phase</functionlink>. The details of how this is supported, 636 are implementation specific. For example, a tool may use some platform specific mechanism, 637 or implementation specific API, to attach to the running VM, and request it start a given 638 agent. 639 <p/> 640 If an agent is started during the live phase then its agent library 641 must export a start-up function 642 with the following prototype: 643 <example> 644 JNIEXPORT jint JNICALL 645 Agent_OnAttach(JavaVM* vm, char *options, void *reserved)</example> 646 Or for a statically linked agent named 'L': 647 <example> 648 JNIEXPORT jint JNICALL 649 Agent_OnAttach_L(JavaVM* vm, char *options, void *reserved)</example> 650 651 <p/> 652 The VM will start the agent by calling this function. 653 It will be called in the context of a thread 654 that is attached to the VM. The first argument <i><vm></i> is the Java VM. 655 The <i><options></i> argument is the startup options provided to the agent. 656 <i><options></i> is encoded as a <internallink id="mUTF">modified UTF-8 657 </internallink> string. 658 If startup options were not provided, a zero length string is passed to 659 <code>options</code>. The lifespan of the <code>options</code> string is the 660 <code>Agent_OnAttach</code> or <code>Agent_OnAttach_<agent-lib-name></code> call. 661 If needed beyond this time the string or parts of the string must be copied. 662 <p/> 663 Note that some <internallink id="capability">capabilities</internallink> 664 may not be available in the live phase. 665 <p/> 666 The <code>Agent_OnAttach</code> or <code>Agent_OnAttach_<agent-lib-name 667 ></code> function initializes the agent and returns a value 668 to the VM to indicate if an error occurred. Any value other than zero indicates an error. 669 An error does not cause the VM to terminate. Instead the VM ignores the error, or takes 670 some implementation specific action -- for example it might print an error to standard error, 671 or record the error in a system log. 672 </intro> 673 674 <intro id="onunload" label="Agent Shutdown"> 675 The library may optionally export a 676 shutdown function with the following prototype: 677 <example> 678 JNIEXPORT void JNICALL 679 Agent_OnUnload(JavaVM *vm)</example> 680 Or for a statically linked agent named 'L': 681 <example> 682 JNIEXPORT void JNICALL 683 Agent_OnUnload_L(JavaVM *vm)</example> 684 685 This function will be called by the VM when the library is about to be unloaded. 686 The library will be unloaded (unless it is statically linked into the 687 executable) and this function will be called if some platform specific 688 mechanism causes the unload (an unload mechanism is not specified in this document) 689 or the library is (in effect) unloaded by the termination of the VM whether through 690 normal termination or VM failure, including start-up failure. 691 Uncontrolled shutdown is, of course, an exception to this rule. 692 Note the distinction between this function and the 693 <eventlink id="VMDeath">VM Death event</eventlink>: for the VM Death event 694 to be sent, the VM must have run at least to the point of initialization and a valid 695 <jvmti/> environment must exist which has set a callback for VMDeath 696 and enabled the event. 697 None of these are required for <code>Agent_OnUnload</code> or 698 <code>Agent_OnUnload_<agent-lib-name></code> and this function 699 is also called if the library is unloaded for other reasons. 700 In the case that a VM Death event is sent, it will be sent before this 701 function is called (assuming this function is called due to VM termination). 702 This function can be used to clean-up resources allocated by the agent. 703 </intro> 704 705 <intro id="tooloptions" label="JAVA_TOOL_OPTIONS"> 706 Since the command-line cannot always be accessed or modified, for example in embedded VMs 707 or simply VMs launched deep within scripts, a <code>JAVA_TOOL_OPTIONS</code> variable is 708 provided so that agents may be launched in these cases. 709 <p/> 710 Platforms which support environment variables or other named strings, may support the 711 <code>JAVA_TOOL_OPTIONS</code> variable. This variable will be broken into options at white-space 712 boundaries. White-space characters include space, tab, carriage-return, new-line, 713 vertical-tab, and form-feed. Sequences of white-space characters are considered 714 equivalent to a single white-space character. No white-space is included in the options 715 unless quoted. Quoting is as follows: 716 <ul> 717 <li>All characters enclosed between a pair of single quote marks (''), except a single 718 quote, are quoted.</li> 719 <li>Double quote characters have no special meaning inside a pair of single quote marks.</li> 720 <li>All characters enclosed between a pair of double quote marks (""), except a double 721 quote, are quoted.</li> 722 <li>Single quote characters have no special meaning inside a pair of double quote marks.</li> 723 <li>A quoted part can start or end anywhere in the variable.</li> 724 <li>White-space characters have no special meaning when quoted -- they are included in 725 the option like any other character and do not mark white-space boundaries.</li> 726 <li>The pair of quote marks is not included in the option.</li> 727 </ul> 728 <code>JNI_CreateJavaVM</code> (in the JNI Invocation API) will prepend these options to the options supplied 729 in its <code>JavaVMInitArgs</code> argument. Platforms may disable this feature in cases where security is 730 a concern; for example, the Reference Implementation disables this feature on Unix systems when 731 the effective user or group ID differs from the real ID. 732 This feature is intended to support the initialization of tools -- specifically including the 733 launching of native or Java programming language agents. Multiple tools may wish to use this 734 feature, so the variable should not be overwritten, instead, options should be appended to 735 the variable. Note that since the variable is processed at the time of the JNI Invocation 736 API create VM call, options processed by a launcher (e.g., VM selection options) will not be handled. 737 </intro> 738 739 <intro id="environments" label="Environments"> 740 The <jvmti/> specification supports the use of multiple simultaneous 741 <jvmti/> agents. 742 Each agent has its own <jvmti/> environment. 743 That is, the <jvmti/> state is 744 separate for each agent - changes to one environment do not affect the 745 others. The state of a <jvmti/> 746 environment includes: 747 <ul> 748 <li><functionlink id="SetEventCallbacks">the event callbacks</functionlink></li> 749 <li><functionlink id="SetEventNotificationMode">the set of events which are enabled</functionlink></li> 750 <li><internallink id="capability">the capabilities</internallink></li> 751 <li><internallink id="memory">the memory allocation/deallocation hooks</internallink></li> 752 </ul> 753 Although their <jvmti/> state 754 is separate, agents inspect and modify the shared state 755 of the VM, they also share the native environment in which they execute. 756 As such, an agent can perturb the results of other agents or cause them 757 to fail. It is the responsibility of the agent writer to specify the level 758 of compatibility with other agents. <jvmti/> implementations are not capable 759 of preventing destructive interactions between agents. Techniques to reduce 760 the likelihood of these occurrences are beyond the scope of this document. 761 <p/> 762 An agent creates a <jvmti/> environment 763 by passing a <jvmti/> version 764 as the interface ID to the JNI Invocation API function 765 <externallink id="jni/invocation.html#getenv"> 766 <code>GetEnv</code></externallink>. 767 See <internallink id="jvmtiEnvAccess">Accessing <jvmti/> Functions</internallink> 768 for more details on the creation and use of 769 <jvmti/> environments. 770 Typically, <jvmti/> environments are created by calling <code>GetEnv</code> from 771 <internallink id="onload"><code>Agent_OnLoad</code></internallink>. 772 </intro> 773 774 <intro id="bci" label="Bytecode Instrumentation"> 775 This interface does not include some events that one might expect in an interface with 776 profiling support. Some examples include full speed 777 method enter and exit events. The interface instead provides support for 778 <i>bytecode instrumentation</i>, the ability to alter the Java virtual machine 779 bytecode instructions which comprise the target program. Typically, these alterations 780 are to add "events" to the code of a method - for example, to add, at the beginning of a method, 781 a call to <code>MyProfiler.methodEntered()</code>. 782 Since the changes are purely additive, they do not modify application 783 state or behavior. 784 Because the inserted agent code is standard bytecodes, the VM can run at full speed, 785 optimizing not only the target program but also the instrumentation. If the 786 instrumentation does not involve switching from bytecode execution, no expensive 787 state transitions are needed. The result is high performance events. 788 This approach also provides complete control to the agent: instrumentation can be 789 restricted to "interesting" portions of the code (e.g., the end user's code) and 790 can be conditional. Instrumentation can run entirely in Java programming language 791 code or can call into the native agent. Instrumentation can simply maintain 792 counters or can statistically sample events. 793 <p/> 794 Instrumentation can be inserted in one of three ways: 795 <ul> 796 <li> 797 Static Instrumentation: The class file is instrumented before it 798 is loaded into the VM - for example, by creating a duplicate directory of 799 <code>*.class</code> files which have been modified to add the instrumentation. 800 This method is extremely awkward and, in general, an agent cannot know 801 the origin of the class files which will be loaded. 802 </li> 803 <li> 804 Load-Time Instrumentation: When a class file is loaded by the VM, the raw 805 bytes of the class file are sent for instrumentation to the agent. 806 The <eventlink id="ClassFileLoadHook"/> 807 event, triggered by the class load, 808 provides this functionality. This mechanism provides efficient 809 and complete access to one-time instrumentation. 810 </li> 811 <li> 812 Dynamic Instrumentation: A class which is already loaded (and possibly 813 even running) is modified. This optional feature is provided by the 814 <eventlink id="ClassFileLoadHook"/> event, triggered by calling the 815 <functionlink id="RetransformClasses"/> function. 816 Classes can be modified multiple times and can be returned to their 817 original state. 818 The mechanism allows instrumentation which changes during the 819 course of execution. 820 </li> 821 </ul> 822 <p/> 823 The class modification functionality provided in this interface 824 is intended to provide a mechanism for instrumentation 825 (the <eventlink id="ClassFileLoadHook"/> event 826 and the <functionlink id="RetransformClasses"/> function) 827 and, during development, for fix-and-continue debugging 828 (the <functionlink id="RedefineClasses"/> function). 829 <p/> 830 Care must be taken to avoid perturbing dependencies, especially when 831 instrumenting core classes. For example, an approach to getting notification 832 of every object allocation is to instrument the constructor on 833 <code>Object</code>. Assuming that the constructor is initially 834 empty, the constructor could be changed to: 835 <example> 836 public Object() { 837 MyProfiler.allocationTracker(this); 838 } 839 </example> 840 However, if this change was made using the 841 <eventlink id="ClassFileLoadHook"/> 842 event then this might impact a typical VM as follows: 843 the first created object will call the constructor causing a class load of 844 <code>MyProfiler</code>; which will then cause 845 object creation, and since <code>MyProfiler</code> isn't loaded yet, 846 infinite recursion; resulting in a stack overflow. A refinement of this 847 would be to delay invoking the tracking method until a safe time. For 848 example, <code>trackAllocations</code> could be set in the 849 handler for the <code>VMInit</code> event. 850 <example> 851 static boolean trackAllocations = false; 852 853 public Object() { 854 if (trackAllocations) { 855 MyProfiler.allocationTracker(this); 856 } 857 } 858 </example> 859 <p/> 860 The <functionlink id="SetNativeMethodPrefix"/> allows native methods 861 to be instrumented by the use of wrapper methods. 862 </intro> 863 864 <intro id="bcimodules" label="Bytecode Instrumentation of code in modules"> 865 Agents can use the functions <functionlink id="AddModuleReads"/>, 866 <functionlink id="AddModuleExports"/>, <functionlink id="AddModuleOpens"/>, 867 <functionlink id="AddModuleUses"/> and <functionlink id="AddModuleProvides"/> 868 to update a module to expand the set of modules that it reads, the set of 869 packages that it exports or opens to other modules, or the services that it 870 uses and provides. 871 <p/> 872 As an aid to agents that deploy supporting classes on the search path of 873 the bootstrap class loader, or the search path of the class loader that 874 loads the main class, the Java virtual machine arranges for the module 875 of classes transformed by the <eventlink id="ClassFileLoadHook"/> event to 876 read the unnamed module of both class loaders. 877 </intro> 878 879 <intro id="mUTF" label="Modified UTF-8 String Encoding"> 880 <jvmti/> uses modified UTF-8 to encode character strings. 881 This is the same encoding used by JNI. 882 Modified UTF-8 differs 883 from standard UTF-8 in the representation of supplementary characters 884 and of the null character. See the 885 <externallink id="jni/types.html#modified-utf-8-strings"> 886 Modified UTF-8 Strings</externallink> 887 section of the JNI specification for details. 888 </intro> 889 890 <intro id="context" label="Specification Context"> 891 Since this interface provides access to the state of applications running in the 892 Java virtual machine; 893 terminology refers to the Java platform and not the native 894 platform (unless stated otherwise). For example: 895 <ul> 896 <li>"thread" means Java programming language thread.</li> 897 <li>"stack frame" means Java virtual machine stack frame.</li> 898 <li>"class" means Java programming language class.</li> 899 <li>"heap" means Java virtual machine heap.</li> 900 <li>"monitor" means Java programming language object monitor.</li> 901 </ul> 902 <p/> 903 Sun, Sun Microsystems, the Sun logo, Java, and JVM 904 are trademarks or registered trademarks of Oracle 905 and/or its affiliates, in the U.S. and other countries. 906 </intro> 907 908 909 <functionsection label="Functions"> 910 <intro id="jvmtiEnvAccess" label="Accessing Functions"> 911 Native code accesses <jvmti/> features 912 by calling <jvmti/> functions. 913 Access to <jvmti/> functions is by use of an interface pointer 914 in the same manner as 915 <externallink id="jni/design.html">Java 916 Native Interface (JNI) functions</externallink> are accessed. 917 The <jvmti/> interface pointer is called the 918 <i>environment pointer</i>. 919 <p/> 920 An environment pointer is a pointer to an environment and has 921 the type <code>jvmtiEnv*</code>. 922 An environment has information about its <jvmti/> connection. 923 The first value in the environment is a pointer to the function table. 924 The function table is an array of pointers to <jvmti/> functions. 925 Every function pointer is at a predefined offset inside the 926 array. 927 <p/> 928 When used from the C language: 929 double indirection is used to access the functions; 930 the environment pointer provides context and is the first 931 parameter of each function call; for example: 932 <example> 933 jvmtiEnv *jvmti; 934 ... 935 jvmtiError err = (*jvmti)->GetLoadedClasses(jvmti, &class_count, &classes); 936 </example> 937 <p/> 938 When used from the C++ language: 939 functions are accessed as member functions of <code>jvmtiEnv</code>; 940 the environment pointer is not passed to the function call; for example: 941 <example> 942 jvmtiEnv *jvmti; 943 ... 944 jvmtiError err = jvmti->GetLoadedClasses(&class_count, &classes); 945 </example> 946 Unless otherwise stated, all examples and declarations in this 947 specification use the C language. 948 <p/> 949 A <jvmti/> environment can be obtained through the JNI Invocation API 950 <code>GetEnv</code> function: 951 <example> 952 jvmtiEnv *jvmti; 953 ... 954 (*jvm)->GetEnv(jvm, &jvmti, JVMTI_VERSION_1_0); 955 </example> 956 Each call to <code>GetEnv</code> 957 creates a new <jvmti/> connection and thus 958 a new <jvmti/> environment. 959 The <code>version</code> argument of <code>GetEnv</code> must be 960 a <jvmti/> version. 961 The returned environment may have a different version than the 962 requested version but the returned environment must be compatible. 963 <code>GetEnv</code> will return <code>JNI_EVERSION</code> if a 964 compatible version is not available, if <jvmti/> is not supported or 965 <jvmti/> is not supported in the current VM configuration. 966 Other interfaces may be added for creating <jvmti/> environments 967 in specific contexts. 968 Each environment has its own state (for example, 969 <functionlink id="SetEventNotificationMode">desired events</functionlink>, 970 <functionlink id="SetEventCallbacks">event handling functions</functionlink>, and 971 <functionlink id="AddCapabilities">capabilities</functionlink>). 972 An environment is released with 973 <functionlink id="DisposeEnvironment"></functionlink>. 974 Thus, unlike JNI which has one environment per thread, <jvmti/> environments work 975 across threads and are created dynamically. 976 </intro> 977 978 <intro id="functionReturn" label="Function Return Values"> 979 <jvmti/> functions always return an 980 <internallink id="ErrorSection">error code</internallink> via the 981 <datalink id="jvmtiError"/> function return value. 982 Some functions can return additional 983 values through pointers provided by the calling function. 984 In some cases, <jvmti/> functions allocate memory that your program must 985 explicitly deallocate. This is indicated in the individual <jvmti/> 986 function descriptions. Empty lists, arrays, sequences, etc are 987 returned as <code>NULL</code>. 988 <p/> 989 In the event that the <jvmti/> function encounters 990 an error (any return value other than <code>JVMTI_ERROR_NONE</code>) the values 991 of memory referenced by argument pointers is undefined, but no memory 992 will have been allocated and no global references will have been allocated. 993 If the error occurs because of invalid input, no action will have occurred. 994 </intro> 995 996 <intro id="refs" label="Managing JNI Object References"> 997 <jvmti/> functions identify objects with JNI references 998 (<datalink id="jobject"/> and <datalink id="jclass"/>) 999 and their derivatives 1000 (<datalink id="jthread"/> and <datalink id="jthreadGroup"/>). 1001 References passed to 1002 <jvmti/> functions can be either global or local, but they must be 1003 strong references. All references returned by <jvmti/> functions are 1004 local references--these local references are created 1005 during the <jvmti/> call. 1006 Local references are a resource that must be managed (see the 1007 <externallink id="jni/functions.html#local-references"> 1008 JNI Documentation</externallink>). 1009 When threads return from native code all local references 1010 are freed. Note that some threads, including typical 1011 agent threads, will never return from native code. 1012 A thread is ensured the ability to create sixteen local 1013 references without the need for any explicit management. 1014 For threads executing a limited number of <jvmti/> calls before 1015 returning from native code 1016 (for example, threads processing events), 1017 it may be determined that no explicit management 1018 is needed. 1019 However, long running agent threads will need explicit 1020 local reference management--usually with the JNI functions 1021 <code>PushLocalFrame</code> and <code>PopLocalFrame</code>. 1022 Conversely, to preserve references beyond the 1023 return from native code, they must be converted to global references. 1024 These rules do not apply to <datalink id="jmethodID"/> and <datalink id="jfieldID"/> 1025 as they are not <datalink id="jobject"/>s. 1026 </intro> 1027 1028 <intro id="prereqState" label="Prerequisite State for Calling Functions"> 1029 Unless the function explicitly states that the agent must bring 1030 a thread or the VM to a particular state (for example, suspended), 1031 the <jvmti/> implementation is responsible for bringing the VM to a 1032 safe and consistent state for performing the function. 1033 </intro> 1034 1035 <intro id="functionsExceptions" label="Exceptions and Functions"> 1036 <jvmti/> functions never throw exceptions; error conditions are 1037 communicated via the 1038 <internallink id="functionReturn">function return value</internallink>. 1039 Any existing exception state is preserved across a call to a 1040 <jvmti/> function. 1041 See the 1042 <externallink 1043 id="jni/design.html#java-exceptions" 1044 >Java Exceptions</externallink> 1045 section of the JNI specification for information on handling exceptions. 1046 </intro> 1047 1048 <category id="memory" label="Memory Management"> 1049 <intro> 1050 These functions provide for the allocation and deallocation of 1051 memory used by <jvmti/> functionality and can be used to provide 1052 working memory for agents. 1053 Memory managed by <jvmti/> is not compatible with other memory 1054 allocation libraries and mechanisms. 1055 </intro> 1056 1057 <function id="Allocate" jkernel="yes" phase="any" callbacksafe="safe" impl="notrace" num="46"> 1058 <synopsis>Allocate</synopsis> 1059 <description> 1060 Allocate an area of memory through the <jvmti/> allocator. 1061 The allocated 1062 memory should be freed with <functionlink id="Deallocate"></functionlink>. 1063 </description> 1064 <origin>jvmdi</origin> 1065 <capabilities> 1066 </capabilities> 1067 <parameters> 1068 <param id="size"> 1069 <jlong/> 1070 <description> 1071 The number of bytes to allocate. 1072 <rationale> 1073 <code>jlong</code> is used for compatibility with JVMDI. 1074 </rationale> 1075 </description> 1076 </param> 1077 <param id="mem_ptr"> 1078 <allocbuf incount="size"><uchar/></allocbuf> 1079 <description> 1080 On return, a pointer to the beginning of the allocated memory. 1081 If <code>size</code> is zero, <code>NULL</code> is returned. 1082 </description> 1083 </param> 1084 </parameters> 1085 <errors> 1086 <error id="JVMTI_ERROR_OUT_OF_MEMORY"> 1087 Memory request cannot be honored. 1088 </error> 1089 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 1090 <paramlink id="size"></paramlink> is less than zero. 1091 </error> 1092 </errors> 1093 </function> 1094 1095 <function id="Deallocate" jkernel="yes" phase="any" callbacksafe="safe" impl="notrace" num="47"> 1096 <synopsis>Deallocate</synopsis> 1097 <description> 1098 Deallocate <code>mem</code> using the <jvmti/> allocator. 1099 This function should 1100 be used to deallocate any memory allocated and returned 1101 by a <jvmti/> function 1102 (including memory allocated with <functionlink id="Allocate"></functionlink>). 1103 All allocated memory must be deallocated 1104 or the memory cannot be reclaimed. 1105 </description> 1106 <origin>jvmdi</origin> 1107 <capabilities> 1108 </capabilities> 1109 <parameters> 1110 <param id="mem"> 1111 <outbuf> 1112 <uchar/> 1113 <nullok>the call is ignored</nullok> 1114 </outbuf> 1115 <description> 1116 A pointer to the beginning of the allocated memory. 1117 Please ignore "On return, the elements are set." 1118 <todo>keep it from generating "On return, the elements are set"</todo> 1119 </description> 1120 </param> 1121 </parameters> 1122 <errors> 1123 </errors> 1124 </function> 1125 </category> 1126 1127 <category id="threadCategory" label="Thread"> 1128 <intro> 1129 </intro> 1130 1131 <function id="GetThreadState" num="17"> 1132 <synopsis>Get Thread State</synopsis> 1133 <description> 1134 Get the state of a thread. The state of the thread is represented by the 1135 answers to the hierarchical set of questions below: 1136 <ul type="circle"> 1137 <li><i>Alive?</i> 1138 <ul> 1139 <li>Not alive. 1140 <ul type="circle"> 1141 <li><i>Why not alive?</i> 1142 <ul> 1143 <li>New.</li> 1144 <li>Terminated (<datalink 1145 id="JVMTI_THREAD_STATE_TERMINATED"><code>JVMTI_THREAD_STATE_TERMINATED</code></datalink>)</li> 1146 </ul> 1147 </li> 1148 </ul> 1149 </li> 1150 <li>Alive (<datalink 1151 id="JVMTI_THREAD_STATE_ALIVE"><code>JVMTI_THREAD_STATE_ALIVE</code></datalink>) 1152 <ul type="circle"> 1153 <li><i>Suspended?</i> 1154 <ul> 1155 <li>Suspended (<datalink 1156 id="JVMTI_THREAD_STATE_SUSPENDED"><code>JVMTI_THREAD_STATE_SUSPENDED</code></datalink>)</li> 1157 <li>Not suspended</li> 1158 </ul> 1159 </li> 1160 <li><i>Interrupted?</i> 1161 <ul> 1162 <li>Interrupted (<datalink 1163 id="JVMTI_THREAD_STATE_INTERRUPTED"><code>JVMTI_THREAD_STATE_INTERRUPTED</code></datalink>)</li> 1164 <li>Not interrupted.</li> 1165 </ul> 1166 </li> 1167 <li><i>In native?</i> 1168 <ul> 1169 <li>In native code (<datalink 1170 id="JVMTI_THREAD_STATE_IN_NATIVE"><code>JVMTI_THREAD_STATE_IN_NATIVE</code></datalink>)</li> 1171 <li>In Java programming language code</li> 1172 </ul> 1173 </li> 1174 <li><i>What alive state?</i> 1175 <ul> 1176 <li>Runnable (<datalink 1177 id="JVMTI_THREAD_STATE_RUNNABLE"><code>JVMTI_THREAD_STATE_RUNNABLE</code></datalink>)</li> 1178 <li>Blocked (<datalink 1179 id="JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER"><code>JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER</code></datalink>)</li> 1180 <li>Waiting (<datalink 1181 id="JVMTI_THREAD_STATE_WAITING"><code>JVMTI_THREAD_STATE_WAITING</code></datalink>) 1182 <ul type="circle"> 1183 <li><i>Timed wait?</i> 1184 <ul> 1185 <li>Indefinite (<datalink 1186 id="JVMTI_THREAD_STATE_WAITING_INDEFINITELY"><code>JVMTI_THREAD_STATE_WAITING_INDEFINITELY</code></datalink></li> 1187 <li>Timed (<datalink 1188 id="JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT"><code>JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT</code></datalink>)</li> 1189 </ul> 1190 </li> 1191 <li><i>Why waiting?</i> 1192 <ul> 1193 <li>Object.wait (<datalink 1194 id="JVMTI_THREAD_STATE_IN_OBJECT_WAIT"><code>JVMTI_THREAD_STATE_IN_OBJECT_WAIT</code></datalink>)</li> 1195 <li>LockSupport.park (<datalink 1196 id="JVMTI_THREAD_STATE_PARKED"><code>JVMTI_THREAD_STATE_PARKED</code></datalink>)</li> 1197 <li>Sleeping (<datalink 1198 id="JVMTI_THREAD_STATE_SLEEPING"><code>JVMTI_THREAD_STATE_SLEEPING</code></datalink>)</li> 1199 </ul> 1200 </li> 1201 </ul> 1202 </li> 1203 </ul> 1204 </li> 1205 </ul> 1206 </li> 1207 </ul> 1208 </li> 1209 </ul> 1210 <p/> 1211 The answers are represented by the following bit vector. 1212 <constants id="jvmtiThreadState" label="Thread State Flags" kind="bits"> 1213 <constant id="JVMTI_THREAD_STATE_ALIVE" num="0x0001"> 1214 Thread is alive. Zero if thread is new (not started) or terminated. 1215 </constant> 1216 <constant id="JVMTI_THREAD_STATE_TERMINATED" num="0x0002"> 1217 Thread has completed execution. 1218 </constant> 1219 <constant id="JVMTI_THREAD_STATE_RUNNABLE" num="0x0004"> 1220 Thread is runnable. 1221 </constant> 1222 <constant id="JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER" num="0x0400"> 1223 Thread is waiting to enter a synchronization block/method or, 1224 after an <code>Object.wait()</code>, waiting to re-enter a 1225 synchronization block/method. 1226 </constant> 1227 <constant id="JVMTI_THREAD_STATE_WAITING" num="0x0080"> 1228 Thread is waiting. 1229 </constant> 1230 <constant id="JVMTI_THREAD_STATE_WAITING_INDEFINITELY" num="0x0010"> 1231 Thread is waiting without a timeout. 1232 For example, <code>Object.wait()</code>. 1233 </constant> 1234 <constant id="JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT" num="0x0020"> 1235 Thread is waiting with a maximum time to wait specified. 1236 For example, <code>Object.wait(long)</code>. 1237 </constant> 1238 <constant id="JVMTI_THREAD_STATE_SLEEPING" num="0x0040"> 1239 Thread is sleeping -- <code>Thread.sleep(long)</code>. 1240 </constant> 1241 <constant id="JVMTI_THREAD_STATE_IN_OBJECT_WAIT" num="0x0100"> 1242 Thread is waiting on an object monitor -- <code>Object.wait</code>. 1243 </constant> 1244 <constant id="JVMTI_THREAD_STATE_PARKED" num="0x0200"> 1245 Thread is parked, for example: <code>LockSupport.park</code>, 1246 <code>LockSupport.parkUtil</code> and <code>LockSupport.parkNanos</code>. 1247 </constant> 1248 <constant id="JVMTI_THREAD_STATE_SUSPENDED" num="0x100000"> 1249 Thread suspended. 1250 <code>java.lang.Thread.suspend()</code> 1251 or a <jvmti/> suspend function 1252 (such as <functionlink id="SuspendThread"></functionlink>) 1253 has been called on the thread. If this bit 1254 is set, the other bits refer to the thread state before suspension. 1255 </constant> 1256 <constant id="JVMTI_THREAD_STATE_INTERRUPTED" num="0x200000"> 1257 Thread has been interrupted. 1258 </constant> 1259 <constant id="JVMTI_THREAD_STATE_IN_NATIVE" num="0x400000"> 1260 Thread is in native code--that is, a native method is running 1261 which has not called back into the VM or Java programming 1262 language code. 1263 <p/> 1264 This flag is not set when running VM compiled Java programming 1265 language code nor is it set when running VM code or 1266 VM support code. Native VM interface functions, such as JNI and 1267 <jvmti/> functions, may be implemented as VM code. 1268 </constant> 1269 <constant id="JVMTI_THREAD_STATE_VENDOR_1" num="0x10000000"> 1270 Defined by VM vendor. 1271 </constant> 1272 <constant id="JVMTI_THREAD_STATE_VENDOR_2" num="0x20000000"> 1273 Defined by VM vendor. 1274 </constant> 1275 <constant id="JVMTI_THREAD_STATE_VENDOR_3" num="0x40000000"> 1276 Defined by VM vendor. 1277 </constant> 1278 </constants> 1279 The following definitions are used to convert <jvmti/> thread state 1280 to <code>java.lang.Thread.State</code> style states. 1281 <constants id="jvmtiJavaLangThreadState" label="java.lang.Thread.State Conversion Masks" kind="bits"> 1282 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_MASK" 1283 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"> 1284 Mask the state with this before comparison 1285 </constant> 1286 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_NEW" 1287 num="0"> 1288 <code>java.lang.Thread.State.NEW</code> 1289 </constant> 1290 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_TERMINATED" 1291 num="JVMTI_THREAD_STATE_TERMINATED"> 1292 <code>java.lang.Thread.State.TERMINATED</code> 1293 </constant> 1294 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_RUNNABLE" 1295 num="JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_RUNNABLE"> 1296 <code>java.lang.Thread.State.RUNNABLE</code> 1297 </constant> 1298 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_BLOCKED" 1299 num="JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER"> 1300 <code>java.lang.Thread.State.BLOCKED</code> 1301 </constant> 1302 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_WAITING" 1303 num="JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_WAITING | JVMTI_THREAD_STATE_WAITING_INDEFINITELY"> 1304 <code>java.lang.Thread.State.WAITING</code> 1305 </constant> 1306 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_TIMED_WAITING" 1307 num="JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_WAITING | JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT"> 1308 <code>java.lang.Thread.State.TIMED_WAITING</code> 1309 </constant> 1310 </constants> 1311 <b>Rules</b> 1312 <p/> 1313 There can be no more than one answer to a question, although there can be no 1314 answer (because the answer is unknown, does not apply, or none of the answers is 1315 correct). An answer is set only when the enclosing answers match. 1316 That is, no more than one of 1317 <ul type="circle"> 1318 <li><code>JVMTI_THREAD_STATE_RUNNABLE</code></li> 1319 <li><code>JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER</code></li> 1320 <li><code>JVMTI_THREAD_STATE_WAITING</code></li> 1321 </ul> 1322 can be set (a <tm>J2SE</tm> compliant implementation will always set 1323 one of these if <code>JVMTI_THREAD_STATE_ALIVE</code> is set). 1324 And if any of these are set, the enclosing answer 1325 <code>JVMTI_THREAD_STATE_ALIVE</code> is set. 1326 No more than one of 1327 <ul type="circle"> 1328 <li><code>JVMTI_THREAD_STATE_WAITING_INDEFINITELY</code></li> 1329 <li><code>JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT</code></li> 1330 </ul> 1331 can be set (a <tm>J2SE</tm> compliant implementation will always set 1332 one of these if <code>JVMTI_THREAD_STATE_WAITING</code> is set). 1333 And if either is set, the enclosing answers 1334 <code>JVMTI_THREAD_STATE_ALIVE</code> and 1335 <code>JVMTI_THREAD_STATE_WAITING</code> are set. 1336 No more than one of 1337 <ul type="circle"> 1338 <li><code>JVMTI_THREAD_STATE_IN_OBJECT_WAIT</code></li> 1339 <li><code>JVMTI_THREAD_STATE_PARKED</code></li> 1340 <li><code>JVMTI_THREAD_STATE_SLEEPING</code></li> 1341 </ul> 1342 can be set. And if any of these is set, the enclosing answers 1343 <code>JVMTI_THREAD_STATE_ALIVE</code> and 1344 <code>JVMTI_THREAD_STATE_WAITING</code> are set. 1345 Also, if <code>JVMTI_THREAD_STATE_SLEEPING</code> is set, 1346 then <code>JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT</code> is set. 1347 If a state <i>A</i> is implemented using the mechanism of 1348 state <i>B</i> then it is state <i>A</i> which 1349 is returned by this function. 1350 For example, if <code>Thread.sleep(long)</code> 1351 is implemented using <code>Object.wait(long)</code> 1352 then it is still <code>JVMTI_THREAD_STATE_SLEEPING</code> 1353 which is returned. 1354 More than one of 1355 <ul type="circle"> 1356 <li><code>JVMTI_THREAD_STATE_SUSPENDED</code></li> 1357 <li><code>JVMTI_THREAD_STATE_INTERRUPTED</code></li> 1358 <li><code>JVMTI_THREAD_STATE_IN_NATIVE</code></li> 1359 </ul> 1360 can be set, but if any is set, 1361 <code>JVMTI_THREAD_STATE_ALIVE</code> is set. 1362 <p/> 1363 And finally, 1364 <code>JVMTI_THREAD_STATE_TERMINATED</code> cannot be set unless 1365 <code>JVMTI_THREAD_STATE_ALIVE</code> is not set. 1366 <p/> 1367 The thread state representation is designed for extension in future versions 1368 of the specification; thread state values should be used accordingly, that is 1369 they should not be used as ordinals. 1370 Most queries can be made by testing a single bit, if use in a switch statement is desired, 1371 the state bits should be masked with the interesting bits. 1372 All bits not defined above are reserved for future use. 1373 A VM, compliant to the current specification, must set reserved bits to zero. 1374 An agent should ignore reserved bits -- 1375 they should not be assumed to be zero and thus should not be included in comparisons. 1376 <p/> 1377 <b>Examples</b> 1378 <p/> 1379 Note that the values below exclude reserved and vendor bits. 1380 <p/> 1381 The state of a thread blocked at a <code>synchronized</code>-statement would be: 1382 <example> 1383 JVMTI_THREAD_STATE_ALIVE + JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER 1384 </example> 1385 The state of a thread which hasn't started yet would be: 1386 <example> 1387 0 1388 </example> 1389 The state of a thread at a <code>Object.wait(3000)</code> would be: 1390 <example> 1391 JVMTI_THREAD_STATE_ALIVE + JVMTI_THREAD_STATE_WAITING + 1392 JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT + 1393 JVMTI_THREAD_STATE_MONITOR_WAITING 1394 </example> 1395 The state of a thread suspended while runnable would be: 1396 <example> 1397 JVMTI_THREAD_STATE_ALIVE + JVMTI_THREAD_STATE_RUNNABLE + JVMTI_THREAD_STATE_SUSPENDED 1398 </example> 1399 <p/> 1400 <b>Testing the State</b> 1401 <p/> 1402 In most cases, the thread state can be determined by testing the one bit corresponding 1403 to that question. For example, the code to test if a thread is sleeping: 1404 <example> 1405 jint state; 1406 jvmtiError err; 1407 1408 err = (*jvmti)->GetThreadState(jvmti, thread, &state); 1409 if (err == JVMTI_ERROR_NONE) { 1410 if (state & JVMTI_THREAD_STATE_SLEEPING) { ... 1411 </example> 1412 <p/> 1413 For waiting (that is, in <code>Object.wait</code>, parked, or sleeping) it would be: 1414 <example> 1415 if (state & JVMTI_THREAD_STATE_WAITING) { ... 1416 </example> 1417 For some states, more than one bit will need to be tested as is the case 1418 when testing if a thread has not yet been started: 1419 <example> 1420 if ((state & (JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_TERMINATED)) == 0) { ... 1421 </example> 1422 To distinguish timed from untimed <code>Object.wait</code>: 1423 <example> 1424 if (state & JVMTI_THREAD_STATE_IN_OBJECT_WAIT) { 1425 if (state & JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT) { 1426 printf("in Object.wait(long timeout)\n"); 1427 } else { 1428 printf("in Object.wait()\n"); 1429 } 1430 } 1431 </example> 1432 <p/> 1433 <b>Relationship to <code>java.lang.Thread.State</code></b> 1434 <p/> 1435 The thread state represented by <code>java.lang.Thread.State</code> 1436 returned from <code>java.lang.Thread.getState()</code> is a subset of the 1437 information returned from this function. 1438 The corresponding <code>java.lang.Thread.State</code> can be determined 1439 by using the provided conversion masks. 1440 For example, this returns the name of the <code>java.lang.Thread.State</code> thread state: 1441 <example> 1442 err = (*jvmti)->GetThreadState(jvmti, thread, &state); 1443 abortOnError(err); 1444 switch (state & JVMTI_JAVA_LANG_THREAD_STATE_MASK) { 1445 case JVMTI_JAVA_LANG_THREAD_STATE_NEW: 1446 return "NEW"; 1447 case JVMTI_JAVA_LANG_THREAD_STATE_TERMINATED: 1448 return "TERMINATED"; 1449 case JVMTI_JAVA_LANG_THREAD_STATE_RUNNABLE: 1450 return "RUNNABLE"; 1451 case JVMTI_JAVA_LANG_THREAD_STATE_BLOCKED: 1452 return "BLOCKED"; 1453 case JVMTI_JAVA_LANG_THREAD_STATE_WAITING: 1454 return "WAITING"; 1455 case JVMTI_JAVA_LANG_THREAD_STATE_TIMED_WAITING: 1456 return "TIMED_WAITING"; 1457 } 1458 </example> 1459 </description> 1460 <origin>new</origin> 1461 <capabilities> 1462 </capabilities> 1463 <parameters> 1464 <param id="thread"> 1465 <jthread null="current" started="maybe" impl="noconvert"/> 1466 <description> 1467 The thread to query. 1468 </description> 1469 </param> 1470 <param id="thread_state_ptr"> 1471 <outptr><jint/></outptr> 1472 <description> 1473 On return, points to state flags, 1474 as defined by the <internallink id="jvmtiThreadState">Thread State Flags</internallink>. 1475 </description> 1476 </param> 1477 </parameters> 1478 <errors> 1479 </errors> 1480 </function> 1481 1482 <function id="GetCurrentThread" phase="start" num="18" since="1.1"> 1483 <synopsis>Get Current Thread</synopsis> 1484 <description> 1485 Get the current thread. 1486 The current thread is the Java programming language thread which has called the function. 1487 The function may return <code>NULL</code> in the start phase if the 1488 <internallink id="jvmtiCapabilities.can_generate_early_vmstart"> 1489 <code>can_generate_early_vmstart</code></internallink> capability is enabled 1490 and the <code>java.lang.Thread</code> class has not been initialized yet. 1491 <p/> 1492 Note that most <jvmti/> functions that take a thread 1493 as an argument will accept <code>NULL</code> to mean 1494 the current thread. 1495 </description> 1496 <origin>new</origin> 1497 <capabilities> 1498 </capabilities> 1499 <parameters> 1500 <param id="thread_ptr"> 1501 <outptr><jthread/></outptr> 1502 <description> 1503 On return, points to the current thread, or <code>NULL</code>. 1504 </description> 1505 </param> 1506 </parameters> 1507 <errors> 1508 </errors> 1509 </function> 1510 1511 <function id="GetAllThreads" num="4"> 1512 <synopsis>Get All Threads</synopsis> 1513 <description> 1514 Get all live threads. 1515 The threads are Java programming language threads; 1516 that is, threads that are attached to the VM. 1517 A thread is live if <code>java.lang.Thread.isAlive()</code> 1518 would return <code>true</code>, that is, the thread has 1519 been started and has not yet died. 1520 The universe of threads is determined by the context of the <jvmti/> 1521 environment, which typically is all threads attached to the VM. 1522 Note that this includes <jvmti/> agent threads 1523 (see <functionlink id="RunAgentThread"/>). 1524 </description> 1525 <origin>jvmdi</origin> 1526 <capabilities> 1527 </capabilities> 1528 <parameters> 1529 <param id="threads_count_ptr"> 1530 <outptr><jint/></outptr> 1531 <description> 1532 On return, points to the number of running threads. 1533 </description> 1534 </param> 1535 <param id="threads_ptr"> 1536 <allocbuf outcount="threads_count_ptr"><jthread/></allocbuf> 1537 <description> 1538 On return, points to an array of references, one 1539 for each running thread. 1540 </description> 1541 </param> 1542 </parameters> 1543 <errors> 1544 </errors> 1545 </function> 1546 1547 <function id="SuspendThread" num="5"> 1548 <synopsis>Suspend Thread</synopsis> 1549 <description> 1550 Suspend the specified thread. If the calling thread is specified, 1551 this function will not return until some other thread calls 1552 <functionlink id="ResumeThread"></functionlink>. 1553 If the thread is currently suspended, this function 1554 does nothing and returns an error. 1555 </description> 1556 <origin>jvmdi</origin> 1557 <capabilities> 1558 <required id="can_suspend"></required> 1559 </capabilities> 1560 <parameters> 1561 <param id="thread"> 1562 <jthread null="current"/> 1563 <description> 1564 The thread to suspend. 1565 </description> 1566 </param> 1567 </parameters> 1568 <errors> 1569 <error id="JVMTI_ERROR_THREAD_SUSPENDED"> 1570 Thread already suspended. 1571 </error> 1572 </errors> 1573 </function> 1574 1575 <elide> 1576 <function id="SuspendAllThreads" num="101"> 1577 <synopsis>Suspend All Threads</synopsis> 1578 <description> 1579 <issue> 1580 There has been no explicit call for this function, and it will 1581 thus be removed if there is no interest. 1582 </issue> 1583 Suspend all live threads except: 1584 <ul> 1585 <li>already suspended threads</li> 1586 <li>those listed in <paramlink id="except_list"></paramlink></li> 1587 <li>certain system (non application) threads, as determined 1588 by the VM implementation</li> 1589 </ul> 1590 The threads are Java programming language threads; 1591 native threads which are not attached to the VM are not 1592 Java programming language threads. 1593 A thread is live if <code>java.lang.Thread.isAlive()</code> 1594 would return <code>true</code>, that is, the thread has 1595 been started and has not yet died. 1596 The universe of threads is determined 1597 by the context of the <jvmti/> 1598 environment, which, typically, is all threads attached to the VM, 1599 except critical VM internal threads and <jvmti/> agent threads 1600 (see <functionlink id="RunAgentThread"/>). 1601 <p/> 1602 If the calling thread is specified, 1603 all other threads are suspended first then the caller thread is suspended - 1604 this function will not return until some other thread calls 1605 <functionlink id="ResumeThread"></functionlink>. 1606 <p/> 1607 The list of actually 1608 suspended threads is returned in 1609 <paramlink id="suspended_list_ptr"></paramlink>. 1610 Suspension is as defined in <functionlink id="SuspendThread"></functionlink>. 1611 <functionlink id="ResumeThreadList"></functionlink> 1612 can be used to resume the suspended threads. 1613 </description> 1614 <origin>new</origin> 1615 <capabilities> 1616 <required id="can_suspend"></required> 1617 </capabilities> 1618 <parameters> 1619 <param id="except_count"> 1620 <jint min="0"/> 1621 <description> 1622 The number of threads in the list of threads not to be suspended. 1623 </description> 1624 </param> 1625 <param id="except_list"> 1626 <inbuf incount="except_count"> 1627 <jthread/> 1628 <nullok>not an error if <code>except_count == 0</code></nullok> 1629 </inbuf> 1630 <description> 1631 The list of threads not to be suspended. 1632 </description> 1633 </param> 1634 <param id="suspended_count_ptr"> 1635 <outptr><jint/></outptr> 1636 <description> 1637 On return, points to the number of threads suspended by this call. 1638 </description> 1639 </param> 1640 <param id="suspended_list_ptr"> 1641 <allocbuf outcount="suspended_count_ptr"><jthread/></allocbuf> 1642 <description> 1643 On return, points to an array of references, one 1644 for each thread suspended. 1645 </description> 1646 </param> 1647 </parameters> 1648 <errors> 1649 <error id="JVMTI_ERROR_INVALID_THREAD"> 1650 A thread in <paramlink id="except_list"></paramlink> was invalid. 1651 </error> 1652 <error id="JVMTI_ERROR_NULL_POINTER"> 1653 Both <paramlink id="except_list"></paramlink> was <code>NULL</code> 1654 and <paramlink id="except_count"></paramlink> was non-zero. 1655 </error> 1656 </errors> 1657 </function> 1658 </elide> 1659 1660 <function id="SuspendThreadList" num="92"> 1661 <synopsis>Suspend Thread List</synopsis> 1662 <description> 1663 Suspend the <paramlink id="request_count"></paramlink> 1664 threads specified in the 1665 <paramlink id="request_list"></paramlink> array. 1666 Threads may be resumed with 1667 <functionlink id="ResumeThreadList"></functionlink> or 1668 <functionlink id="ResumeThread"></functionlink>. 1669 If the calling thread is specified in the 1670 <paramlink id="request_list"></paramlink> array, this function will 1671 not return until some other thread resumes it. 1672 Errors encountered in the suspension of a thread 1673 are returned in the <paramlink id="results"></paramlink> 1674 array, <b>not</b> in the return value of this function. 1675 Threads that are currently suspended do not change state. 1676 </description> 1677 <origin>jvmdi</origin> 1678 <capabilities> 1679 <required id="can_suspend"></required> 1680 </capabilities> 1681 <parameters> 1682 <param id="request_count"> 1683 <jint min="0"/> 1684 <description> 1685 The number of threads to suspend. 1686 </description> 1687 </param> 1688 <param id="request_list"> 1689 <inbuf incount="request_count"><jthread/></inbuf> 1690 <description> 1691 The list of threads to suspend. 1692 </description> 1693 </param> 1694 <param id="results"> 1695 <outbuf incount="request_count"><enum>jvmtiError</enum></outbuf> 1696 <description> 1697 An agent supplied array of 1698 <paramlink id="request_count"></paramlink> elements. 1699 On return, filled with the error code for 1700 the suspend of the corresponding thread. 1701 The error code will be 1702 <errorlink id="JVMTI_ERROR_NONE"></errorlink> 1703 if the thread was suspended by this call. 1704 Possible error codes are those specified 1705 for <functionlink id="SuspendThread"></functionlink>. 1706 </description> 1707 </param> 1708 </parameters> 1709 <errors> 1710 </errors> 1711 </function> 1712 1713 <function id="ResumeThread" num="6"> 1714 <synopsis>Resume Thread</synopsis> 1715 <description> 1716 Resume a suspended thread. 1717 Any threads currently suspended through 1718 a <jvmti/> suspend function (eg. 1719 <functionlink id="SuspendThread"></functionlink>) 1720 or <code>java.lang.Thread.suspend()</code> 1721 will resume execution; 1722 all other threads are unaffected. 1723 </description> 1724 <origin>jvmdi</origin> 1725 <capabilities> 1726 <required id="can_suspend"></required> 1727 </capabilities> 1728 <parameters> 1729 <param id="thread"> 1730 <jthread/> 1731 <description> 1732 The thread to resume. 1733 </description> 1734 </param> 1735 </parameters> 1736 <errors> 1737 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 1738 Thread was not suspended. 1739 </error> 1740 <error id="JVMTI_ERROR_INVALID_TYPESTATE"> 1741 The state of the thread has been modified, and is now inconsistent. 1742 </error> 1743 </errors> 1744 </function> 1745 1746 <function id="ResumeThreadList" num="93"> 1747 <synopsis>Resume Thread List</synopsis> 1748 <description> 1749 Resume the <paramlink id="request_count"></paramlink> 1750 threads specified in the 1751 <paramlink id="request_list"></paramlink> array. 1752 Any thread suspended through 1753 a <jvmti/> suspend function (eg. 1754 <functionlink id="SuspendThreadList"></functionlink>) 1755 or <code>java.lang.Thread.suspend()</code> 1756 will resume execution. 1757 </description> 1758 <origin>jvmdi</origin> 1759 <capabilities> 1760 <required id="can_suspend"></required> 1761 </capabilities> 1762 <parameters> 1763 <param id="request_count"> 1764 <jint min="0"/> 1765 <description> 1766 The number of threads to resume. 1767 </description> 1768 </param> 1769 <param id="request_list"> 1770 <inbuf incount="request_count"><jthread/></inbuf> 1771 <description> 1772 The threads to resume. 1773 </description> 1774 </param> 1775 <param id="results"> 1776 <outbuf incount="request_count"><enum>jvmtiError</enum></outbuf> 1777 <description> 1778 An agent supplied array of 1779 <paramlink id="request_count"></paramlink> elements. 1780 On return, filled with the error code for 1781 the resume of the corresponding thread. 1782 The error code will be 1783 <errorlink id="JVMTI_ERROR_NONE"></errorlink> 1784 if the thread was suspended by this call. 1785 Possible error codes are those specified 1786 for <functionlink id="ResumeThread"></functionlink>. 1787 </description> 1788 </param> 1789 </parameters> 1790 <errors> 1791 </errors> 1792 </function> 1793 1794 <function id="StopThread" num="7"> 1795 <synopsis>Stop Thread</synopsis> 1796 <description> 1797 Send the specified asynchronous exception to the specified thread. 1798 Normally, this function is used to kill the specified thread with an 1799 instance of the exception <code>ThreadDeath</code>, similar to 1800 <code>java.lang.Thread.stop</code>. 1801 </description> 1802 <origin>jvmdi</origin> 1803 <capabilities> 1804 <required id="can_signal_thread"></required> 1805 </capabilities> 1806 <parameters> 1807 <param id="thread"> 1808 <jthread/> 1809 <description> 1810 The thread to stop. 1811 </description> 1812 </param> 1813 <param id="exception"> 1814 <jobject/> 1815 <description> 1816 The asynchronous exception object. 1817 </description> 1818 </param> 1819 </parameters> 1820 <errors> 1821 </errors> 1822 </function> 1823 1824 <function id="InterruptThread" num="8"> 1825 <synopsis>Interrupt Thread</synopsis> 1826 <description> 1827 Interrupt the specified thread 1828 (similar to <code>java.lang.Thread.interrupt</code>). 1829 </description> 1830 <origin>jvmdi</origin> 1831 <capabilities> 1832 <required id="can_signal_thread"></required> 1833 </capabilities> 1834 <parameters> 1835 <param id="thread"> 1836 <jthread impl="noconvert"/> 1837 <description> 1838 The thread to interrupt. 1839 </description> 1840 </param> 1841 </parameters> 1842 <errors> 1843 </errors> 1844 </function> 1845 1846 <function id="GetThreadInfo" num="9"> 1847 <synopsis>Get Thread Info</synopsis> 1848 <typedef id="jvmtiThreadInfo" label="Thread information structure"> 1849 <field id="name"> 1850 <allocfieldbuf><char/></allocfieldbuf> 1851 <description> 1852 The thread name, encoded as a 1853 <internallink id="mUTF">modified UTF-8</internallink> string. 1854 </description> 1855 </field> 1856 <field id="priority"> 1857 <jint/> 1858 <description> 1859 The thread priority. See the thread priority constants: 1860 <datalink id="jvmtiThreadPriority"></datalink>. 1861 </description> 1862 </field> 1863 <field id="is_daemon"> 1864 <jboolean/> 1865 <description> 1866 Is this a daemon thread? 1867 </description> 1868 </field> 1869 <field id="thread_group"> 1870 <jthreadGroup/> 1871 <description> 1872 The thread group to which this thread belongs. 1873 <code>NULL</code> if the thread has died. 1874 </description> 1875 </field> 1876 <field id="context_class_loader"> 1877 <jobject/> 1878 <description> 1879 The context class loader associated with this thread. 1880 </description> 1881 </field> 1882 </typedef> 1883 <description> 1884 Get thread information. The fields of the <datalink id="jvmtiThreadInfo"/> structure 1885 are filled in with details of the specified thread. 1886 </description> 1887 <origin>jvmdi</origin> 1888 <capabilities> 1889 </capabilities> 1890 <parameters> 1891 <param id="thread"> 1892 <jthread null="current" impl="noconvert" started="maybe"/> 1893 <description> 1894 The thread to query. 1895 </description> 1896 </param> 1897 <param id="info_ptr"> 1898 <outptr><struct>jvmtiThreadInfo</struct></outptr> 1899 <description> 1900 On return, filled with information describing the specified thread. 1901 </description> 1902 </param> 1903 </parameters> 1904 <errors> 1905 </errors> 1906 </function> 1907 1908 <function id="GetOwnedMonitorInfo" num="10"> 1909 <synopsis>Get Owned Monitor Info</synopsis> 1910 <description> 1911 Get information about the monitors owned by the 1912 specified thread. 1913 </description> 1914 <origin>jvmdiClone</origin> 1915 <capabilities> 1916 <required id="can_get_owned_monitor_info"></required> 1917 </capabilities> 1918 <parameters> 1919 <param id="thread"> 1920 <jthread null="current"/> 1921 <description> 1922 The thread to query. 1923 </description> 1924 </param> 1925 <param id="owned_monitor_count_ptr"> 1926 <outptr><jint/></outptr> 1927 <description> 1928 The number of monitors returned. 1929 </description> 1930 </param> 1931 <param id="owned_monitors_ptr"> 1932 <allocbuf outcount="owned_monitor_count_ptr"><jobject/></allocbuf> 1933 <description> 1934 The array of owned monitors. 1935 </description> 1936 </param> 1937 </parameters> 1938 <errors> 1939 </errors> 1940 </function> 1941 1942 <function id="GetOwnedMonitorStackDepthInfo" num="153" since="1.1"> 1943 <synopsis>Get Owned Monitor Stack Depth Info</synopsis> 1944 <typedef id="jvmtiMonitorStackDepthInfo" 1945 label="Monitor stack depth information structure"> 1946 <field id="monitor"> 1947 <jobject/> 1948 <description> 1949 The owned monitor. 1950 </description> 1951 </field> 1952 <field id="stack_depth"> 1953 <jint/> 1954 <description> 1955 The stack depth. Corresponds to the stack depth used in the 1956 <internallink id="stack">Stack Frame functions</internallink>. 1957 That is, zero is the current frame, one is the frame which 1958 called the current frame. And it is negative one if the 1959 implementation cannot determine the stack depth (e.g., for 1960 monitors acquired by JNI <code>MonitorEnter</code>). 1961 </description> 1962 </field> 1963 </typedef> 1964 <description> 1965 Get information about the monitors owned by the 1966 specified thread and the depth of the stack frame which locked them. 1967 </description> 1968 <origin>new</origin> 1969 <capabilities> 1970 <required id="can_get_owned_monitor_stack_depth_info"></required> 1971 </capabilities> 1972 <parameters> 1973 <param id="thread"> 1974 <jthread null="current"/> 1975 <description> 1976 The thread to query. 1977 </description> 1978 </param> 1979 <param id="monitor_info_count_ptr"> 1980 <outptr><jint/></outptr> 1981 <description> 1982 The number of monitors returned. 1983 </description> 1984 </param> 1985 <param id="monitor_info_ptr"> 1986 <allocbuf outcount="monitor_info_count_ptr"> 1987 <struct>jvmtiMonitorStackDepthInfo</struct> 1988 </allocbuf> 1989 <description> 1990 The array of owned monitor depth information. 1991 </description> 1992 </param> 1993 </parameters> 1994 <errors> 1995 </errors> 1996 </function> 1997 1998 <function id="GetCurrentContendedMonitor" num="11"> 1999 <synopsis>Get Current Contended Monitor</synopsis> 2000 <description> 2001 Get the object, if any, whose monitor the specified thread is waiting to 2002 enter or waiting to regain through <code>java.lang.Object.wait</code>. 2003 </description> 2004 <origin>jvmdi</origin> 2005 <capabilities> 2006 <required id="can_get_current_contended_monitor"></required> 2007 </capabilities> 2008 <parameters> 2009 <param id="thread"> 2010 <jthread null="current"/> 2011 <description> 2012 The thread to query. 2013 </description> 2014 </param> 2015 <param id="monitor_ptr"> 2016 <outptr><jobject/></outptr> 2017 <description> 2018 On return, filled with the current contended monitor, or 2019 NULL if there is none. 2020 </description> 2021 </param> 2022 </parameters> 2023 <errors> 2024 </errors> 2025 </function> 2026 2027 <callback id="jvmtiStartFunction"> 2028 <void/> 2029 <synopsis>Agent Start Function</synopsis> 2030 <description> 2031 Agent supplied callback function. 2032 This function is the entry point for an agent thread 2033 started with 2034 <functionlink id="RunAgentThread"></functionlink>. 2035 </description> 2036 <parameters> 2037 <param id="jvmti_env"> 2038 <outptr> 2039 <struct>jvmtiEnv</struct> 2040 </outptr> 2041 <description> 2042 The <jvmti/> environment. 2043 </description> 2044 </param> 2045 <param id="jni_env"> 2046 <outptr> 2047 <struct>JNIEnv</struct> 2048 </outptr> 2049 <description> 2050 The JNI environment. 2051 </description> 2052 </param> 2053 <param id="arg"> 2054 <outptr> 2055 <void/> 2056 </outptr> 2057 <description> 2058 The <code>arg</code> parameter passed to 2059 <functionlink id="RunAgentThread"></functionlink>. 2060 </description> 2061 </param> 2062 </parameters> 2063 </callback> 2064 2065 <function id="RunAgentThread" num="12"> 2066 <synopsis>Run Agent Thread</synopsis> 2067 <description> 2068 Starts the execution of an agent thread. with the specified native function. 2069 The parameter <paramlink id="arg"></paramlink> is forwarded on to the 2070 <functionlink id="jvmtiStartFunction">start function</functionlink> 2071 (specified with <paramlink id="proc"></paramlink>) as its single argument. 2072 This function allows the creation of agent threads 2073 for handling communication with another process or for handling events 2074 without the need to load a special subclass of <code>java.lang.Thread</code> or 2075 implementer of <code>java.lang.Runnable</code>. 2076 Instead, the created thread can run entirely in native code. 2077 However, the created thread does require a newly created instance 2078 of <code>java.lang.Thread</code> (referenced by the argument <code>thread</code>) to 2079 which it will be associated. 2080 The thread object can be created with JNI calls. 2081 <p/> 2082 The following common thread priorities are provided for your convenience: 2083 <constants id="jvmtiThreadPriority" label="Thread Priority Constants" kind="const"> 2084 <constant id="JVMTI_THREAD_MIN_PRIORITY" num="1"> 2085 Minimum possible thread priority 2086 </constant> 2087 <constant id="JVMTI_THREAD_NORM_PRIORITY" num="5"> 2088 Normal thread priority 2089 </constant> 2090 <constant id="JVMTI_THREAD_MAX_PRIORITY" num="10"> 2091 Maximum possible thread priority 2092 </constant> 2093 </constants> 2094 <p/> 2095 The new thread is started as a daemon thread with the specified 2096 <paramlink id="priority"></paramlink>. 2097 If enabled, a <eventlink id="ThreadStart"/> event will be sent. 2098 <p/> 2099 Since the thread has been started, the thread will be live when this function 2100 returns, unless the thread has died immediately. 2101 <p/> 2102 The thread group of the thread is ignored -- specifically, the thread is not 2103 added to the thread group and the thread is not seen on queries of the thread 2104 group at either the Java programming language or <jvmti/> levels. 2105 <p/> 2106 The thread is not visible to Java programming language queries but is 2107 included in <jvmti/> queries (for example, 2108 <functionlink id="GetAllThreads"/> and 2109 <functionlink id="GetAllStackTraces"/>). 2110 <p/> 2111 Upon execution of <code>proc</code>, the new thread will be attached to the 2112 VM -- see the JNI documentation on 2113 <externallink id="jni/invocation.html#attaching-to-the-vm" 2114 >Attaching to the VM</externallink>. 2115 </description> 2116 <origin>jvmdiClone</origin> 2117 <capabilities> 2118 </capabilities> 2119 <parameters> 2120 <param id="thread"> 2121 <jthread impl="noconvert" started="no"/> 2122 <description> 2123 The thread to run. 2124 </description> 2125 </param> 2126 <param id="proc"> 2127 <ptrtype> 2128 <struct>jvmtiStartFunction</struct> 2129 </ptrtype> 2130 <description> 2131 The start function. 2132 </description> 2133 </param> 2134 <param id="arg"> 2135 <inbuf> 2136 <void/> 2137 <nullok><code>NULL</code> is passed to the start function</nullok> 2138 </inbuf> 2139 <description> 2140 The argument to the start function. 2141 </description> 2142 </param> 2143 <param id="priority"> 2144 <jint/> 2145 <description> 2146 The priority of the started thread. Any thread 2147 priority allowed by <code>java.lang.Thread.setPriority</code> can be used including 2148 those in <datalink id="jvmtiThreadPriority"></datalink>. 2149 </description> 2150 </param> 2151 </parameters> 2152 <errors> 2153 <error id="JVMTI_ERROR_INVALID_PRIORITY"> 2154 <paramlink id="priority"/> is less than 2155 <datalink id="JVMTI_THREAD_MIN_PRIORITY"/> 2156 or greater than 2157 <datalink id="JVMTI_THREAD_MAX_PRIORITY"/> 2158 </error> 2159 </errors> 2160 </function> 2161 2162 <function id="SetThreadLocalStorage" jkernel="yes" impl="notrace" phase="start" num="103"> 2163 <synopsis>Set Thread Local Storage</synopsis> 2164 <description> 2165 The VM stores a pointer value associated with each environment-thread 2166 pair. This pointer value is called <i>thread-local storage</i>. 2167 This value is <code>NULL</code> unless set with this function. 2168 Agents can allocate memory in which they store thread specific 2169 information. By setting thread-local storage it can then be 2170 accessed with 2171 <functionlink id="GetThreadLocalStorage"></functionlink>. 2172 <p/> 2173 This function is called by the agent to set the value of the <jvmti/> 2174 thread-local storage. <jvmti/> supplies to the agent a pointer-size 2175 thread-local storage that can be used to record per-thread 2176 information. 2177 </description> 2178 <origin>jvmpi</origin> 2179 <capabilities> 2180 </capabilities> 2181 <parameters> 2182 <param id="thread"> 2183 <jthread null="current"/> 2184 <description> 2185 Store to this thread. 2186 </description> 2187 </param> 2188 <param id="data"> 2189 <inbuf> 2190 <void/> 2191 <nullok>value is set to <code>NULL</code></nullok> 2192 </inbuf> 2193 <description> 2194 The value to be entered into the thread-local storage. 2195 </description> 2196 </param> 2197 </parameters> 2198 <errors> 2199 </errors> 2200 </function> 2201 2202 <function id="GetThreadLocalStorage" jkernel="yes" impl="innative notrace" phase="start" num="102"> 2203 <synopsis>Get Thread Local Storage</synopsis> 2204 <description> 2205 Called by the agent to get the value of the <jvmti/> thread-local 2206 storage. 2207 </description> 2208 <origin>jvmpi</origin> 2209 <capabilities> 2210 </capabilities> 2211 <parameters> 2212 <param id="thread"> 2213 <jthread null="current" impl="noconvert"/> 2214 <description> 2215 Retrieve from this thread. 2216 </description> 2217 </param> 2218 <param id="data_ptr"> 2219 <agentbuf><void/></agentbuf> 2220 <description> 2221 Pointer through which the value of the thread local 2222 storage is returned. 2223 If thread-local storage has not been set with 2224 <functionlink id="SetThreadLocalStorage"></functionlink> the returned 2225 pointer is <code>NULL</code>. 2226 </description> 2227 </param> 2228 </parameters> 2229 <errors> 2230 </errors> 2231 </function> 2232 2233 </category> 2234 2235 <category id="thread_groups" label="Thread Group"> 2236 <intro> 2237 </intro> 2238 2239 <function id="GetTopThreadGroups" num="13"> 2240 <synopsis>Get Top Thread Groups</synopsis> 2241 <description> 2242 Return all top-level (parentless) thread groups in the VM. 2243 </description> 2244 <origin>jvmdi</origin> 2245 <capabilities> 2246 </capabilities> 2247 <parameters> 2248 <param id="group_count_ptr"> 2249 <outptr><jint/></outptr> 2250 <description> 2251 On return, points to the number of top-level thread groups. 2252 </description> 2253 </param> 2254 <param id="groups_ptr"> 2255 <allocbuf outcount="group_count_ptr"><jthreadGroup/></allocbuf> 2256 <description> 2257 On return, refers to a pointer to the top-level thread group array. 2258 </description> 2259 </param> 2260 </parameters> 2261 <errors> 2262 </errors> 2263 </function> 2264 2265 <function id="GetThreadGroupInfo" num="14"> 2266 <synopsis>Get Thread Group Info</synopsis> 2267 <typedef id="jvmtiThreadGroupInfo" label="Thread group information structure"> 2268 <field id="parent"> 2269 <jthreadGroup/> 2270 <description> 2271 The parent thread group. 2272 </description> 2273 </field> 2274 <field id="name"> 2275 <allocfieldbuf><char/></allocfieldbuf> 2276 <description> 2277 The thread group's name, encoded as a 2278 <internallink id="mUTF">modified UTF-8</internallink> string. 2279 </description> 2280 </field> 2281 <field id="max_priority"> 2282 <jint/> 2283 <description> 2284 The maximum priority for this thread group. 2285 </description> 2286 </field> 2287 <field id="is_daemon"> 2288 <jboolean/> 2289 <description> 2290 Is this a daemon thread group? 2291 </description> 2292 </field> 2293 </typedef> 2294 <description> 2295 Get information about the thread group. The fields of the 2296 <functionlink id="jvmtiThreadGroupInfo"></functionlink> structure 2297 are filled in with details of the specified thread group. 2298 </description> 2299 <origin>jvmdi</origin> 2300 <capabilities> 2301 </capabilities> 2302 <parameters> 2303 <param id="group"> 2304 <jthreadGroup/> 2305 <description> 2306 The thread group to query. 2307 </description> 2308 </param> 2309 <param id="info_ptr"> 2310 <outptr><struct>jvmtiThreadGroupInfo</struct></outptr> 2311 <description> 2312 On return, filled with information describing the specified 2313 thread group. 2314 </description> 2315 </param> 2316 </parameters> 2317 <errors> 2318 </errors> 2319 </function> 2320 2321 <function id="GetThreadGroupChildren" num="15"> 2322 <synopsis>Get Thread Group Children</synopsis> 2323 <description> 2324 Get the live threads and active subgroups in this thread group. 2325 </description> 2326 <origin>jvmdi</origin> 2327 <capabilities> 2328 </capabilities> 2329 <parameters> 2330 <param id="group"> 2331 <jthreadGroup/> 2332 <description> 2333 The group to query. 2334 </description> 2335 </param> 2336 <param id="thread_count_ptr"> 2337 <outptr><jint/></outptr> 2338 <description> 2339 On return, points to the number of live threads in this thread group. 2340 </description> 2341 </param> 2342 <param id="threads_ptr"> 2343 <allocbuf outcount="thread_count_ptr"><jthread/></allocbuf> 2344 <description> 2345 On return, points to an array of the live threads in this thread group. 2346 </description> 2347 </param> 2348 <param id="group_count_ptr"> 2349 <outptr><jint/></outptr> 2350 <description> 2351 On return, points to the number of active child thread groups 2352 </description> 2353 </param> 2354 <param id="groups_ptr"> 2355 <allocbuf outcount="group_count_ptr"><jthreadGroup/></allocbuf> 2356 <description> 2357 On return, points to an array of the active child thread groups. 2358 </description> 2359 </param> 2360 </parameters> 2361 <errors> 2362 </errors> 2363 </function> 2364 </category> 2365 2366 <category id="stack" label="Stack Frame"> 2367 <intro> 2368 These functions provide information about the stack of a thread. 2369 Stack frames are referenced by depth. 2370 The frame at depth zero is the current frame. 2371 <p/> 2372 Stack frames are as described in 2373 <vmspec chapter="3.6"/>, 2374 That is, they correspond to method 2375 invocations (including native methods) but do not correspond to platform native or 2376 VM internal frames. 2377 <p/> 2378 A <jvmti/> implementation may use method invocations to launch a thread and 2379 the corresponding frames may be included in the stack as presented by these functions -- 2380 that is, there may be frames shown 2381 deeper than <code>main()</code> and <code>run()</code>. 2382 However this presentation must be consistent across all <jvmti/> functionality which 2383 uses stack frames or stack depth. 2384 </intro> 2385 2386 <typedef id="jvmtiFrameInfo" label="Stack frame information structure"> 2387 <description> 2388 Information about a stack frame is returned in this structure. 2389 </description> 2390 <field id="method"> 2391 <jmethodID/> 2392 <description> 2393 The method executing in this frame. 2394 </description> 2395 </field> 2396 <field id="location"> 2397 <jlocation/> 2398 <description> 2399 The index of the instruction executing in this frame. 2400 <code>-1</code> if the frame is executing a native method. 2401 </description> 2402 </field> 2403 </typedef> 2404 2405 <typedef id="jvmtiStackInfo" label="Stack information structure"> 2406 <description> 2407 Information about a set of stack frames is returned in this structure. 2408 </description> 2409 <field id="thread"> 2410 <jthread/> 2411 <description> 2412 On return, the thread traced. 2413 </description> 2414 </field> 2415 <field id="state"> 2416 <jint/> 2417 <description> 2418 On return, the thread state. See <functionlink id="GetThreadState"></functionlink>. 2419 </description> 2420 </field> 2421 <field id="frame_buffer"> 2422 <outbuf incount="max_frame_count"> 2423 <struct>jvmtiFrameInfo</struct> 2424 </outbuf> 2425 <description> 2426 On return, this agent allocated buffer is filled 2427 with stack frame information. 2428 </description> 2429 </field> 2430 <field id="frame_count"> 2431 <jint/> 2432 <description> 2433 On return, the number of records filled into 2434 <code>frame_buffer</code>. 2435 This will be 2436 min(<code>max_frame_count</code>, <i>stackDepth</i>). 2437 </description> 2438 </field> 2439 </typedef> 2440 2441 <function id="GetStackTrace" num="104"> 2442 <synopsis>Get Stack Trace</synopsis> 2443 <description> 2444 Get information about the stack of a thread. 2445 If <paramlink id="max_frame_count"></paramlink> is less than the depth of the stack, 2446 the <paramlink id="max_frame_count"></paramlink> topmost frames are returned, 2447 otherwise the entire stack is returned. 2448 The topmost frames, those most recently invoked, are at the beginning of the returned buffer. 2449 <p/> 2450 The following example causes up to five of the topmost frames 2451 to be returned and (if there are any frames) the currently 2452 executing method name to be printed. 2453 <example> 2454 jvmtiFrameInfo frames[5]; 2455 jint count; 2456 jvmtiError err; 2457 2458 err = (*jvmti)->GetStackTrace(jvmti, aThread, 0, 5, 2459 frames, &count); 2460 if (err == JVMTI_ERROR_NONE && count >= 1) { 2461 char *methodName; 2462 err = (*jvmti)->GetMethodName(jvmti, frames[0].method, 2463 &methodName, NULL, NULL); 2464 if (err == JVMTI_ERROR_NONE) { 2465 printf("Executing method: %s", methodName); 2466 } 2467 } 2468 </example> 2469 <todo> 2470 check example code. 2471 </todo> 2472 <p/> 2473 The <paramlink id="thread"></paramlink> need not be suspended 2474 to call this function. 2475 <p/> 2476 The <functionlink id="GetLineNumberTable"></functionlink> 2477 function can be used to map locations to line numbers. Note that 2478 this mapping can be done lazily. 2479 </description> 2480 <origin>jvmpi</origin> 2481 <capabilities> 2482 </capabilities> 2483 <parameters> 2484 <param id="thread"> 2485 <jthread null="current"/> 2486 <description> 2487 Fetch the stack trace of this thread. 2488 </description> 2489 </param> 2490 <param id="start_depth"> 2491 <jint/> 2492 <description> 2493 Begin retrieving frames at this depth. 2494 If non-negative, count from the current frame, 2495 the first frame retrieved is at depth <code>start_depth</code>. 2496 For example, if zero, start from the current frame; if one, start from the 2497 caller of the current frame; if two, start from the caller of the 2498 caller of the current frame; and so on. 2499 If negative, count from below the oldest frame, 2500 the first frame retrieved is at depth <i>stackDepth</i><code> + start_depth</code>, 2501 where <i>stackDepth</i> is the count of frames on the stack. 2502 For example, if negative one, only the oldest frame is retrieved; 2503 if negative two, start from the frame called by the oldest frame. 2504 </description> 2505 </param> 2506 <param id="max_frame_count"> 2507 <jint min="0"/> 2508 <description> 2509 The maximum number of <datalink id="jvmtiFrameInfo"/> records to retrieve. 2510 </description> 2511 </param> 2512 <param id="frame_buffer"> 2513 <outbuf incount="max_frame_count" outcount="count_ptr"> 2514 <struct>jvmtiFrameInfo</struct> 2515 </outbuf> 2516 <description> 2517 On return, this agent allocated buffer is filled 2518 with stack frame information. 2519 </description> 2520 </param> 2521 <param id="count_ptr"> 2522 <outptr><jint/></outptr> 2523 <description> 2524 On return, points to the number of records filled in. 2525 For non-negative <code>start_depth</code>, this will be 2526 min(<code>max_frame_count</code>, <i>stackDepth</i><code> - start_depth</code>). 2527 For negative <code>start_depth</code>, this will be 2528 min(<code>max_frame_count</code>, <code>-start_depth</code>). 2529 </description> 2530 </param> 2531 </parameters> 2532 <errors> 2533 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 2534 <paramlink id="start_depth"/> is positive and greater than or equal to <i>stackDepth</i>. 2535 Or <paramlink id="start_depth"/> is negative and less than <i>-stackDepth</i>. 2536 </error> 2537 </errors> 2538 </function> 2539 2540 2541 <function id="GetAllStackTraces" num="100"> 2542 <synopsis>Get All Stack Traces</synopsis> 2543 <description> 2544 Get information about the stacks of all live threads 2545 (including <internallink id="RunAgentThread">agent threads</internallink>). 2546 If <paramlink id="max_frame_count"/> is less than the depth of a stack, 2547 the <paramlink id="max_frame_count"/> topmost frames are returned for that thread, 2548 otherwise the entire stack is returned. 2549 The topmost frames, those most recently invoked, are at the beginning of the returned buffer. 2550 <p/> 2551 All stacks are collected simultaneously, that is, no changes will occur to the 2552 thread state or stacks between the sampling of one thread and the next. 2553 The threads need not be suspended. 2554 2555 <example> 2556 jvmtiStackInfo *stack_info; 2557 jint thread_count; 2558 int ti; 2559 jvmtiError err; 2560 2561 err = (*jvmti)->GetAllStackTraces(jvmti, MAX_FRAMES, &stack_info, &thread_count); 2562 if (err != JVMTI_ERROR_NONE) { 2563 ... 2564 } 2565 for (ti = 0; ti < thread_count; ++ti) { 2566 jvmtiStackInfo *infop = &stack_info[ti]; 2567 jthread thread = infop->thread; 2568 jint state = infop->state; 2569 jvmtiFrameInfo *frames = infop->frame_buffer; 2570 int fi; 2571 2572 myThreadAndStatePrinter(thread, state); 2573 for (fi = 0; fi < infop->frame_count; fi++) { 2574 myFramePrinter(frames[fi].method, frames[fi].location); 2575 } 2576 } 2577 /* this one Deallocate call frees all data allocated by GetAllStackTraces */ 2578 err = (*jvmti)->Deallocate(jvmti, stack_info); 2579 </example> 2580 <todo> 2581 check example code. 2582 </todo> 2583 2584 </description> 2585 <origin>new</origin> 2586 <capabilities> 2587 </capabilities> 2588 <parameters> 2589 <param id="max_frame_count"> 2590 <jint min="0"/> 2591 <description> 2592 The maximum number of <datalink id="jvmtiFrameInfo"/> records to retrieve per thread. 2593 </description> 2594 </param> 2595 <param id="stack_info_ptr"> 2596 <allocbuf> 2597 <struct>jvmtiStackInfo</struct> 2598 </allocbuf> 2599 <description> 2600 On return, this buffer is filled 2601 with stack information for each thread. 2602 The number of <datalink id="jvmtiStackInfo"/> records is determined 2603 by <paramlink id="thread_count_ptr"/>. 2604 <p/> 2605 Note that this buffer is allocated to include the <datalink id="jvmtiFrameInfo"/> 2606 buffers pointed to by <datalink id="jvmtiStackInfo.frame_buffer"/>. 2607 These buffers must not be separately deallocated. 2608 </description> 2609 </param> 2610 <param id="thread_count_ptr"> 2611 <outptr><jint/></outptr> 2612 <description> 2613 The number of threads traced. 2614 </description> 2615 </param> 2616 </parameters> 2617 <errors> 2618 </errors> 2619 </function> 2620 2621 <function id="GetThreadListStackTraces" num="101"> 2622 <synopsis>Get Thread List Stack Traces</synopsis> 2623 <description> 2624 Get information about the stacks of the supplied threads. 2625 If <paramlink id="max_frame_count"/> is less than the depth of a stack, 2626 the <paramlink id="max_frame_count"/> topmost frames are returned for that thread, 2627 otherwise the entire stack is returned. 2628 The topmost frames, those most recently invoked, are at the beginning of the returned buffer. 2629 <p/> 2630 All stacks are collected simultaneously, that is, no changes will occur to the 2631 thread state or stacks between the sampling one thread and the next. 2632 The threads need not be suspended. 2633 <p/> 2634 If a thread has not yet started or terminates before the stack information is collected, 2635 a zero length stack (<datalink id="jvmtiStackInfo.frame_count"/> will be zero) 2636 will be returned and the thread <datalink id="jvmtiStackInfo.state"/> can be checked. 2637 <p/> 2638 See the example for the similar function 2639 <functionlink id="GetAllStackTraces"/>. 2640 </description> 2641 <origin>new</origin> 2642 <capabilities> 2643 </capabilities> 2644 <parameters> 2645 <param id="thread_count"> 2646 <jint min="0"/> 2647 <description> 2648 The number of threads to trace. 2649 </description> 2650 </param> 2651 <param id="thread_list"> 2652 <inbuf incount="thread_count"><jthread/></inbuf> 2653 <description> 2654 The list of threads to trace. 2655 </description> 2656 </param> 2657 <param id="max_frame_count"> 2658 <jint min="0"/> 2659 <description> 2660 The maximum number of <datalink id="jvmtiFrameInfo"/> records to retrieve per thread. 2661 </description> 2662 </param> 2663 <param id="stack_info_ptr"> 2664 <allocbuf outcount="thread_count"> 2665 <struct>jvmtiStackInfo</struct> 2666 </allocbuf> 2667 <description> 2668 On return, this buffer is filled 2669 with stack information for each thread. 2670 The number of <datalink id="jvmtiStackInfo"/> records is determined 2671 by <paramlink id="thread_count"/>. 2672 <p/> 2673 Note that this buffer is allocated to include the <datalink id="jvmtiFrameInfo"/> 2674 buffers pointed to by <datalink id="jvmtiStackInfo.frame_buffer"/>. 2675 These buffers must not be separately deallocated. 2676 </description> 2677 </param> 2678 </parameters> 2679 <errors> 2680 <error id="JVMTI_ERROR_INVALID_THREAD"> 2681 An element in <paramlink id="thread_list"/> is not a thread object. 2682 </error> 2683 </errors> 2684 </function> 2685 2686 <elide> 2687 <function id="AsyncGetStackTrace" num="1000"> 2688 <synopsis>Get Stack Trace--Asynchronous</synopsis> 2689 <description> 2690 Get information about the entire stack of a thread (or a sub-section of it). 2691 This is the asynchronous version of <functionlink id="GetStackTrace"></functionlink> 2692 and is reentrant and safe to call 2693 from asynchronous signal handlers. 2694 The stack trace is returned only for the calling thread. 2695 <p/> 2696 The <functionlink id="GetLineNumberTable"></functionlink> 2697 function can be used to map locations to line numbers. Note that 2698 this mapping can be done lazily. 2699 </description> 2700 <origin>jvmpi</origin> 2701 <capabilities> 2702 <required id="can_get_async_stack_trace"></required> 2703 <capability id="can_show_JVM_spec_async_frames"> 2704 If <code>false</code>, 2705 <paramlink id="use_java_stack"></paramlink> 2706 must be <code>false</code>. 2707 </capability> 2708 </capabilities> 2709 <parameters> 2710 <param id="use_java_stack"> 2711 <jboolean/> 2712 <description> 2713 Return the stack showing <vmspec/> 2714 model of the stack; 2715 otherwise, show the internal representation of the stack with 2716 inlined and optimized methods missing. If the virtual machine 2717 is using the <i>Java Virtual Machine Specification</i> stack model 2718 internally, this flag is ignored. 2719 </description> 2720 </param> 2721 <param id="max_count"> 2722 <jint min="0"/> 2723 <description> 2724 The maximum number of <datalink id="jvmtiFrameInfo"/> records to retrieve. 2725 Retrieve this many unless the stack depth is less than <code>max_count</code>. 2726 </description> 2727 </param> 2728 <param id="frame_buffer"> 2729 <outbuf incount="max_count" outcount="count_ptr"> 2730 <struct>jvmtiFrameInfo</struct> 2731 <nullok>this information is not returned</nullok> 2732 </outbuf> 2733 <description> 2734 The agent passes in a buffer 2735 large enough to hold <code>max_count</code> records of 2736 <datalink id="jvmtiFrameInfo"></datalink>. This buffer must be 2737 pre-allocated by the agent. 2738 </description> 2739 </param> 2740 <param id="count_ptr"> 2741 <outptr><jint/></outptr> 2742 <description> 2743 On return, points to the number of records filled in.. 2744 </description> 2745 </param> 2746 </parameters> 2747 <errors> 2748 <error id="JVMTI_ERROR_UNATTACHED_THREAD"> 2749 The thread being used to call this function is not attached 2750 to the virtual machine. Calls must be made from attached threads. 2751 </error> 2752 </errors> 2753 </function> 2754 </elide> 2755 2756 <function id="GetFrameCount" num="16"> 2757 <synopsis>Get Frame Count</synopsis> 2758 <description> 2759 Get the number of frames currently in the specified thread's call stack. 2760 <p/> 2761 If this function is called for a thread actively executing bytecodes (for example, 2762 not the current thread and not suspended), the information returned is transient. 2763 </description> 2764 <origin>jvmdi</origin> 2765 <capabilities> 2766 </capabilities> 2767 <parameters> 2768 <param id="thread"> 2769 <jthread null="current"/> 2770 <description> 2771 The thread to query. 2772 </description> 2773 </param> 2774 <param id="count_ptr"> 2775 <outptr><jint/></outptr> 2776 <description> 2777 On return, points to the number of frames in the call stack. 2778 </description> 2779 </param> 2780 </parameters> 2781 <errors> 2782 </errors> 2783 </function> 2784 2785 <function id="PopFrame" num="80"> 2786 <synopsis>Pop Frame</synopsis> 2787 <description> 2788 Pop the current frame of <code>thread</code>'s stack. 2789 Popping a frame takes you to the previous frame. 2790 When the thread is resumed, the execution 2791 state of the thread is reset to the state 2792 immediately before the called method was invoked. 2793 That is (using <vmspec/> terminology): 2794 <ul> 2795 <li>the current frame is discarded as the previous frame becomes the current one</li> 2796 <li>the operand stack is restored--the argument values are added back 2797 and if the invoke was not <code>invokestatic</code>, 2798 <code>objectref</code> is added back as well</li> 2799 <li>the Java virtual machine PC is restored to the opcode 2800 of the invoke instruction</li> 2801 </ul> 2802 Note however, that any changes to the arguments, which 2803 occurred in the called method, remain; 2804 when execution continues, the first instruction to 2805 execute will be the invoke. 2806 <p/> 2807 Between calling <code>PopFrame</code> and resuming the 2808 thread the state of the stack is undefined. 2809 To pop frames beyond the first, 2810 these three steps must be repeated: 2811 <ul> 2812 <li>suspend the thread via an event (step, breakpoint, ...)</li> 2813 <li>call <code>PopFrame</code></li> 2814 <li>resume the thread</li> 2815 </ul> 2816 <p/> 2817 A lock acquired by calling the called method 2818 (if it is a <code>synchronized</code> method) 2819 and locks acquired by entering <code>synchronized</code> 2820 blocks within the called method are released. 2821 Note: this does not apply to native locks or 2822 <code>java.util.concurrent.locks</code> locks. 2823 <p/> 2824 Finally blocks are not executed. 2825 <p/> 2826 Changes to global state are not addressed and thus remain changed. 2827 <p/> 2828 The specified thread must be suspended or must be the current thread. 2829 <p/> 2830 Both the called method and calling method must be non-native Java programming 2831 language methods. 2832 <p/> 2833 No <jvmti/> events are generated by this function. 2834 </description> 2835 <origin>jvmdi</origin> 2836 <capabilities> 2837 <required id="can_pop_frame"></required> 2838 </capabilities> 2839 <parameters> 2840 <param id="thread"> 2841 <jthread/> 2842 <description> 2843 The thread whose current frame is to be popped. 2844 </description> 2845 </param> 2846 </parameters> 2847 <errors> 2848 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 2849 Called or calling method is a native method. 2850 The implementation is unable to pop this frame. 2851 </error> 2852 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 2853 Thread was not suspended and was not the current thread. 2854 </error> 2855 <error id="JVMTI_ERROR_NO_MORE_FRAMES"> 2856 There are less than two stack frames on the call stack. 2857 </error> 2858 </errors> 2859 </function> 2860 2861 <function id="GetFrameLocation" num="19"> 2862 <synopsis>Get Frame Location</synopsis> 2863 <description> 2864 <p/> 2865 For a Java programming language frame, return the location of the instruction 2866 currently executing. 2867 </description> 2868 <origin>jvmdiClone</origin> 2869 <capabilities> 2870 </capabilities> 2871 <parameters> 2872 <param id="thread"> 2873 <jthread null="current" frame="frame"/> 2874 <description> 2875 The thread of the frame to query. 2876 </description> 2877 </param> 2878 <param id="depth"> 2879 <jframeID thread="thread"/> 2880 <description> 2881 The depth of the frame to query. 2882 </description> 2883 </param> 2884 <param id="method_ptr"> 2885 <outptr><jmethodID/></outptr> 2886 <description> 2887 On return, points to the method for the current location. 2888 </description> 2889 </param> 2890 <param id="location_ptr"> 2891 <outptr><jlocation/></outptr> 2892 <description> 2893 On return, points to the index of the currently 2894 executing instruction. 2895 Is set to <code>-1</code> if the frame is executing 2896 a native method. 2897 </description> 2898 </param> 2899 </parameters> 2900 <errors> 2901 </errors> 2902 </function> 2903 2904 <function id="NotifyFramePop" num="20"> 2905 <synopsis>Notify Frame Pop</synopsis> 2906 <description> 2907 When the frame that is currently at <paramlink id="depth"></paramlink> 2908 is popped from the stack, generate a 2909 <eventlink id="FramePop"></eventlink> event. See the 2910 <eventlink id="FramePop"></eventlink> event for details. 2911 Only frames corresponding to non-native Java programming language 2912 methods can receive notification. 2913 <p/> 2914 The specified thread must be suspended or must be the current thread. 2915 </description> 2916 <origin>jvmdi</origin> 2917 <capabilities> 2918 <required id="can_generate_frame_pop_events"></required> 2919 </capabilities> 2920 <parameters> 2921 <param id="thread"> 2922 <jthread null="current" frame="depth"/> 2923 <description> 2924 The thread of the frame for which the frame pop event will be generated. 2925 </description> 2926 </param> 2927 <param id="depth"> 2928 <jframeID thread="thread"/> 2929 <description> 2930 The depth of the frame for which the frame pop event will be generated. 2931 </description> 2932 </param> 2933 </parameters> 2934 <errors> 2935 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 2936 The frame at <code>depth</code> is executing a 2937 native method. 2938 </error> 2939 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 2940 Thread was not suspended and was not the current thread. 2941 </error> 2942 </errors> 2943 </function> 2944 2945 </category> 2946 2947 <category id="ForceEarlyReturn" label="Force Early Return"> 2948 <intro> 2949 These functions allow an agent to force a method 2950 to return at any point during its execution. 2951 The method which will return early is referred to as the <i>called method</i>. 2952 The called method is the current method 2953 (as defined by 2954 <vmspec chapter="3.6"/>) 2955 for the specified thread at 2956 the time the function is called. 2957 <p/> 2958 The specified thread must be suspended or must be the current thread. 2959 The return occurs when execution of Java programming 2960 language code is resumed on this thread. 2961 Between calling one of these functions and resumption 2962 of thread execution, the state of the stack is undefined. 2963 <p/> 2964 No further instructions are executed in the called method. 2965 Specifically, finally blocks are not executed. 2966 Note: this can cause inconsistent states in the application. 2967 <p/> 2968 A lock acquired by calling the called method 2969 (if it is a <code>synchronized</code> method) 2970 and locks acquired by entering <code>synchronized</code> 2971 blocks within the called method are released. 2972 Note: this does not apply to native locks or 2973 <code>java.util.concurrent.locks</code> locks. 2974 <p/> 2975 Events, such as <eventlink id="MethodExit"></eventlink>, 2976 are generated as they would be in a normal return. 2977 <p/> 2978 The called method must be a non-native Java programming 2979 language method. 2980 Forcing return on a thread with only one frame on the 2981 stack causes the thread to exit when resumed. 2982 </intro> 2983 2984 <function id="ForceEarlyReturnObject" num="81" since="1.1"> 2985 <synopsis>Force Early Return - Object</synopsis> 2986 <description> 2987 This function can be used to return from a method whose 2988 result type is <code>Object</code> 2989 or a subclass of <code>Object</code>. 2990 </description> 2991 <origin>new</origin> 2992 <capabilities> 2993 <required id="can_force_early_return"></required> 2994 </capabilities> 2995 <parameters> 2996 <param id="thread"> 2997 <jthread null="current"/> 2998 <description> 2999 The thread whose current frame is to return early. 3000 </description> 3001 </param> 3002 <param id="value"> 3003 <jobject/> 3004 <description> 3005 The return value for the called frame. 3006 An object or <code>NULL</code>. 3007 </description> 3008 </param> 3009 </parameters> 3010 <errors> 3011 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 3012 Attempted to return early from a frame 3013 corresponding to a native method. 3014 Or the implementation is unable to provide 3015 this functionality on this frame. 3016 </error> 3017 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 3018 The result type of the called method is not 3019 <code>Object</code> or a subclass of <code>Object</code>. 3020 </error> 3021 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 3022 The supplied <paramlink id="value"/> is not compatible with the 3023 result type of the called method. 3024 </error> 3025 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 3026 Thread was not suspended and was not the current thread. 3027 </error> 3028 <error id="JVMTI_ERROR_NO_MORE_FRAMES"> 3029 There are no more frames on the call stack. 3030 </error> 3031 </errors> 3032 </function> 3033 3034 <function id="ForceEarlyReturnInt" num="82" since="1.1"> 3035 <synopsis>Force Early Return - Int</synopsis> 3036 <description> 3037 This function can be used to return from a method whose 3038 result type is <code>int</code>, <code>short</code>, 3039 <code>char</code>, <code>byte</code>, or 3040 <code>boolean</code>. 3041 </description> 3042 <origin>new</origin> 3043 <capabilities> 3044 <required id="can_force_early_return"></required> 3045 </capabilities> 3046 <parameters> 3047 <param id="thread"> 3048 <jthread null="current"/> 3049 <description> 3050 The thread whose current frame is to return early. 3051 </description> 3052 </param> 3053 <param id="value"> 3054 <jint/> 3055 <description> 3056 The return value for the called frame. 3057 </description> 3058 </param> 3059 </parameters> 3060 <errors> 3061 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 3062 Attempted to return early from a frame 3063 corresponding to a native method. 3064 Or the implementation is unable to provide 3065 this functionality on this frame. 3066 </error> 3067 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 3068 The result type of the called method is not 3069 <code>int</code>, <code>short</code>, 3070 <code>char</code>, <code>byte</code>, or 3071 <code>boolean</code>. 3072 </error> 3073 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 3074 Thread was not suspended and was not the current thread. 3075 </error> 3076 <error id="JVMTI_ERROR_NO_MORE_FRAMES"> 3077 There are no frames on the call stack. 3078 </error> 3079 </errors> 3080 </function> 3081 3082 <function id="ForceEarlyReturnLong" num="83" since="1.1"> 3083 <synopsis>Force Early Return - Long</synopsis> 3084 <description> 3085 This function can be used to return from a method whose 3086 result type is <code>long</code>. 3087 </description> 3088 <origin>new</origin> 3089 <capabilities> 3090 <required id="can_force_early_return"></required> 3091 </capabilities> 3092 <parameters> 3093 <param id="thread"> 3094 <jthread null="current"/> 3095 <description> 3096 The thread whose current frame is to return early. 3097 </description> 3098 </param> 3099 <param id="value"> 3100 <jlong/> 3101 <description> 3102 The return value for the called frame. 3103 </description> 3104 </param> 3105 </parameters> 3106 <errors> 3107 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 3108 Attempted to return early from a frame 3109 corresponding to a native method. 3110 Or the implementation is unable to provide 3111 this functionality on this frame. 3112 </error> 3113 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 3114 The result type of the called method is not <code>long</code>. 3115 </error> 3116 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 3117 Thread was not suspended and was not the current thread. 3118 </error> 3119 <error id="JVMTI_ERROR_NO_MORE_FRAMES"> 3120 There are no frames on the call stack. 3121 </error> 3122 </errors> 3123 </function> 3124 3125 <function id="ForceEarlyReturnFloat" num="84" since="1.1"> 3126 <synopsis>Force Early Return - Float</synopsis> 3127 <description> 3128 This function can be used to return from a method whose 3129 result type is <code>float</code>. 3130 </description> 3131 <origin>new</origin> 3132 <capabilities> 3133 <required id="can_force_early_return"></required> 3134 </capabilities> 3135 <parameters> 3136 <param id="thread"> 3137 <jthread null="current"/> 3138 <description> 3139 The thread whose current frame is to return early. 3140 </description> 3141 </param> 3142 <param id="value"> 3143 <jfloat/> 3144 <description> 3145 The return value for the called frame. 3146 </description> 3147 </param> 3148 </parameters> 3149 <errors> 3150 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 3151 Attempted to return early from a frame 3152 corresponding to a native method. 3153 Or the implementation is unable to provide 3154 this functionality on this frame. 3155 </error> 3156 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 3157 The result type of the called method is not <code>float</code>. 3158 </error> 3159 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 3160 Thread was not suspended and was not the current thread. 3161 </error> 3162 <error id="JVMTI_ERROR_NO_MORE_FRAMES"> 3163 There are no frames on the call stack. 3164 </error> 3165 </errors> 3166 </function> 3167 3168 <function id="ForceEarlyReturnDouble" num="85" since="1.1"> 3169 <synopsis>Force Early Return - Double</synopsis> 3170 <description> 3171 This function can be used to return from a method whose 3172 result type is <code>double</code>. 3173 </description> 3174 <origin>new</origin> 3175 <capabilities> 3176 <required id="can_force_early_return"></required> 3177 </capabilities> 3178 <parameters> 3179 <param id="thread"> 3180 <jthread null="current"/> 3181 <description> 3182 The thread whose current frame is to return early. 3183 </description> 3184 </param> 3185 <param id="value"> 3186 <jdouble/> 3187 <description> 3188 The return value for the called frame. 3189 </description> 3190 </param> 3191 </parameters> 3192 <errors> 3193 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 3194 Attempted to return early from a frame corresponding to a native method. 3195 Or the implementation is unable to provide this functionality on this frame. 3196 </error> 3197 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 3198 The result type of the called method is not <code>double</code>. 3199 </error> 3200 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 3201 Thread was not suspended and was not the current thread. 3202 </error> 3203 <error id="JVMTI_ERROR_NO_MORE_FRAMES"> 3204 There are no frames on the call stack. 3205 </error> 3206 </errors> 3207 </function> 3208 3209 <function id="ForceEarlyReturnVoid" num="86" since="1.1"> 3210 <synopsis>Force Early Return - Void</synopsis> 3211 <description> 3212 This function can be used to return from a method with no result type. 3213 That is, the called method must be declared <code>void</code>. 3214 </description> 3215 <origin>new</origin> 3216 <capabilities> 3217 <required id="can_force_early_return"></required> 3218 </capabilities> 3219 <parameters> 3220 <param id="thread"> 3221 <jthread null="current"/> 3222 <description> 3223 The thread whose current frame is to return early. 3224 </description> 3225 </param> 3226 </parameters> 3227 <errors> 3228 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 3229 Attempted to return early from a frame 3230 corresponding to a native method. 3231 Or the implementation is unable to provide 3232 this functionality on this frame. 3233 </error> 3234 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 3235 The called method has a result type. 3236 </error> 3237 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 3238 Thread was not suspended and was not the current thread. 3239 </error> 3240 <error id="JVMTI_ERROR_NO_MORE_FRAMES"> 3241 There are no frames on the call stack. 3242 </error> 3243 </errors> 3244 </function> 3245 3246 </category> 3247 3248 <category id="Heap" label="Heap"> 3249 <intro> 3250 These functions are used to analyze the heap. 3251 Functionality includes the ability to view the objects in the 3252 heap and to tag these objects. 3253 </intro> 3254 3255 <intro id="objectTags" label="Object Tags"> 3256 A <i>tag</i> is a value associated with an object. 3257 Tags are explicitly set by the agent using the 3258 <functionlink id="SetTag"></functionlink> function or by 3259 callback functions such as <functionlink id="jvmtiHeapIterationCallback"/>. 3260 <p/> 3261 Tags are local to the environment; that is, the tags of one 3262 environment are not visible in another. 3263 <p/> 3264 Tags are <code>jlong</code> values which can be used 3265 simply to mark an object or to store a pointer to more detailed 3266 information. Objects which have not been tagged have a 3267 tag of zero. 3268 Setting a tag to zero makes the object untagged. 3269 </intro> 3270 3271 <intro id="heapCallbacks" label="Heap Callback Functions"> 3272 Heap functions which iterate through the heap and recursively 3273 follow object references use agent supplied callback functions 3274 to deliver the information. 3275 <p/> 3276 These heap callback functions must adhere to the following restrictions -- 3277 These callbacks must not use JNI functions. 3278 These callbacks must not use <jvmti/> functions except 3279 <i>callback safe</i> functions which 3280 specifically allow such use (see the raw monitor, memory management, 3281 and environment local storage functions). 3282 <p/> 3283 An implementation may invoke a callback on an internal thread or 3284 the thread which called the iteration function. 3285 Heap callbacks are single threaded -- no more than one callback will 3286 be invoked at a time. 3287 <p/> 3288 The Heap Filter Flags can be used to prevent reporting 3289 based on the tag status of an object or its class. 3290 If no flags are set (the <code>jint</code> is zero), objects 3291 will not be filtered out. 3292 3293 <constants id="jvmtiHeapFilter" label="Heap Filter Flags" kind="bits"> 3294 <constant id="JVMTI_HEAP_FILTER_TAGGED" num="0x4"> 3295 Filter out tagged objects. Objects which are tagged are not included. 3296 </constant> 3297 <constant id="JVMTI_HEAP_FILTER_UNTAGGED" num="0x8"> 3298 Filter out untagged objects. Objects which are not tagged are not included. 3299 </constant> 3300 <constant id="JVMTI_HEAP_FILTER_CLASS_TAGGED" num="0x10"> 3301 Filter out objects with tagged classes. Objects whose class is tagged are not included. 3302 </constant> 3303 <constant id="JVMTI_HEAP_FILTER_CLASS_UNTAGGED" num="0x20"> 3304 Filter out objects with untagged classes. Objects whose class is not tagged are not included. 3305 </constant> 3306 </constants> 3307 3308 <p/> 3309 The Heap Visit Control Flags are returned by the heap callbacks 3310 and can be used to abort the iteration. For the 3311 <functionlink id="jvmtiHeapReferenceCallback">Heap 3312 Reference Callback</functionlink>, it can also be used 3313 to prune the graph of traversed references 3314 (<code>JVMTI_VISIT_OBJECTS</code> is not set). 3315 3316 <constants id="jvmtiHeapVisitControl" 3317 label="Heap Visit Control Flags" 3318 kind="bits" 3319 since="1.1"> 3320 <constant id="JVMTI_VISIT_OBJECTS" num="0x100"> 3321 If we are visiting an object and if this callback 3322 was initiated by <functionlink id="FollowReferences"/>, 3323 traverse the references of this object. 3324 Otherwise ignored. 3325 </constant> 3326 <constant id="JVMTI_VISIT_ABORT" num="0x8000"> 3327 Abort the iteration. Ignore all other bits. 3328 </constant> 3329 </constants> 3330 3331 <p/> 3332 The Heap Reference Enumeration is provided by the 3333 <functionlink id="jvmtiHeapReferenceCallback">Heap 3334 Reference Callback</functionlink> and 3335 <functionlink id="jvmtiPrimitiveFieldCallback">Primitive Field 3336 Callback</functionlink> to 3337 describe the kind of reference 3338 being reported. 3339 3340 <constants id="jvmtiHeapReferenceKind" 3341 label="Heap Reference Enumeration" 3342 kind="enum" 3343 since="1.1"> 3344 <constant id="JVMTI_HEAP_REFERENCE_CLASS" num="1"> 3345 Reference from an object to its class. 3346 </constant> 3347 <constant id="JVMTI_HEAP_REFERENCE_FIELD" num="2"> 3348 Reference from an object to the value of one of its instance fields. 3349 </constant> 3350 <constant id="JVMTI_HEAP_REFERENCE_ARRAY_ELEMENT" num="3"> 3351 Reference from an array to one of its elements. 3352 </constant> 3353 <constant id="JVMTI_HEAP_REFERENCE_CLASS_LOADER" num="4"> 3354 Reference from a class to its class loader. 3355 </constant> 3356 <constant id="JVMTI_HEAP_REFERENCE_SIGNERS" num="5"> 3357 Reference from a class to its signers array. 3358 </constant> 3359 <constant id="JVMTI_HEAP_REFERENCE_PROTECTION_DOMAIN" num="6"> 3360 Reference from a class to its protection domain. 3361 </constant> 3362 <constant id="JVMTI_HEAP_REFERENCE_INTERFACE" num="7"> 3363 Reference from a class to one of its interfaces. 3364 Note: interfaces are defined via a constant pool reference, 3365 so the referenced interfaces may also be reported with a 3366 <code>JVMTI_HEAP_REFERENCE_CONSTANT_POOL</code> reference kind. 3367 </constant> 3368 <constant id="JVMTI_HEAP_REFERENCE_STATIC_FIELD" num="8"> 3369 Reference from a class to the value of one of its static fields. 3370 </constant> 3371 <constant id="JVMTI_HEAP_REFERENCE_CONSTANT_POOL" num="9"> 3372 Reference from a class to a resolved entry in the constant pool. 3373 </constant> 3374 <constant id="JVMTI_HEAP_REFERENCE_SUPERCLASS" num="10"> 3375 Reference from a class to its superclass. 3376 A callback is not sent if the superclass is <code>java.lang.Object</code>. 3377 Note: loaded classes define superclasses via a constant pool 3378 reference, so the referenced superclass may also be reported with 3379 a <code>JVMTI_HEAP_REFERENCE_CONSTANT_POOL</code> reference kind. 3380 </constant> 3381 <constant id="JVMTI_HEAP_REFERENCE_JNI_GLOBAL" num="21"> 3382 Heap root reference: JNI global reference. 3383 </constant> 3384 <constant id="JVMTI_HEAP_REFERENCE_SYSTEM_CLASS" num="22"> 3385 Heap root reference: System class. 3386 </constant> 3387 <constant id="JVMTI_HEAP_REFERENCE_MONITOR" num="23"> 3388 Heap root reference: monitor. 3389 </constant> 3390 <constant id="JVMTI_HEAP_REFERENCE_STACK_LOCAL" num="24"> 3391 Heap root reference: local variable on the stack. 3392 </constant> 3393 <constant id="JVMTI_HEAP_REFERENCE_JNI_LOCAL" num="25"> 3394 Heap root reference: JNI local reference. 3395 </constant> 3396 <constant id="JVMTI_HEAP_REFERENCE_THREAD" num="26"> 3397 Heap root reference: Thread. 3398 </constant> 3399 <constant id="JVMTI_HEAP_REFERENCE_OTHER" num="27"> 3400 Heap root reference: other heap root reference. 3401 </constant> 3402 </constants> 3403 3404 <p/> 3405 Definitions for the single character type descriptors of 3406 primitive types. 3407 3408 <constants id="jvmtiPrimitiveType" 3409 label="Primitive Type Enumeration" 3410 kind="enum" 3411 since="1.1"> 3412 <constant id="JVMTI_PRIMITIVE_TYPE_BOOLEAN" num="90"> 3413 'Z' - Java programming language <code>boolean</code> - JNI <code>jboolean</code> 3414 </constant> 3415 <constant id="JVMTI_PRIMITIVE_TYPE_BYTE" num="66"> 3416 'B' - Java programming language <code>byte</code> - JNI <code>jbyte</code> 3417 </constant> 3418 <constant id="JVMTI_PRIMITIVE_TYPE_CHAR" num="67"> 3419 'C' - Java programming language <code>char</code> - JNI <code>jchar</code> 3420 </constant> 3421 <constant id="JVMTI_PRIMITIVE_TYPE_SHORT" num="83"> 3422 'S' - Java programming language <code>short</code> - JNI <code>jshort</code> 3423 </constant> 3424 <constant id="JVMTI_PRIMITIVE_TYPE_INT" num="73"> 3425 'I' - Java programming language <code>int</code> - JNI <code>jint</code> 3426 </constant> 3427 <constant id="JVMTI_PRIMITIVE_TYPE_LONG" num="74"> 3428 'J' - Java programming language <code>long</code> - JNI <code>jlong</code> 3429 </constant> 3430 <constant id="JVMTI_PRIMITIVE_TYPE_FLOAT" num="70"> 3431 'F' - Java programming language <code>float</code> - JNI <code>jfloat</code> 3432 </constant> 3433 <constant id="JVMTI_PRIMITIVE_TYPE_DOUBLE" num="68"> 3434 'D' - Java programming language <code>double</code> - JNI <code>jdouble</code> 3435 </constant> 3436 </constants> 3437 </intro> 3438 3439 <typedef id="jvmtiHeapReferenceInfoField" 3440 label="Reference information structure for Field references" 3441 since="1.1"> 3442 <description> 3443 Reference information returned for 3444 <datalink id="JVMTI_HEAP_REFERENCE_FIELD"/> and 3445 <datalink id="JVMTI_HEAP_REFERENCE_STATIC_FIELD"/> references. 3446 </description> 3447 <field id="index"> 3448 <jint/> 3449 <description> 3450 For <datalink id="JVMTI_HEAP_REFERENCE_FIELD"/>, the 3451 referrer object is not a class or an interface. 3452 In this case, <code>index</code> is the index of the field 3453 in the class of the referrer object. 3454 This class is referred to below as <i>C</i>. 3455 <p/> 3456 For <datalink id="JVMTI_HEAP_REFERENCE_STATIC_FIELD"/>, 3457 the referrer object is a class (referred to below as <i>C</i>) 3458 or an interface (referred to below as <i>I</i>). 3459 In this case, <code>index</code> is the index of the field in 3460 that class or interface. 3461 <p/> 3462 If the referrer object is not an interface, then the field 3463 indices are determined as follows: 3464 <ul> 3465 <li>make a list of all the fields in <i>C</i> and its 3466 superclasses, starting with all the fields in 3467 <code>java.lang.Object</code> and ending with all the 3468 fields in <i>C</i>.</li> 3469 <li>Within this list, put 3470 the fields for a given class in the order returned by 3471 <functionlink id="GetClassFields"/>.</li> 3472 <li>Assign the fields in this list indices 3473 <i>n</i>, <i>n</i>+1, ..., in order, where <i>n</i> 3474 is the count of the fields in all the interfaces 3475 implemented by <i>C</i>. 3476 Note that <i>C</i> implements all interfaces 3477 directly implemented by its superclasses; as well 3478 as all superinterfaces of these interfaces.</li> 3479 </ul> 3480 If the referrer object is an interface, then the field 3481 indices are determined as follows: 3482 <ul> 3483 <li>make a list of the fields directly declared in 3484 <i>I</i>.</li> 3485 <li>Within this list, put 3486 the fields in the order returned by 3487 <functionlink id="GetClassFields"/>.</li> 3488 <li>Assign the fields in this list indices 3489 <i>n</i>, <i>n</i>+1, ..., in order, where <i>n</i> 3490 is the count of the fields in all the superinterfaces 3491 of <i>I</i>.</li> 3492 </ul> 3493 All fields are included in this computation, regardless of 3494 field modifier (static, public, private, etc). 3495 <p/> 3496 For example, given the following classes and interfaces: 3497 <example> 3498 interface I0 { 3499 int p = 0; 3500 } 3501 3502 interface I1 extends I0 { 3503 int x = 1; 3504 } 3505 3506 interface I2 extends I0 { 3507 int y = 2; 3508 } 3509 3510 class C1 implements I1 { 3511 public static int a = 3; 3512 private int b = 4; 3513 } 3514 3515 class C2 extends C1 implements I2 { 3516 static int q = 5; 3517 final int r = 6; 3518 } 3519 </example> 3520 Assume that <functionlink id="GetClassFields"/> called on 3521 <code>C1</code> returns the fields of <code>C1</code> in the 3522 order: a, b; and that the fields of <code>C2</code> are 3523 returned in the order: q, r. 3524 An instance of class <code>C1</code> will have the 3525 following field indices: 3526 <blockquote><table> 3527 <tr class="bgLight"> 3528 <th class="centered" scope="col">Field</th> 3529 <th class="centered" scope="col">Index</th> 3530 <th scope="col">Description</th> 3531 </tr> 3532 <tr> 3533 <th class="centered" scope="row"> 3534 a 3535 </th> 3536 <td class="centered"> 3537 2 3538 </td> 3539 <td> 3540 The count of the fields in the interfaces 3541 implemented by <code>C1</code> is two (<i>n</i>=2): 3542 <code>p</code> of <code>I0</code> 3543 and <code>x</code> of <code>I1</code>. 3544 </td> 3545 </tr> 3546 <tr> 3547 <th class="centered" scope="row"> 3548 b 3549 </th> 3550 <td class="centered"> 3551 3 3552 </td> 3553 <td> 3554 the subsequent index. 3555 </td> 3556 </tr> 3557 </table></blockquote> 3558 The class <code>C1</code> will have the same field indices. 3559 <p/> 3560 An instance of class <code>C2</code> will have the 3561 following field indices: 3562 <blockquote><table> 3563 <tr class="bgLight"> 3564 <th class="centered" scope="col">Field</th> 3565 <th class="centered" scope="col">Index</th> 3566 <th scope="col">Description</th> 3567 </tr> 3568 <tr> 3569 <th class="centered" scope="row"> 3570 a 3571 </th> 3572 <td class="centered"> 3573 3 3574 </td> 3575 <td> 3576 The count of the fields in the interfaces 3577 implemented by <code>C2</code> is three (<i>n</i>=3): 3578 <code>p</code> of <code>I0</code>, 3579 <code>x</code> of <code>I1</code> and <code>y</code> of <code>I2</code> 3580 (an interface of <code>C2</code>). Note that the field <code>p</code> 3581 of <code>I0</code> is only included once. 3582 </td> 3583 </tr> 3584 <tr> 3585 <th class="centered" scope="row"> 3586 b 3587 </th> 3588 <td class="centered"> 3589 4 3590 </td> 3591 <td> 3592 the subsequent index to "a". 3593 </td> 3594 </tr> 3595 <tr> 3596 <th class="centered" scope="row"> 3597 q 3598 </th> 3599 <td class="centered"> 3600 5 3601 </td> 3602 <td> 3603 the subsequent index to "b". 3604 </td> 3605 </tr> 3606 <tr> 3607 <th class="centered" scope="row"> 3608 r 3609 </th> 3610 <td class="centered"> 3611 6 3612 </td> 3613 <td> 3614 the subsequent index to "q". 3615 </td> 3616 </tr> 3617 </table></blockquote> 3618 The class <code>C2</code> will have the same field indices. 3619 Note that a field may have a different index depending on the 3620 object that is viewing it -- for example field "a" above. 3621 Note also: not all field indices may be visible from the 3622 callbacks, but all indices are shown for illustrative purposes. 3623 <p/> 3624 The interface <code>I1</code> will have the 3625 following field indices: 3626 <blockquote><table> 3627 <tr class="bgLight"> 3628 <th class="centered" scope="col">Field</th> 3629 <th class="centered" scope="col">Index</th> 3630 <th scope="col">Description</th> 3631 </tr> 3632 <tr> 3633 <th class="centered" scope="row"> 3634 x 3635 </th> 3636 <td class="centered"> 3637 1 3638 </td> 3639 <td> 3640 The count of the fields in the superinterfaces 3641 of <code>I1</code> is one (<i>n</i>=1): 3642 <code>p</code> of <code>I0</code>. 3643 </td> 3644 </tr> 3645 </table></blockquote> 3646 </description> 3647 </field> 3648 </typedef> 3649 3650 <typedef id="jvmtiHeapReferenceInfoArray" 3651 label="Reference information structure for Array references" 3652 since="1.1"> 3653 <description> 3654 Reference information returned for 3655 <datalink id="JVMTI_HEAP_REFERENCE_ARRAY_ELEMENT"/> references. 3656 </description> 3657 <field id="index"> 3658 <jint/> 3659 <description> 3660 The array index. 3661 </description> 3662 </field> 3663 </typedef> 3664 3665 <typedef id="jvmtiHeapReferenceInfoConstantPool" 3666 label="Reference information structure for Constant Pool references" 3667 since="1.1"> 3668 <description> 3669 Reference information returned for 3670 <datalink id="JVMTI_HEAP_REFERENCE_CONSTANT_POOL"/> references. 3671 </description> 3672 <field id="index"> 3673 <jint/> 3674 <description> 3675 The index into the constant pool of the class. See the description in 3676 <vmspec chapter="4.4"/>. 3677 </description> 3678 </field> 3679 </typedef> 3680 3681 <typedef id="jvmtiHeapReferenceInfoStackLocal" 3682 label="Reference information structure for Local Variable references" 3683 since="1.1"> 3684 <description> 3685 Reference information returned for 3686 <datalink id="JVMTI_HEAP_REFERENCE_STACK_LOCAL"/> references. 3687 </description> 3688 <field id="thread_tag"> 3689 <jlong/> 3690 <description> 3691 The tag of the thread corresponding to this stack, zero if not tagged. 3692 </description> 3693 </field> 3694 <field id="thread_id"> 3695 <jlong/> 3696 <description> 3697 The unique thread ID of the thread corresponding to this stack. 3698 </description> 3699 </field> 3700 <field id="depth"> 3701 <jint/> 3702 <description> 3703 The depth of the frame. 3704 </description> 3705 </field> 3706 <field id="method"> 3707 <jmethodID/> 3708 <description> 3709 The method executing in this frame. 3710 </description> 3711 </field> 3712 <field id="location"> 3713 <jlocation/> 3714 <description> 3715 The currently executing location in this frame. 3716 </description> 3717 </field> 3718 <field id="slot"> 3719 <jint/> 3720 <description> 3721 The slot number of the local variable. 3722 </description> 3723 </field> 3724 </typedef> 3725 3726 <typedef id="jvmtiHeapReferenceInfoJniLocal" 3727 label="Reference information structure for JNI local references" 3728 since="1.1"> 3729 <description> 3730 Reference information returned for 3731 <datalink id="JVMTI_HEAP_REFERENCE_JNI_LOCAL"/> references. 3732 </description> 3733 <field id="thread_tag"> 3734 <jlong/> 3735 <description> 3736 The tag of the thread corresponding to this stack, zero if not tagged. 3737 </description> 3738 </field> 3739 <field id="thread_id"> 3740 <jlong/> 3741 <description> 3742 The unique thread ID of the thread corresponding to this stack. 3743 </description> 3744 </field> 3745 <field id="depth"> 3746 <jint/> 3747 <description> 3748 The depth of the frame. 3749 </description> 3750 </field> 3751 <field id="method"> 3752 <jmethodID/> 3753 <description> 3754 The method executing in this frame. 3755 </description> 3756 </field> 3757 </typedef> 3758 3759 <typedef id="jvmtiHeapReferenceInfoReserved" 3760 label="Reference information structure for Other references" 3761 since="1.1"> 3762 <description> 3763 Reference information returned for other references. 3764 </description> 3765 <field id="reserved1"> 3766 <jlong/> 3767 <description> 3768 reserved for future use. 3769 </description> 3770 </field> 3771 <field id="reserved2"> 3772 <jlong/> 3773 <description> 3774 reserved for future use. 3775 </description> 3776 </field> 3777 <field id="reserved3"> 3778 <jlong/> 3779 <description> 3780 reserved for future use. 3781 </description> 3782 </field> 3783 <field id="reserved4"> 3784 <jlong/> 3785 <description> 3786 reserved for future use. 3787 </description> 3788 </field> 3789 <field id="reserved5"> 3790 <jlong/> 3791 <description> 3792 reserved for future use. 3793 </description> 3794 </field> 3795 <field id="reserved6"> 3796 <jlong/> 3797 <description> 3798 reserved for future use. 3799 </description> 3800 </field> 3801 <field id="reserved7"> 3802 <jlong/> 3803 <description> 3804 reserved for future use. 3805 </description> 3806 </field> 3807 <field id="reserved8"> 3808 <jlong/> 3809 <description> 3810 reserved for future use. 3811 </description> 3812 </field> 3813 </typedef> 3814 3815 <uniontypedef id="jvmtiHeapReferenceInfo" 3816 label="Reference information structure" 3817 since="1.1"> 3818 <description> 3819 The information returned about referrers. 3820 Represented as a union of the various kinds of reference information. 3821 </description> 3822 <field id="field"> 3823 <struct>jvmtiHeapReferenceInfoField</struct> 3824 <description> 3825 The referrer information for 3826 <datalink id="JVMTI_HEAP_REFERENCE_FIELD"/> 3827 and <datalink id="JVMTI_HEAP_REFERENCE_STATIC_FIELD"/> references. 3828 </description> 3829 </field> 3830 <field id="array"> 3831 <struct>jvmtiHeapReferenceInfoArray</struct> 3832 <description> 3833 The referrer information for 3834 For <datalink id="JVMTI_HEAP_REFERENCE_ARRAY_ELEMENT"/> references. 3835 </description> 3836 </field> 3837 <field id="constant_pool"> 3838 <struct>jvmtiHeapReferenceInfoConstantPool</struct> 3839 <description> 3840 The referrer information for 3841 For <datalink id="JVMTI_HEAP_REFERENCE_CONSTANT_POOL"/> references. 3842 </description> 3843 </field> 3844 <field id="stack_local"> 3845 <struct>jvmtiHeapReferenceInfoStackLocal</struct> 3846 <description> 3847 The referrer information for 3848 For <datalink id="JVMTI_HEAP_REFERENCE_STACK_LOCAL"/> references. 3849 </description> 3850 </field> 3851 <field id="jni_local"> 3852 <struct>jvmtiHeapReferenceInfoJniLocal</struct> 3853 <description> 3854 The referrer information for 3855 For <datalink id="JVMTI_HEAP_REFERENCE_JNI_LOCAL"/> references. 3856 </description> 3857 </field> 3858 <field id="other"> 3859 <struct>jvmtiHeapReferenceInfoReserved</struct> 3860 <description> 3861 reserved for future use. 3862 </description> 3863 </field> 3864 </uniontypedef> 3865 3866 <typedef id="jvmtiHeapCallbacks" 3867 label="Heap callback function structure" 3868 since="1.1"> 3869 <field id="heap_iteration_callback"> 3870 <ptrtype> 3871 <struct>jvmtiHeapIterationCallback</struct> 3872 </ptrtype> 3873 <description> 3874 The callback to be called to describe an 3875 object in the heap. Used by the 3876 <functionlink id="IterateThroughHeap"/> function, ignored by the 3877 <functionlink id="FollowReferences"/> function. 3878 </description> 3879 </field> 3880 <field id="heap_reference_callback"> 3881 <ptrtype> 3882 <struct>jvmtiHeapReferenceCallback</struct> 3883 </ptrtype> 3884 <description> 3885 The callback to be called to describe an 3886 object reference. Used by the 3887 <functionlink id="FollowReferences"/> function, ignored by the 3888 <functionlink id="IterateThroughHeap"/> function. 3889 </description> 3890 </field> 3891 <field id="primitive_field_callback"> 3892 <ptrtype> 3893 <struct>jvmtiPrimitiveFieldCallback</struct> 3894 </ptrtype> 3895 <description> 3896 The callback to be called to describe a 3897 primitive field. 3898 </description> 3899 </field> 3900 <field id="array_primitive_value_callback"> 3901 <ptrtype> 3902 <struct>jvmtiArrayPrimitiveValueCallback</struct> 3903 </ptrtype> 3904 <description> 3905 The callback to be called to describe an 3906 array of primitive values. 3907 </description> 3908 </field> 3909 <field id="string_primitive_value_callback"> 3910 <ptrtype> 3911 <struct>jvmtiStringPrimitiveValueCallback</struct> 3912 </ptrtype> 3913 <description> 3914 The callback to be called to describe a String value. 3915 </description> 3916 </field> 3917 <field id="reserved5"> 3918 <ptrtype> 3919 <struct>jvmtiReservedCallback</struct> 3920 </ptrtype> 3921 <description> 3922 Reserved for future use.. 3923 </description> 3924 </field> 3925 <field id="reserved6"> 3926 <ptrtype> 3927 <struct>jvmtiReservedCallback</struct> 3928 </ptrtype> 3929 <description> 3930 Reserved for future use.. 3931 </description> 3932 </field> 3933 <field id="reserved7"> 3934 <ptrtype> 3935 <struct>jvmtiReservedCallback</struct> 3936 </ptrtype> 3937 <description> 3938 Reserved for future use.. 3939 </description> 3940 </field> 3941 <field id="reserved8"> 3942 <ptrtype> 3943 <struct>jvmtiReservedCallback</struct> 3944 </ptrtype> 3945 <description> 3946 Reserved for future use.. 3947 </description> 3948 </field> 3949 <field id="reserved9"> 3950 <ptrtype> 3951 <struct>jvmtiReservedCallback</struct> 3952 </ptrtype> 3953 <description> 3954 Reserved for future use.. 3955 </description> 3956 </field> 3957 <field id="reserved10"> 3958 <ptrtype> 3959 <struct>jvmtiReservedCallback</struct> 3960 </ptrtype> 3961 <description> 3962 Reserved for future use.. 3963 </description> 3964 </field> 3965 <field id="reserved11"> 3966 <ptrtype> 3967 <struct>jvmtiReservedCallback</struct> 3968 </ptrtype> 3969 <description> 3970 Reserved for future use.. 3971 </description> 3972 </field> 3973 <field id="reserved12"> 3974 <ptrtype> 3975 <struct>jvmtiReservedCallback</struct> 3976 </ptrtype> 3977 <description> 3978 Reserved for future use.. 3979 </description> 3980 </field> 3981 <field id="reserved13"> 3982 <ptrtype> 3983 <struct>jvmtiReservedCallback</struct> 3984 </ptrtype> 3985 <description> 3986 Reserved for future use.. 3987 </description> 3988 </field> 3989 <field id="reserved14"> 3990 <ptrtype> 3991 <struct>jvmtiReservedCallback</struct> 3992 </ptrtype> 3993 <description> 3994 Reserved for future use.. 3995 </description> 3996 </field> 3997 <field id="reserved15"> 3998 <ptrtype> 3999 <struct>jvmtiReservedCallback</struct> 4000 </ptrtype> 4001 <description> 4002 Reserved for future use.. 4003 </description> 4004 </field> 4005 </typedef> 4006 4007 4008 <intro> 4009 <rationale> 4010 The heap dumping functionality (below) uses a callback 4011 for each object. While it would seem that a buffered approach 4012 would provide better throughput, tests do 4013 not show this to be the case--possibly due to locality of 4014 memory reference or array access overhead. 4015 </rationale> 4016 4017 <issue> 4018 Still under investigation as to if java.lang.ref references 4019 are reported as a different type of reference. 4020 </issue> 4021 4022 <issue> 4023 Should or can an indication of the cost or relative cost of 4024 these operations be included? 4025 </issue> 4026 4027 </intro> 4028 4029 <callback id="jvmtiHeapIterationCallback" since="1.1"> 4030 <jint/> 4031 <synopsis>Heap Iteration Callback</synopsis> 4032 <description> 4033 Agent supplied callback function. 4034 Describes (but does not pass in) an object in the heap. 4035 <p/> 4036 This function should return a bit vector of the desired 4037 <datalink id="jvmtiHeapVisitControl">visit control flags</datalink>. 4038 This will determine if the entire iteration should be aborted 4039 (the <code>JVMTI_VISIT_OBJECTS</code> flag is ignored). 4040 <p/> 4041 See the <internallink id="heapCallbacks">heap callback 4042 function restrictions</internallink>. 4043 </description> 4044 <parameters> 4045 <param id="class_tag"> 4046 <jlong/> 4047 <description> 4048 The tag of the class of object (zero if the class is not tagged). 4049 If the object represents a runtime class, 4050 the <code>class_tag</code> is the tag 4051 associated with <code>java.lang.Class</code> 4052 (zero if <code>java.lang.Class</code> is not tagged). 4053 </description> 4054 </param> 4055 <param id="size"> 4056 <jlong/> 4057 <description> 4058 Size of the object (in bytes). See <functionlink id="GetObjectSize"/>. 4059 </description> 4060 </param> 4061 <param id="tag_ptr"> 4062 <outptr><jlong/></outptr> 4063 <description> 4064 The object tag value, or zero if the object is not tagged. 4065 To set the tag value to be associated with the object 4066 the agent sets the <code>jlong</code> pointed to by the parameter. 4067 </description> 4068 </param> 4069 <param id="length"> 4070 <jint/> 4071 <description> 4072 If this object is an array, the length of the array. Otherwise negative one (-1). 4073 </description> 4074 </param> 4075 <param id="user_data"> 4076 <outptr><void/></outptr> 4077 <description> 4078 The user supplied data that was passed into the iteration function. 4079 </description> 4080 </param> 4081 </parameters> 4082 </callback> 4083 4084 <callback id="jvmtiHeapReferenceCallback" since="1.1"> 4085 <jint/> 4086 <synopsis>Heap Reference Callback</synopsis> 4087 <description> 4088 Agent supplied callback function. 4089 Describes a reference from an object or the VM (the referrer) to another object 4090 (the referree) or a heap root to a referree. 4091 <p/> 4092 This function should return a bit vector of the desired 4093 <datalink id="jvmtiHeapVisitControl">visit control flags</datalink>. 4094 This will determine if the objects referenced by the referree 4095 should be visited or if the entire iteration should be aborted. 4096 <p/> 4097 See the <internallink id="heapCallbacks">heap callback 4098 function restrictions</internallink>. 4099 </description> 4100 <parameters> 4101 <param id="reference_kind"> 4102 <enum>jvmtiHeapReferenceKind</enum> 4103 <description> 4104 The kind of reference. 4105 </description> 4106 </param> 4107 <param id="reference_info"> 4108 <inptr> 4109 <struct>jvmtiHeapReferenceInfo</struct> 4110 </inptr> 4111 <description> 4112 Details about the reference. 4113 Set when the <datalink id="jvmtiHeapReferenceCallback.reference_kind">reference_kind</datalink> is 4114 <datalink id="JVMTI_HEAP_REFERENCE_FIELD"/>, 4115 <datalink id="JVMTI_HEAP_REFERENCE_STATIC_FIELD"/>, 4116 <datalink id="JVMTI_HEAP_REFERENCE_ARRAY_ELEMENT"/>, 4117 <datalink id="JVMTI_HEAP_REFERENCE_CONSTANT_POOL"/>, 4118 <datalink id="JVMTI_HEAP_REFERENCE_STACK_LOCAL"/>, 4119 or <datalink id="JVMTI_HEAP_REFERENCE_JNI_LOCAL"/>. 4120 Otherwise <code>NULL</code>. 4121 </description> 4122 </param> 4123 <param id="class_tag"> 4124 <jlong/> 4125 <description> 4126 The tag of the class of referree object (zero if the class is not tagged). 4127 If the referree object represents a runtime class, 4128 the <code>class_tag</code> is the tag 4129 associated with <code>java.lang.Class</code> 4130 (zero if <code>java.lang.Class</code> is not tagged). 4131 </description> 4132 </param> 4133 <param id="referrer_class_tag"> 4134 <jlong/> 4135 <description> 4136 The tag of the class of the referrer object (zero if the class is not tagged 4137 or the referree is a heap root). If the referrer object represents a runtime 4138 class, the <code>referrer_class_tag</code> is the tag associated with 4139 the <code>java.lang.Class</code> 4140 (zero if <code>java.lang.Class</code> is not tagged). 4141 </description> 4142 </param> 4143 <param id="size"> 4144 <jlong/> 4145 <description> 4146 Size of the referree object (in bytes). 4147 See <functionlink id="GetObjectSize"/>. 4148 </description> 4149 </param> 4150 <param id="tag_ptr"> 4151 <outptr><jlong/></outptr> 4152 <description> 4153 Points to the referree object tag value, or zero if the object is not 4154 tagged. 4155 To set the tag value to be associated with the object 4156 the agent sets the <code>jlong</code> pointed to by the parameter. 4157 </description> 4158 </param> 4159 <param id="referrer_tag_ptr"> 4160 <outptr><jlong/></outptr> 4161 <description> 4162 Points to the tag of the referrer object, or 4163 points to the zero if the referrer 4164 object is not tagged. 4165 <code>NULL</code> if the referrer in not an object (that is, 4166 this callback is reporting a heap root). 4167 To set the tag value to be associated with the referrer object 4168 the agent sets the <code>jlong</code> pointed to by the parameter. 4169 If this callback is reporting a reference from an object to itself, 4170 <code>referrer_tag_ptr == tag_ptr</code>. 4171 </description> 4172 </param> 4173 <param id="length"> 4174 <jint/> 4175 <description> 4176 If this object is an array, the length of the array. Otherwise negative one (-1). 4177 </description> 4178 </param> 4179 <param id="user_data"> 4180 <outptr><void/></outptr> 4181 <description> 4182 The user supplied data that was passed into the iteration function. 4183 </description> 4184 </param> 4185 </parameters> 4186 </callback> 4187 4188 <callback id="jvmtiPrimitiveFieldCallback" since="1.1"> 4189 <jint/> 4190 <synopsis>Primitive Field Callback</synopsis> 4191 <description> 4192 Agent supplied callback function which 4193 describes a primitive field of an object (<i>the object</i>). 4194 A primitive field is a field whose type is a primitive type. 4195 This callback will describe a static field if the object is a class, 4196 and otherwise will describe an instance field. 4197 <p/> 4198 This function should return a bit vector of the desired 4199 <datalink id="jvmtiHeapVisitControl">visit control flags</datalink>. 4200 This will determine if the entire iteration should be aborted 4201 (the <code>JVMTI_VISIT_OBJECTS</code> flag is ignored). 4202 <p/> 4203 See the <internallink id="heapCallbacks">heap callback 4204 function restrictions</internallink>. 4205 </description> 4206 <parameters> 4207 <param id="kind"> 4208 <enum>jvmtiHeapReferenceKind</enum> 4209 <description> 4210 The kind of field -- instance or static (<datalink id="JVMTI_HEAP_REFERENCE_FIELD"/> or 4211 <datalink id="JVMTI_HEAP_REFERENCE_STATIC_FIELD"/>). 4212 </description> 4213 </param> 4214 <param id="info"> 4215 <inptr> 4216 <struct>jvmtiHeapReferenceInfo</struct> 4217 </inptr> 4218 <description> 4219 Which field (the field index). 4220 </description> 4221 </param> 4222 <param id="object_class_tag"> 4223 <jlong/> 4224 <description> 4225 The tag of the class of the object (zero if the class is not tagged). 4226 If the object represents a runtime class, the 4227 <code>object_class_tag</code> is the tag 4228 associated with <code>java.lang.Class</code> 4229 (zero if <code>java.lang.Class</code> is not tagged). 4230 </description> 4231 </param> 4232 <param id="object_tag_ptr"> 4233 <outptr><jlong/></outptr> 4234 <description> 4235 Points to the tag of the object, or zero if the object is not 4236 tagged. 4237 To set the tag value to be associated with the object 4238 the agent sets the <code>jlong</code> pointed to by the parameter. 4239 </description> 4240 </param> 4241 <param id="value"> 4242 <jvalue/> 4243 <description> 4244 The value of the field. 4245 </description> 4246 </param> 4247 <param id="value_type"> 4248 <enum>jvmtiPrimitiveType</enum> 4249 <description> 4250 The type of the field. 4251 </description> 4252 </param> 4253 <param id="user_data"> 4254 <outptr><void/></outptr> 4255 <description> 4256 The user supplied data that was passed into the iteration function. 4257 </description> 4258 </param> 4259 </parameters> 4260 </callback> 4261 4262 <callback id="jvmtiArrayPrimitiveValueCallback" since="1.1"> 4263 <jint/> 4264 <synopsis>Array Primitive Value Callback</synopsis> 4265 <description> 4266 Agent supplied callback function. 4267 Describes the values in an array of a primitive type. 4268 <p/> 4269 This function should return a bit vector of the desired 4270 <datalink id="jvmtiHeapVisitControl">visit control flags</datalink>. 4271 This will determine if the entire iteration should be aborted 4272 (the <code>JVMTI_VISIT_OBJECTS</code> flag is ignored). 4273 <p/> 4274 See the <internallink id="heapCallbacks">heap callback 4275 function restrictions</internallink>. 4276 </description> 4277 <parameters> 4278 <param id="class_tag"> 4279 <jlong/> 4280 <description> 4281 The tag of the class of the array object (zero if the class is not tagged). 4282 </description> 4283 </param> 4284 <param id="size"> 4285 <jlong/> 4286 <description> 4287 Size of the array (in bytes). 4288 See <functionlink id="GetObjectSize"/>. 4289 </description> 4290 </param> 4291 <param id="tag_ptr"> 4292 <outptr><jlong/></outptr> 4293 <description> 4294 Points to the tag of the array object, or zero if the object is not 4295 tagged. 4296 To set the tag value to be associated with the object 4297 the agent sets the <code>jlong</code> pointed to by the parameter. 4298 </description> 4299 </param> 4300 <param id="element_count"> 4301 <jint/> 4302 <description> 4303 The length of the primitive array. 4304 </description> 4305 </param> 4306 <param id="element_type"> 4307 <enum>jvmtiPrimitiveType</enum> 4308 <description> 4309 The type of the elements of the array. 4310 </description> 4311 </param> 4312 <param id="elements"> 4313 <vmbuf><void/></vmbuf> 4314 <description> 4315 The elements of the array in a packed array of <code>element_count</code> 4316 items of <code>element_type</code> size each. 4317 </description> 4318 </param> 4319 <param id="user_data"> 4320 <outptr><void/></outptr> 4321 <description> 4322 The user supplied data that was passed into the iteration function. 4323 </description> 4324 </param> 4325 </parameters> 4326 </callback> 4327 4328 <callback id="jvmtiStringPrimitiveValueCallback" since="1.1"> 4329 <jint/> 4330 <synopsis>String Primitive Value Callback</synopsis> 4331 <description> 4332 Agent supplied callback function. 4333 Describes the value of a java.lang.String. 4334 <p/> 4335 This function should return a bit vector of the desired 4336 <datalink id="jvmtiHeapVisitControl">visit control flags</datalink>. 4337 This will determine if the entire iteration should be aborted 4338 (the <code>JVMTI_VISIT_OBJECTS</code> flag is ignored). 4339 <p/> 4340 See the <internallink id="heapCallbacks">heap callback 4341 function restrictions</internallink>. 4342 </description> 4343 <parameters> 4344 <param id="class_tag"> 4345 <jlong/> 4346 <description> 4347 The tag of the class of the String class (zero if the class is not tagged). 4348 <issue>Is this needed?</issue> 4349 </description> 4350 </param> 4351 <param id="size"> 4352 <jlong/> 4353 <description> 4354 Size of the string (in bytes). 4355 See <functionlink id="GetObjectSize"/>. 4356 </description> 4357 </param> 4358 <param id="tag_ptr"> 4359 <outptr><jlong/></outptr> 4360 <description> 4361 Points to the tag of the String object, or zero if the object is not 4362 tagged. 4363 To set the tag value to be associated with the object 4364 the agent sets the <code>jlong</code> pointed to by the parameter. 4365 </description> 4366 </param> 4367 <param id="value"> 4368 <vmbuf><jchar/></vmbuf> 4369 <description> 4370 The value of the String, encoded as a Unicode string. 4371 </description> 4372 </param> 4373 <param id="value_length"> 4374 <jint/> 4375 <description> 4376 The length of the string. 4377 The length is equal to the number of 16-bit Unicode 4378 characters in the string. 4379 </description> 4380 </param> 4381 <param id="user_data"> 4382 <outptr><void/></outptr> 4383 <description> 4384 The user supplied data that was passed into the iteration function. 4385 </description> 4386 </param> 4387 </parameters> 4388 </callback> 4389 4390 4391 <callback id="jvmtiReservedCallback" since="1.1"> 4392 <jint/> 4393 <synopsis>reserved for future use Callback</synopsis> 4394 <description> 4395 Placeholder -- reserved for future use. 4396 </description> 4397 <parameters> 4398 </parameters> 4399 </callback> 4400 4401 <function id="FollowReferences" num="115" since="1.1"> 4402 <synopsis>Follow References</synopsis> 4403 <description> 4404 This function initiates a traversal over the objects that are 4405 directly and indirectly reachable from the specified object or, 4406 if <code>initial_object</code> is not specified, all objects 4407 reachable from the heap roots. 4408 The heap root are the set of system classes, 4409 JNI globals, references from thread stacks, and other objects used as roots 4410 for the purposes of garbage collection. 4411 <p/> 4412 This function operates by traversing the reference graph. 4413 Let <i>A</i>, <i>B</i>, ... represent objects. 4414 When a reference from <i>A</i> to <i>B</i> is traversed, 4415 when a reference from a heap root to <i>B</i> is traversed, 4416 or when <i>B</i> is specified as the <paramlink id="initial_object"/>, 4417 then <i>B</i> is said to be <i>visited</i>. 4418 A reference from <i>A</i> to <i>B</i> is not traversed until <i>A</i> 4419 is visited. 4420 References are reported in the same order that the references are traversed. 4421 Object references are reported by invoking the agent supplied 4422 callback function <functionlink id="jvmtiHeapReferenceCallback"/>. 4423 In a reference from <i>A</i> to <i>B</i>, <i>A</i> is known 4424 as the <i>referrer</i> and <i>B</i> as the <i>referree</i>. 4425 The callback is invoked exactly once for each reference from a referrer; 4426 this is true even if there are reference cycles or multiple paths to 4427 the referrer. 4428 There may be more than one reference between a referrer and a referree, 4429 each reference is reported. 4430 These references may be distinguished by examining the 4431 <datalink 4432 id="jvmtiHeapReferenceCallback.reference_kind"><code>reference_kind</code></datalink> 4433 and 4434 <datalink 4435 id="jvmtiHeapReferenceCallback.reference_info"><code>reference_info</code></datalink> 4436 parameters of the <functionlink id="jvmtiHeapReferenceCallback"/> callback. 4437 <p/> 4438 This function reports a Java programming language view of object references, 4439 not a virtual machine implementation view. The following object references 4440 are reported when they are non-null: 4441 <ul> 4442 <li>Instance objects report references to each non-primitive instance fields 4443 (including inherited fields).</li> 4444 <li>Instance objects report a reference to the object type (class).</li> 4445 <li>Classes report a reference to the superclass and directly 4446 implemented/extended interfaces.</li> 4447 <li>Classes report a reference to the class loader, protection domain, 4448 signers, and resolved entries in the constant pool.</li> 4449 <li>Classes report a reference to each directly declared non-primitive 4450 static field.</li> 4451 <li>Arrays report a reference to the array type (class) and each 4452 array element.</li> 4453 <li>Primitive arrays report a reference to the array type.</li> 4454 </ul> 4455 <p/> 4456 This function can also be used to examine primitive (non-object) values. 4457 The primitive value of an array or String 4458 is reported after the object has been visited; 4459 it is reported by invoking the agent supplied callback function 4460 <functionlink id="jvmtiArrayPrimitiveValueCallback"/> or 4461 <functionlink id="jvmtiStringPrimitiveValueCallback"/>. 4462 A primitive field 4463 is reported after the object with that field is visited; 4464 it is reported by invoking the agent supplied callback function 4465 <functionlink id="jvmtiPrimitiveFieldCallback"/>. 4466 <p/> 4467 Whether a callback is provided or is <code>NULL</code> only determines 4468 whether the callback will be invoked, it does not influence 4469 which objects are visited nor does it influence whether other callbacks 4470 will be invoked. 4471 However, the 4472 <datalink id="jvmtiHeapVisitControl">visit control flags</datalink> 4473 returned by <functionlink id="jvmtiHeapReferenceCallback"/> 4474 do determine if the objects referenced by the 4475 current object as visited. 4476 The <datalink id="jvmtiHeapFilter">heap filter flags</datalink> 4477 and <paramlink id="klass"/> provided as parameters to this function 4478 do not control which objects are visited but they do control which 4479 objects and primitive values are reported by the callbacks. 4480 For example, if the only callback that was set is 4481 <fieldlink id="array_primitive_value_callback" struct="jvmtiHeapCallbacks"/> and <code>klass</code> 4482 is set to the array of bytes class, then only arrays of byte will be 4483 reported. 4484 The table below summarizes this: 4485 <p/> 4486 <table> 4487 <tr class="bgLight"> 4488 <th/> 4489 <th class="centered" scope="col">Controls objects visited</th> 4490 <th class="centered" scope="col">Controls objects reported</th> 4491 <th class="centered" scope="col">Controls primitives reported</th> 4492 </tr> 4493 <tr> 4494 <th scope="row"> 4495 the 4496 <datalink id="jvmtiHeapVisitControl">Heap Visit Control Flags</datalink> 4497 returned by <functionlink id="jvmtiHeapReferenceCallback"/> 4498 </th> 4499 <td class="centered"> 4500 <b>Yes</b> 4501 </td> 4502 <td class="centered"> 4503 <b>Yes</b>, since visits are controlled 4504 </td> 4505 <td class="centered"> 4506 <b>Yes</b>, since visits are controlled 4507 </td> 4508 </tr> 4509 <tr> 4510 <th scope="row"> 4511 <fieldlink id="array_primitive_value_callback" struct="jvmtiHeapCallbacks"/> 4512 in <paramlink id="callbacks"/> set 4513 </th> 4514 <td class="centered"> 4515 No 4516 </td> 4517 <td class="centered"> 4518 <b>Yes</b> 4519 </td> 4520 <td class="centered"> 4521 No 4522 </td> 4523 </tr> 4524 <tr> 4525 <th scope="row"> 4526 <paramlink id="heap_filter"/> 4527 </th> 4528 <td class="centered"> 4529 No 4530 </td> 4531 <td class="centered"> 4532 <b>Yes</b> 4533 </td> 4534 <td class="centered"> 4535 <b>Yes</b> 4536 </td> 4537 </tr> 4538 <tr> 4539 <th scope="row"> 4540 <paramlink id="klass"/> 4541 </th> 4542 <td class="centered"> 4543 No 4544 </td> 4545 <td class="centered"> 4546 <b>Yes</b> 4547 </td> 4548 <td class="centered"> 4549 <b>Yes</b> 4550 </td> 4551 </tr> 4552 </table> 4553 <p/> 4554 During the execution of this function the state of the heap 4555 does not change: no objects are allocated, no objects are 4556 garbage collected, and the state of objects (including 4557 held values) does not change. 4558 As a result, threads executing Java 4559 programming language code, threads attempting to resume the 4560 execution of Java programming language code, and threads 4561 attempting to execute JNI functions are typically stalled. 4562 </description> 4563 <origin>new</origin> 4564 <capabilities> 4565 <required id="can_tag_objects"></required> 4566 </capabilities> 4567 <parameters> 4568 <param id="heap_filter"> 4569 <jint/> 4570 <description> 4571 This bit vector of 4572 <datalink id="jvmtiHeapFilter">heap filter flags</datalink>. 4573 restricts the objects for which the callback function is called. 4574 This applies to both the object and primitive callbacks. 4575 </description> 4576 </param> 4577 <param id="klass"> 4578 <ptrtype> 4579 <jclass/> 4580 <nullok>callbacks are not limited to instances of a particular 4581 class</nullok> 4582 </ptrtype> 4583 <description> 4584 Callbacks are only reported when the object is an instance of 4585 this class. 4586 Objects which are instances of a subclass of <code>klass</code> 4587 are not reported. 4588 If <code>klass</code> is an interface, no objects are reported. 4589 This applies to both the object and primitive callbacks. 4590 </description> 4591 </param> 4592 <param id="initial_object"> 4593 <ptrtype> 4594 <jobject/> 4595 <nullok>references are followed from the heap roots</nullok> 4596 </ptrtype> 4597 <description> 4598 The object to follow 4599 </description> 4600 </param> 4601 <param id="callbacks"> 4602 <inptr> 4603 <struct>jvmtiHeapCallbacks</struct> 4604 </inptr> 4605 <description> 4606 Structure defining the set of callback functions. 4607 </description> 4608 </param> 4609 <param id="user_data"> 4610 <inbuf> 4611 <void/> 4612 <nullok><code>NULL</code> is passed as the user supplied data</nullok> 4613 </inbuf> 4614 <description> 4615 User supplied data to be passed to the callback. 4616 </description> 4617 </param> 4618 </parameters> 4619 <errors> 4620 <error id="JVMTI_ERROR_INVALID_CLASS"> 4621 <paramlink id="klass"/> is not a valid class. 4622 </error> 4623 <error id="JVMTI_ERROR_INVALID_OBJECT"> 4624 <paramlink id="initial_object"/> is not a valid object. 4625 </error> 4626 </errors> 4627 </function> 4628 4629 4630 <function id="IterateThroughHeap" num="116" since="1.1"> 4631 <synopsis>Iterate Through Heap</synopsis> 4632 <description> 4633 Initiate an iteration over all objects in the heap. 4634 This includes both reachable and 4635 unreachable objects. Objects are visited in no particular order. 4636 <p/> 4637 Heap objects are reported by invoking the agent supplied 4638 callback function <functionlink id="jvmtiHeapIterationCallback"/>. 4639 References between objects are not reported. 4640 If only reachable objects are desired, or if object reference information 4641 is needed, use <functionlink id="FollowReferences"/>. 4642 <p/> 4643 This function can also be used to examine primitive (non-object) values. 4644 The primitive value of an array or String 4645 is reported after the object has been visited; 4646 it is reported by invoking the agent supplied callback function 4647 <functionlink id="jvmtiArrayPrimitiveValueCallback"/> or 4648 <functionlink id="jvmtiStringPrimitiveValueCallback"/>. 4649 A primitive field 4650 is reported after the object with that field is visited; 4651 it is reported by invoking the agent supplied 4652 callback function 4653 <functionlink id="jvmtiPrimitiveFieldCallback"/>. 4654 <p/> 4655 Unless the iteration is aborted by the 4656 <datalink id="jvmtiHeapVisitControl">Heap Visit Control Flags</datalink> 4657 returned by a callback, all objects in the heap are visited. 4658 Whether a callback is provided or is <code>NULL</code> only determines 4659 whether the callback will be invoked, it does not influence 4660 which objects are visited nor does it influence whether other callbacks 4661 will be invoked. 4662 The <datalink id="jvmtiHeapFilter">heap filter flags</datalink> 4663 and <paramlink id="klass"/> provided as parameters to this function 4664 do not control which objects are visited but they do control which 4665 objects and primitive values are reported by the callbacks. 4666 For example, if the only callback that was set is 4667 <fieldlink id="array_primitive_value_callback" struct="jvmtiHeapCallbacks"/> and <code>klass</code> 4668 is set to the array of bytes class, then only arrays of byte will be 4669 reported. The table below summarizes this (contrast this with 4670 <functionlink id="FollowReferences"/>): 4671 <p/> 4672 <table> 4673 <tr class="bgLight"> 4674 <th/> 4675 <th class="centered" scope="col">Controls objects visited</th> 4676 <th class="centered" scope="col">Controls objects reported</th> 4677 <th class="centered" scope="col">Controls primitives reported</th> 4678 </tr> 4679 <tr> 4680 <th scope="row"> 4681 the 4682 <datalink id="jvmtiHeapVisitControl">Heap Visit Control Flags</datalink> 4683 returned by <functionlink id="jvmtiHeapIterationCallback"/> 4684 </th> 4685 <td class="centered"> 4686 No<br/>(unless they abort the iteration) 4687 </td> 4688 <td class="centered"> 4689 No<br/>(unless they abort the iteration) 4690 </td> 4691 <td class="centered"> 4692 No<br/>(unless they abort the iteration) 4693 </td> 4694 </tr> 4695 <tr> 4696 <th scope="row"> 4697 <fieldlink id="array_primitive_value_callback" struct="jvmtiHeapCallbacks"/> 4698 in <paramlink id="callbacks"/> set 4699 </th> 4700 <td class="centered"> 4701 No 4702 </td> 4703 <td class="centered"> 4704 <b>Yes</b> 4705 </td> 4706 <td class="centered"> 4707 No 4708 </td> 4709 </tr> 4710 <tr> 4711 <th scope="row"> 4712 <paramlink id="heap_filter"/> 4713 </th> 4714 <td class="centered"> 4715 No 4716 </td> 4717 <td class="centered"> 4718 <b>Yes</b> 4719 </td> 4720 <td class="centered"> 4721 <b>Yes</b> 4722 </td> 4723 </tr> 4724 <tr> 4725 <th scope="row"> 4726 <paramlink id="klass"/> 4727 </th> 4728 <td class="centered"> 4729 No 4730 </td> 4731 <td class="centered"> 4732 <b>Yes</b> 4733 </td> 4734 <td class="centered"> 4735 <b>Yes</b> 4736 </td> 4737 </tr> 4738 </table> 4739 <p/> 4740 During the execution of this function the state of the heap 4741 does not change: no objects are allocated, no objects are 4742 garbage collected, and the state of objects (including 4743 held values) does not change. 4744 As a result, threads executing Java 4745 programming language code, threads attempting to resume the 4746 execution of Java programming language code, and threads 4747 attempting to execute JNI functions are typically stalled. 4748 </description> 4749 <origin>new</origin> 4750 <capabilities> 4751 <required id="can_tag_objects"></required> 4752 </capabilities> 4753 <parameters> 4754 <param id="heap_filter"> 4755 <jint/> 4756 <description> 4757 This bit vector of 4758 <datalink id="jvmtiHeapFilter">heap filter flags</datalink>. 4759 restricts the objects for which the callback function is called. 4760 This applies to both the object and primitive callbacks. 4761 </description> 4762 </param> 4763 <param id="klass"> 4764 <ptrtype> 4765 <jclass/> 4766 <nullok>callbacks are not limited to instances of a particular class</nullok> 4767 </ptrtype> 4768 <description> 4769 Callbacks are only reported when the object is an instance of 4770 this class. 4771 Objects which are instances of a subclass of <code>klass</code> 4772 are not reported. 4773 If <code>klass</code> is an interface, no objects are reported. 4774 This applies to both the object and primitive callbacks. 4775 </description> 4776 </param> 4777 <param id="callbacks"> 4778 <inptr> 4779 <struct>jvmtiHeapCallbacks</struct> 4780 </inptr> 4781 <description> 4782 Structure defining the set callback functions. 4783 </description> 4784 </param> 4785 <param id="user_data"> 4786 <inbuf> 4787 <void/> 4788 <nullok><code>NULL</code> is passed as the user supplied data</nullok> 4789 </inbuf> 4790 <description> 4791 User supplied data to be passed to the callback. 4792 </description> 4793 </param> 4794 </parameters> 4795 <errors> 4796 <error id="JVMTI_ERROR_INVALID_CLASS"> 4797 <paramlink id="klass"/> is not a valid class. 4798 </error> 4799 </errors> 4800 </function> 4801 4802 <function id="GetTag" phase="start" num="106"> 4803 <synopsis>Get Tag</synopsis> 4804 <description> 4805 Retrieve the tag associated with an object. 4806 The tag is a long value typically used to store a 4807 unique identifier or pointer to object information. 4808 The tag is set with 4809 <functionlink id="SetTag"></functionlink>. 4810 Objects for which no tags have been set return a 4811 tag value of zero. 4812 </description> 4813 <origin>new</origin> 4814 <capabilities> 4815 <required id="can_tag_objects"></required> 4816 </capabilities> 4817 <parameters> 4818 <param id="object"> 4819 <jobject/> 4820 <description> 4821 The object whose tag is to be retrieved. 4822 </description> 4823 </param> 4824 <param id="tag_ptr"> 4825 <outptr><jlong/></outptr> 4826 <description> 4827 On return, the referenced long is set to the value 4828 of the tag. 4829 </description> 4830 </param> 4831 </parameters> 4832 <errors> 4833 </errors> 4834 </function> 4835 4836 <function id="SetTag" phase="start" num="107"> 4837 <synopsis>Set Tag</synopsis> 4838 <description> 4839 Set the tag associated with an object. 4840 The tag is a long value typically used to store a 4841 unique identifier or pointer to object information. 4842 The tag is visible with 4843 <functionlink id="GetTag"></functionlink>. 4844 </description> 4845 <origin>new</origin> 4846 <capabilities> 4847 <required id="can_tag_objects"></required> 4848 </capabilities> 4849 <parameters> 4850 <param id="object"> 4851 <jobject/> 4852 <description> 4853 The object whose tag is to be set. 4854 </description> 4855 </param> 4856 <param id="tag"> 4857 <jlong/> 4858 <description> 4859 The new value of the tag. 4860 </description> 4861 </param> 4862 </parameters> 4863 <errors> 4864 </errors> 4865 </function> 4866 4867 <function id="GetObjectsWithTags" num="114"> 4868 <synopsis>Get Objects With Tags</synopsis> 4869 <description> 4870 Return objects in the heap with the specified tags. 4871 The format is parallel arrays of objects and tags. 4872 </description> 4873 <origin>new</origin> 4874 <capabilities> 4875 <required id="can_tag_objects"></required> 4876 </capabilities> 4877 <parameters> 4878 <param id="tag_count"> 4879 <jint min="0"/> 4880 <description> 4881 Number of tags to scan for. 4882 </description> 4883 </param> 4884 <param id="tags"> 4885 <inbuf incount="tag_count"> 4886 <jlong/> 4887 </inbuf> 4888 <description> 4889 Scan for objects with these tags. 4890 Zero is not permitted in this array. 4891 </description> 4892 </param> 4893 <param id="count_ptr"> 4894 <outptr> 4895 <jint/> 4896 </outptr> 4897 <description> 4898 Return the number of objects with any of the tags 4899 in <paramlink id="tags"/>. 4900 </description> 4901 </param> 4902 <param id="object_result_ptr"> 4903 <allocbuf outcount="count_ptr"> 4904 <jobject/> 4905 <nullok>this information is not returned</nullok> 4906 </allocbuf> 4907 <description> 4908 Returns the array of objects with any of the tags 4909 in <paramlink id="tags"/>. 4910 </description> 4911 </param> 4912 <param id="tag_result_ptr"> 4913 <allocbuf outcount="count_ptr"> 4914 <jlong/> 4915 <nullok>this information is not returned</nullok> 4916 </allocbuf> 4917 <description> 4918 For each object in <paramlink id="object_result_ptr"/>, 4919 return the tag at the corresponding index. 4920 </description> 4921 </param> 4922 </parameters> 4923 <errors> 4924 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 4925 Zero is present in <paramlink id="tags"></paramlink>. 4926 </error> 4927 </errors> 4928 </function> 4929 4930 <function id="ForceGarbageCollection" num="108"> 4931 <synopsis>Force Garbage Collection</synopsis> 4932 <description> 4933 Force the VM to perform a garbage collection. 4934 The garbage collection is as complete as possible. 4935 This function does not cause finalizers to be run. 4936 This function does not return until the garbage collection 4937 is finished. 4938 <p/> 4939 Although garbage collection is as complete 4940 as possible there is no guarantee that all 4941 <eventlink id="ObjectFree"/> 4942 events will have been 4943 sent by the time that this function 4944 returns. In particular, an object may be 4945 prevented from being freed because it 4946 is awaiting finalization. 4947 </description> 4948 <origin>new</origin> 4949 <capabilities> 4950 </capabilities> 4951 <parameters> 4952 </parameters> 4953 <errors> 4954 </errors> 4955 </function> 4956 4957 4958 </category> 4959 4960 <category id="Heap_1_0" label="Heap (1.0)"> 4961 <intro> 4962 <b> 4963 These functions and data types were introduced in the original 4964 <jvmti/> version 1.0 and have been superseded by more 4965 </b> 4966 <internallink id="Heap"><b>powerful and flexible versions</b></internallink> 4967 <b> 4968 which: 4969 </b> 4970 <ul> 4971 <li> 4972 <b> 4973 Allow access to primitive values (the value of Strings, arrays, 4974 and primitive fields) 4975 </b> 4976 </li> 4977 <li> 4978 <b> 4979 Allow the tag of the referrer to be set, thus enabling more 4980 efficient localized reference graph building 4981 </b> 4982 </li> 4983 <li> 4984 <b> 4985 Provide more extensive filtering abilities 4986 </b> 4987 </li> 4988 <li> 4989 <b> 4990 Are extensible, allowing their abilities to grow in future versions of <jvmti/> 4991 </b> 4992 </li> 4993 </ul> 4994 <p/> 4995 <b>Please use the </b> 4996 <internallink id="Heap"><b>current Heap functions</b></internallink>. 4997 <p/> 4998 <constants id="jvmtiHeapObjectFilter" label="Heap Object Filter Enumeration" kind="enum"> 4999 <constant id="JVMTI_HEAP_OBJECT_TAGGED" num="1"> 5000 Tagged objects only. 5001 </constant> 5002 <constant id="JVMTI_HEAP_OBJECT_UNTAGGED" num="2"> 5003 Untagged objects only. 5004 </constant> 5005 <constant id="JVMTI_HEAP_OBJECT_EITHER" num="3"> 5006 Either tagged or untagged objects. 5007 </constant> 5008 </constants> 5009 5010 <constants id="jvmtiHeapRootKind" label="Heap Root Kind Enumeration" kind="enum"> 5011 <constant id="JVMTI_HEAP_ROOT_JNI_GLOBAL" num="1"> 5012 JNI global reference. 5013 </constant> 5014 <constant id="JVMTI_HEAP_ROOT_SYSTEM_CLASS" num="2"> 5015 System class. 5016 </constant> 5017 <constant id="JVMTI_HEAP_ROOT_MONITOR" num="3"> 5018 Monitor. 5019 </constant> 5020 <constant id="JVMTI_HEAP_ROOT_STACK_LOCAL" num="4"> 5021 Stack local. 5022 </constant> 5023 <constant id="JVMTI_HEAP_ROOT_JNI_LOCAL" num="5"> 5024 JNI local reference. 5025 </constant> 5026 <constant id="JVMTI_HEAP_ROOT_THREAD" num="6"> 5027 Thread. 5028 </constant> 5029 <constant id="JVMTI_HEAP_ROOT_OTHER" num="7"> 5030 Other. 5031 </constant> 5032 </constants> 5033 5034 <constants id="jvmtiObjectReferenceKind" label="Object Reference Enumeration" kind="enum"> 5035 <constant id="JVMTI_REFERENCE_CLASS" num="1"> 5036 Reference from an object to its class. 5037 </constant> 5038 <constant id="JVMTI_REFERENCE_FIELD" num="2"> 5039 Reference from an object to the value of one of its instance fields. 5040 For references of this kind the <code>referrer_index</code> 5041 parameter to the <internallink id="jvmtiObjectReferenceCallback"> 5042 jvmtiObjectReferenceCallback</internallink> is the index of the 5043 the instance field. The index is based on the order of all the 5044 object's fields. This includes all fields of the directly declared 5045 static and instance fields in the class, and includes all fields (both 5046 public and private) fields declared in superclasses and superinterfaces. 5047 The index is thus calculated by summing the index of the field in the directly 5048 declared class (see <functionlink id="GetClassFields"/>), with the total 5049 number of fields (both public and private) declared in all superclasses 5050 and superinterfaces. The index starts at zero. 5051 </constant> 5052 <constant id="JVMTI_REFERENCE_ARRAY_ELEMENT" num="3"> 5053 Reference from an array to one of its elements. 5054 For references of this kind the <code>referrer_index</code> 5055 parameter to the <internallink id="jvmtiObjectReferenceCallback"> 5056 jvmtiObjectReferenceCallback</internallink> is the array index. 5057 </constant> 5058 <constant id="JVMTI_REFERENCE_CLASS_LOADER" num="4"> 5059 Reference from a class to its class loader. 5060 </constant> 5061 <constant id="JVMTI_REFERENCE_SIGNERS" num="5"> 5062 Reference from a class to its signers array. 5063 </constant> 5064 <constant id="JVMTI_REFERENCE_PROTECTION_DOMAIN" num="6"> 5065 Reference from a class to its protection domain. 5066 </constant> 5067 <constant id="JVMTI_REFERENCE_INTERFACE" num="7"> 5068 Reference from a class to one of its interfaces. 5069 </constant> 5070 <constant id="JVMTI_REFERENCE_STATIC_FIELD" num="8"> 5071 Reference from a class to the value of one of its static fields. 5072 For references of this kind the <code>referrer_index</code> 5073 parameter to the <internallink id="jvmtiObjectReferenceCallback"> 5074 jvmtiObjectReferenceCallback</internallink> is the index of the 5075 the static field. The index is based on the order of all the 5076 object's fields. This includes all fields of the directly declared 5077 static and instance fields in the class, and includes all fields (both 5078 public and private) fields declared in superclasses and superinterfaces. 5079 The index is thus calculated by summing the index of the field in the directly 5080 declared class (see <functionlink id="GetClassFields"/>), with the total 5081 number of fields (both public and private) declared in all superclasses 5082 and superinterfaces. The index starts at zero. 5083 Note: this definition differs from that in the <jvmti/> 1.0 Specification. 5084 <rationale>No known implementations used the 1.0 definition.</rationale> 5085 </constant> 5086 <constant id="JVMTI_REFERENCE_CONSTANT_POOL" num="9"> 5087 Reference from a class to a resolved entry in the constant pool. 5088 For references of this kind the <code>referrer_index</code> 5089 parameter to the <internallink id="jvmtiObjectReferenceCallback"> 5090 jvmtiObjectReferenceCallback</internallink> is the index into 5091 constant pool table of the class, starting at 1. See 5092 <vmspec chapter="4.4"/>. 5093 </constant> 5094 </constants> 5095 5096 <constants id="jvmtiIterationControl" label="Iteration Control Enumeration" kind="enum"> 5097 <constant id="JVMTI_ITERATION_CONTINUE" num="1"> 5098 Continue the iteration. 5099 If this is a reference iteration, follow the references of this object. 5100 </constant> 5101 <constant id="JVMTI_ITERATION_IGNORE" num="2"> 5102 Continue the iteration. 5103 If this is a reference iteration, ignore the references of this object. 5104 </constant> 5105 <constant id="JVMTI_ITERATION_ABORT" num="0"> 5106 Abort the iteration. 5107 </constant> 5108 </constants> 5109 </intro> 5110 5111 <callback id="jvmtiHeapObjectCallback"> 5112 <enum>jvmtiIterationControl</enum> 5113 <synopsis>Heap Object Callback</synopsis> 5114 <description> 5115 Agent supplied callback function. 5116 Describes (but does not pass in) an object in the heap. 5117 <p/> 5118 Return value should be <code>JVMTI_ITERATION_CONTINUE</code> to continue iteration, 5119 or <code>JVMTI_ITERATION_ABORT</code> to stop iteration. 5120 <p/> 5121 See the <internallink id="heapCallbacks">heap callback 5122 function restrictions</internallink>. 5123 </description> 5124 <parameters> 5125 <param id="class_tag"> 5126 <jlong/> 5127 <description> 5128 The tag of the class of object (zero if the class is not tagged). 5129 If the object represents a runtime class, 5130 the <code>class_tag</code> is the tag 5131 associated with <code>java.lang.Class</code> 5132 (zero if <code>java.lang.Class</code> is not tagged). 5133 </description> 5134 </param> 5135 <param id="size"> 5136 <jlong/> 5137 <description> 5138 Size of the object (in bytes). See <functionlink id="GetObjectSize"/>. 5139 </description> 5140 </param> 5141 <param id="tag_ptr"> 5142 <outptr><jlong/></outptr> 5143 <description> 5144 The object tag value, or zero if the object is not tagged. 5145 To set the tag value to be associated with the object 5146 the agent sets the <code>jlong</code> pointed to by the parameter. 5147 </description> 5148 </param> 5149 <param id="user_data"> 5150 <outptr><void/></outptr> 5151 <description> 5152 The user supplied data that was passed into the iteration function. 5153 </description> 5154 </param> 5155 </parameters> 5156 </callback> 5157 5158 <callback id="jvmtiHeapRootCallback"> 5159 <enum>jvmtiIterationControl</enum> 5160 <synopsis>Heap Root Object Callback</synopsis> 5161 <description> 5162 Agent supplied callback function. 5163 Describes (but does not pass in) an object that is a root for the purposes 5164 of garbage collection. 5165 <p/> 5166 Return value should be <code>JVMTI_ITERATION_CONTINUE</code> to continue iteration, 5167 <code>JVMTI_ITERATION_IGNORE</code> to continue iteration without pursuing 5168 references from referree object or <code>JVMTI_ITERATION_ABORT</code> to stop iteration. 5169 <p/> 5170 See the <internallink id="heapCallbacks">heap callback 5171 function restrictions</internallink>. 5172 </description> 5173 <parameters> 5174 <param id="root_kind"> 5175 <enum>jvmtiHeapRootKind</enum> 5176 <description> 5177 The kind of heap root. 5178 </description> 5179 </param> 5180 <param id="class_tag"> 5181 <jlong/> 5182 <description> 5183 The tag of the class of object (zero if the class is not tagged). 5184 If the object represents a runtime class, the <code>class_tag</code> is the tag 5185 associated with <code>java.lang.Class</code> 5186 (zero if <code>java.lang.Class</code> is not tagged). 5187 </description> 5188 </param> 5189 <param id="size"> 5190 <jlong/> 5191 <description> 5192 Size of the object (in bytes). See <functionlink id="GetObjectSize"/>. 5193 </description> 5194 </param> 5195 <param id="tag_ptr"> 5196 <outptr><jlong/></outptr> 5197 <description> 5198 The object tag value, or zero if the object is not tagged. 5199 To set the tag value to be associated with the object 5200 the agent sets the <code>jlong</code> pointed to by the parameter. 5201 </description> 5202 </param> 5203 <param id="user_data"> 5204 <outptr><void/></outptr> 5205 <description> 5206 The user supplied data that was passed into the iteration function. 5207 </description> 5208 </param> 5209 </parameters> 5210 </callback> 5211 5212 <callback id="jvmtiStackReferenceCallback"> 5213 <enum>jvmtiIterationControl</enum> 5214 <synopsis>Stack Reference Object Callback</synopsis> 5215 <description> 5216 Agent supplied callback function. 5217 Describes (but does not pass in) an object on the stack that is a root for 5218 the purposes of garbage collection. 5219 <p/> 5220 Return value should be <code>JVMTI_ITERATION_CONTINUE</code> to continue iteration, 5221 <code>JVMTI_ITERATION_IGNORE</code> to continue iteration without pursuing 5222 references from referree object or <code>JVMTI_ITERATION_ABORT</code> to stop iteration. 5223 <p/> 5224 See the <internallink id="heapCallbacks">heap callback 5225 function restrictions</internallink>. 5226 </description> 5227 <parameters> 5228 <param id="root_kind"> 5229 <enum>jvmtiHeapRootKind</enum> 5230 <description> 5231 The kind of root (either <code>JVMTI_HEAP_ROOT_STACK_LOCAL</code> or 5232 <code>JVMTI_HEAP_ROOT_JNI_LOCAL</code>). 5233 </description> 5234 </param> 5235 <param id="class_tag"> 5236 <jlong/> 5237 <description> 5238 The tag of the class of object (zero if the class is not tagged). 5239 If the object represents a runtime class, the <code>class_tag</code> is the tag 5240 associated with <code>java.lang.Class</code> 5241 (zero if <code>java.lang.Class</code> is not tagged). 5242 </description> 5243 </param> 5244 <param id="size"> 5245 <jlong/> 5246 <description> 5247 Size of the object (in bytes). See <functionlink id="GetObjectSize"/>. 5248 </description> 5249 </param> 5250 <param id="tag_ptr"> 5251 <outptr><jlong/></outptr> 5252 <description> 5253 The object tag value, or zero if the object is not tagged. 5254 To set the tag value to be associated with the object 5255 the agent sets the <code>jlong</code> pointed to by the parameter. 5256 </description> 5257 </param> 5258 <param id="thread_tag"> 5259 <jlong/> 5260 <description> 5261 The tag of the thread corresponding to this stack, zero if not tagged. 5262 </description> 5263 </param> 5264 <param id="depth"> 5265 <jint/> 5266 <description> 5267 The depth of the frame. 5268 </description> 5269 </param> 5270 <param id="method"> 5271 <jmethodID/> 5272 <description> 5273 The method executing in this frame. 5274 </description> 5275 </param> 5276 <param id="slot"> 5277 <jint/> 5278 <description> 5279 The slot number. 5280 </description> 5281 </param> 5282 <param id="user_data"> 5283 <outptr><void/></outptr> 5284 <description> 5285 The user supplied data that was passed into the iteration function. 5286 </description> 5287 </param> 5288 </parameters> 5289 </callback> 5290 5291 <callback id="jvmtiObjectReferenceCallback"> 5292 <enum>jvmtiIterationControl</enum> 5293 <synopsis>Object Reference Callback</synopsis> 5294 <description> 5295 Agent supplied callback function. 5296 Describes a reference from an object (the referrer) to another object 5297 (the referree). 5298 <p/> 5299 Return value should be <code>JVMTI_ITERATION_CONTINUE</code> to continue iteration, 5300 <code>JVMTI_ITERATION_IGNORE</code> to continue iteration without pursuing 5301 references from referree object or <code>JVMTI_ITERATION_ABORT</code> to stop iteration. 5302 <p/> 5303 See the <internallink id="heapCallbacks">heap callback 5304 function restrictions</internallink>. 5305 </description> 5306 <parameters> 5307 <param id="reference_kind"> 5308 <enum>jvmtiObjectReferenceKind</enum> 5309 <description> 5310 The type of reference. 5311 </description> 5312 </param> 5313 <param id="class_tag"> 5314 <jlong/> 5315 <description> 5316 The tag of the class of referree object (zero if the class is not tagged). 5317 If the referree object represents a runtime class, 5318 the <code>class_tag</code> is the tag 5319 associated with <code>java.lang.Class</code> 5320 (zero if <code>java.lang.Class</code> is not tagged). 5321 </description> 5322 </param> 5323 <param id="size"> 5324 <jlong/> 5325 <description> 5326 Size of the referree object (in bytes). 5327 See <functionlink id="GetObjectSize"/>. 5328 </description> 5329 </param> 5330 <param id="tag_ptr"> 5331 <outptr><jlong/></outptr> 5332 <description> 5333 The referree object tag value, or zero if the object is not 5334 tagged. 5335 To set the tag value to be associated with the object 5336 the agent sets the <code>jlong</code> pointed to by the parameter. 5337 </description> 5338 </param> 5339 <param id="referrer_tag"> 5340 <jlong/> 5341 <description> 5342 The tag of the referrer object, or zero if the referrer 5343 object is not tagged. 5344 </description> 5345 </param> 5346 <param id="referrer_index"> 5347 <jint/> 5348 <description> 5349 For references of type <code>JVMTI_REFERENCE_FIELD</code> or 5350 <code>JVMTI_REFERENCE_STATIC_FIELD</code> the index 5351 of the field in the referrer object. The index is based on the 5352 order of all the object's fields - see <internallink 5353 id="JVMTI_REFERENCE_FIELD">JVMTI_REFERENCE_FIELD</internallink> 5354 or <internallink 5355 id="JVMTI_REFERENCE_STATIC_FIELD">JVMTI_REFERENCE_STATIC_FIELD 5356 </internallink> for further description. 5357 <p/> 5358 For references of type <code>JVMTI_REFERENCE_ARRAY_ELEMENT</code> 5359 the array index - see <internallink id="JVMTI_REFERENCE_ARRAY_ELEMENT"> 5360 JVMTI_REFERENCE_ARRAY_ELEMENT</internallink> for further description. 5361 <p/> 5362 For references of type <code>JVMTI_REFERENCE_CONSTANT_POOL</code> 5363 the index into the constant pool of the class - see 5364 <internallink id="JVMTI_REFERENCE_CONSTANT_POOL"> 5365 JVMTI_REFERENCE_CONSTANT_POOL</internallink> for further 5366 description. 5367 <p/> 5368 For references of other kinds the <code>referrer_index</code> is 5369 <code>-1</code>. 5370 </description> 5371 </param> 5372 <param id="user_data"> 5373 <outptr><void/></outptr> 5374 <description> 5375 The user supplied data that was passed into the iteration function. 5376 </description> 5377 </param> 5378 </parameters> 5379 </callback> 5380 5381 <function id="IterateOverObjectsReachableFromObject" num="109"> 5382 <synopsis>Iterate Over Objects Reachable From Object</synopsis> 5383 <description> 5384 This function iterates over all objects that are directly 5385 and indirectly reachable from the specified object. 5386 For each object <i>A</i> (known 5387 as the referrer) with a reference to object <i>B</i> the specified 5388 callback function is called to describe the object reference. 5389 The callback is called exactly once for each reference from a referrer; 5390 this is true even if there are reference cycles or multiple paths to 5391 the referrer. 5392 There may be more than one reference between a referrer and a referree, 5393 These may be distinguished by the 5394 <datalink id="jvmtiObjectReferenceCallback.reference_kind"></datalink> and 5395 <datalink id="jvmtiObjectReferenceCallback.referrer_index"></datalink>. 5396 The callback for an object will always occur after the callback for 5397 its referrer. 5398 <p/> 5399 See <functionlink id="FollowReferences"/> for the object 5400 references which are reported. 5401 <p/> 5402 During the execution of this function the state of the heap 5403 does not change: no objects are allocated, no objects are 5404 garbage collected, and the state of objects (including 5405 held values) does not change. 5406 As a result, threads executing Java 5407 programming language code, threads attempting to resume the 5408 execution of Java programming language code, and threads 5409 attempting to execute JNI functions are typically stalled. 5410 </description> 5411 <origin>new</origin> 5412 <capabilities> 5413 <required id="can_tag_objects"></required> 5414 </capabilities> 5415 <parameters> 5416 <param id="object"> 5417 <jobject/> 5418 <description> 5419 The object 5420 </description> 5421 </param> 5422 <param id="object_reference_callback"> 5423 <ptrtype> 5424 <struct>jvmtiObjectReferenceCallback</struct> 5425 </ptrtype> 5426 <description> 5427 The callback to be called to describe each 5428 object reference. 5429 </description> 5430 </param> 5431 <param id="user_data"> 5432 <inbuf> 5433 <void/> 5434 <nullok><code>NULL</code> is passed as the user supplied data</nullok> 5435 </inbuf> 5436 <description> 5437 User supplied data to be passed to the callback. 5438 </description> 5439 </param> 5440 </parameters> 5441 <errors> 5442 </errors> 5443 </function> 5444 5445 <function id="IterateOverReachableObjects" num="110"> 5446 <synopsis>Iterate Over Reachable Objects</synopsis> 5447 <description> 5448 This function iterates over the root objects and all objects that 5449 are directly and indirectly reachable from the root objects. 5450 The root objects comprise the set of system classes, 5451 JNI globals, references from thread stacks, and other objects used as roots 5452 for the purposes of garbage collection. 5453 <p/> 5454 For each root the <paramlink id="heap_root_callback"></paramlink> 5455 or <paramlink id="stack_ref_callback"></paramlink> callback is called. 5456 An object can be a root object for more than one reason and in that case 5457 the appropriate callback is called for each reason. 5458 <p/> 5459 For each object reference the <paramlink id="object_ref_callback"></paramlink> 5460 callback function is called to describe the object reference. 5461 The callback is called exactly once for each reference from a referrer; 5462 this is true even if there are reference cycles or multiple paths to 5463 the referrer. 5464 There may be more than one reference between a referrer and a referree, 5465 These may be distinguished by the 5466 <datalink id="jvmtiObjectReferenceCallback.reference_kind"></datalink> and 5467 <datalink id="jvmtiObjectReferenceCallback.referrer_index"></datalink>. 5468 The callback for an object will always occur after the callback for 5469 its referrer. 5470 <p/> 5471 See <functionlink id="FollowReferences"/> for the object 5472 references which are reported. 5473 <p/> 5474 Roots are always reported to the profiler before any object references 5475 are reported. In other words, the <paramlink id="object_ref_callback"></paramlink> 5476 callback will not be called until the appropriate callback has been called 5477 for all roots. If the <paramlink id="object_ref_callback"></paramlink> callback is 5478 specified as <code>NULL</code> then this function returns after 5479 reporting the root objects to the profiler. 5480 <p/> 5481 During the execution of this function the state of the heap 5482 does not change: no objects are allocated, no objects are 5483 garbage collected, and the state of objects (including 5484 held values) does not change. 5485 As a result, threads executing Java 5486 programming language code, threads attempting to resume the 5487 execution of Java programming language code, and threads 5488 attempting to execute JNI functions are typically stalled. 5489 </description> 5490 <origin>new</origin> 5491 <capabilities> 5492 <required id="can_tag_objects"></required> 5493 </capabilities> 5494 <parameters> 5495 <param id="heap_root_callback"> 5496 <ptrtype> 5497 <struct>jvmtiHeapRootCallback</struct> 5498 <nullok>do not report heap roots</nullok> 5499 </ptrtype> 5500 <description> 5501 The callback function to be called for each heap root of type 5502 <code>JVMTI_HEAP_ROOT_JNI_GLOBAL</code>, 5503 <code>JVMTI_HEAP_ROOT_SYSTEM_CLASS</code>, 5504 <code>JVMTI_HEAP_ROOT_MONITOR</code>, 5505 <code>JVMTI_HEAP_ROOT_THREAD</code>, or 5506 <code>JVMTI_HEAP_ROOT_OTHER</code>. 5507 </description> 5508 </param> 5509 <param id="stack_ref_callback"> 5510 <ptrtype> 5511 <struct>jvmtiStackReferenceCallback</struct> 5512 <nullok>do not report stack references</nullok> 5513 </ptrtype> 5514 <description> 5515 The callback function to be called for each heap root of 5516 <code>JVMTI_HEAP_ROOT_STACK_LOCAL</code> or 5517 <code>JVMTI_HEAP_ROOT_JNI_LOCAL</code>. 5518 </description> 5519 </param> 5520 <param id="object_ref_callback"> 5521 <ptrtype> 5522 <struct>jvmtiObjectReferenceCallback</struct> 5523 <nullok>do not follow references from the root objects</nullok> 5524 </ptrtype> 5525 <description> 5526 The callback function to be called for each object reference. 5527 </description> 5528 </param> 5529 <param id="user_data"> 5530 <inbuf> 5531 <void/> 5532 <nullok><code>NULL</code> is passed as the user supplied data</nullok> 5533 </inbuf> 5534 <description> 5535 User supplied data to be passed to the callback. 5536 </description> 5537 </param> 5538 </parameters> 5539 <errors> 5540 </errors> 5541 </function> 5542 5543 <function id="IterateOverHeap" num="111"> 5544 <synopsis>Iterate Over Heap</synopsis> 5545 <description> 5546 Iterate over all objects in the heap. This includes both reachable and 5547 unreachable objects. 5548 <p/> 5549 The <paramlink id="object_filter"></paramlink> parameter indicates the 5550 objects for which the callback function is called. If this parameter 5551 is <code>JVMTI_HEAP_OBJECT_TAGGED</code> then the callback will only be 5552 called for every object that is tagged. If the parameter is 5553 <code>JVMTI_HEAP_OBJECT_UNTAGGED</code> then the callback will only be 5554 for objects that are not tagged. If the parameter 5555 is <code>JVMTI_HEAP_OBJECT_EITHER</code> then the callback will be 5556 called for every object in the heap, irrespective of whether it is 5557 tagged or not. 5558 <p/> 5559 During the execution of this function the state of the heap 5560 does not change: no objects are allocated, no objects are 5561 garbage collected, and the state of objects (including 5562 held values) does not change. 5563 As a result, threads executing Java 5564 programming language code, threads attempting to resume the 5565 execution of Java programming language code, and threads 5566 attempting to execute JNI functions are typically stalled. 5567 </description> 5568 <origin>new</origin> 5569 <capabilities> 5570 <required id="can_tag_objects"></required> 5571 </capabilities> 5572 <parameters> 5573 <param id="object_filter"> 5574 <enum>jvmtiHeapObjectFilter</enum> 5575 <description> 5576 Indicates the objects for which the callback function is called. 5577 </description> 5578 </param> 5579 <param id="heap_object_callback"> 5580 <ptrtype> 5581 <struct>jvmtiHeapObjectCallback</struct> 5582 </ptrtype> 5583 <description> 5584 The iterator function to be called for each 5585 object matching the <paramlink id="object_filter"/>. 5586 </description> 5587 </param> 5588 <param id="user_data"> 5589 <inbuf> 5590 <void/> 5591 <nullok><code>NULL</code> is passed as the user supplied data</nullok> 5592 </inbuf> 5593 <description> 5594 User supplied data to be passed to the callback. 5595 </description> 5596 </param> 5597 </parameters> 5598 <errors> 5599 </errors> 5600 </function> 5601 5602 <function id="IterateOverInstancesOfClass" num="112"> 5603 <synopsis>Iterate Over Instances Of Class</synopsis> 5604 <description> 5605 Iterate over all objects in the heap that are instances of the specified class. 5606 This includes direct instances of the specified class and 5607 instances of all subclasses of the specified class. 5608 This includes both reachable and unreachable objects. 5609 <p/> 5610 The <paramlink id="object_filter"></paramlink> parameter indicates the 5611 objects for which the callback function is called. If this parameter 5612 is <code>JVMTI_HEAP_OBJECT_TAGGED</code> then the callback will only be 5613 called for every object that is tagged. If the parameter is 5614 <code>JVMTI_HEAP_OBJECT_UNTAGGED</code> then the callback will only be 5615 called for objects that are not tagged. If the parameter 5616 is <code>JVMTI_HEAP_OBJECT_EITHER</code> then the callback will be 5617 called for every object in the heap, irrespective of whether it is 5618 tagged or not. 5619 <p/> 5620 During the execution of this function the state of the heap 5621 does not change: no objects are allocated, no objects are 5622 garbage collected, and the state of objects (including 5623 held values) does not change. 5624 As a result, threads executing Java 5625 programming language code, threads attempting to resume the 5626 execution of Java programming language code, and threads 5627 attempting to execute JNI functions are typically stalled. 5628 </description> 5629 <origin>new</origin> 5630 <capabilities> 5631 <required id="can_tag_objects"></required> 5632 </capabilities> 5633 <parameters> 5634 <param id="klass"> 5635 <jclass/> 5636 <description> 5637 Iterate over objects of this class only. 5638 </description> 5639 </param> 5640 <param id="object_filter"> 5641 <enum>jvmtiHeapObjectFilter</enum> 5642 <description> 5643 Indicates the objects for which the callback function is called. 5644 </description> 5645 </param> 5646 <param id="heap_object_callback"> 5647 <ptrtype> 5648 <struct>jvmtiHeapObjectCallback</struct> 5649 </ptrtype> 5650 <description> 5651 The iterator function to be called for each 5652 <paramlink id="klass"/> instance matching 5653 the <paramlink id="object_filter"/>. 5654 </description> 5655 </param> 5656 <param id="user_data"> 5657 <inbuf> 5658 <void/> 5659 <nullok><code>NULL</code> is passed as the user supplied data</nullok> 5660 </inbuf> 5661 <description> 5662 User supplied data to be passed to the callback. 5663 </description> 5664 </param> 5665 </parameters> 5666 <errors> 5667 </errors> 5668 </function> 5669 5670 </category> 5671 5672 <category id="local" label="Local Variable"> 5673 5674 <intro> 5675 These functions are used to retrieve or set the value of a local variable. 5676 The variable is identified by the depth of the frame containing its 5677 value and the variable's slot number within that frame. 5678 The mapping of variables to 5679 slot numbers can be obtained with the function 5680 <functionlink id="GetLocalVariableTable"></functionlink>. 5681 </intro> 5682 5683 <function id="GetLocalObject" num="21"> 5684 <synopsis>Get Local Variable - Object</synopsis> 5685 <description> 5686 This function can be used to retrieve the value of a local 5687 variable whose type is <code>Object</code> or a subclass of <code>Object</code>. 5688 </description> 5689 <origin>jvmdi</origin> 5690 <capabilities> 5691 <required id="can_access_local_variables"></required> 5692 </capabilities> 5693 <parameters> 5694 <param id="thread"> 5695 <jthread null="current" frame="frame"/> 5696 <description> 5697 The thread of the frame containing the variable's value. 5698 </description> 5699 </param> 5700 <param id="depth"> 5701 <jframeID thread="thread"/> 5702 <description> 5703 The depth of the frame containing the variable's value. 5704 </description> 5705 </param> 5706 <param id="slot"> 5707 <jint/> 5708 <description> 5709 The variable's slot number. 5710 </description> 5711 </param> 5712 <param id="value_ptr"> 5713 <outptr><jobject/></outptr> 5714 <description> 5715 On return, points to the variable's value. 5716 </description> 5717 </param> 5718 </parameters> 5719 <errors> 5720 <error id="JVMTI_ERROR_INVALID_SLOT"> 5721 Invalid <code>slot</code>. 5722 </error> 5723 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 5724 The variable type is not 5725 <code>Object</code> or a subclass of <code>Object</code>. 5726 </error> 5727 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 5728 Not a visible frame 5729 </error> 5730 </errors> 5731 </function> 5732 5733 <function id="GetLocalInstance" num="155" since="1.2"> 5734 <synopsis>Get Local Instance</synopsis> 5735 <description> 5736 This function can be used to retrieve the value of the local object 5737 variable at slot 0 (the "<code>this</code>" object) from non-static 5738 frames. This function can retrieve the "<code>this</code>" object from 5739 native method frames, whereas <code>GetLocalObject()</code> would 5740 return <code>JVMTI_ERROR_OPAQUE_FRAME</code> in those cases. 5741 </description> 5742 <origin>new</origin> 5743 <capabilities> 5744 <required id="can_access_local_variables"></required> 5745 </capabilities> 5746 <parameters> 5747 <param id="thread"> 5748 <jthread null="current" frame="frame"/> 5749 <description> 5750 The thread of the frame containing the variable's value. 5751 </description> 5752 </param> 5753 <param id="depth"> 5754 <jframeID thread="thread"/> 5755 <description> 5756 The depth of the frame containing the variable's value. 5757 </description> 5758 </param> 5759 <param id="value_ptr"> 5760 <outptr><jobject/></outptr> 5761 <description> 5762 On return, points to the variable's value. 5763 </description> 5764 </param> 5765 </parameters> 5766 <errors> 5767 <error id="JVMTI_ERROR_INVALID_SLOT"> 5768 If the specified frame is a static method frame. 5769 </error> 5770 </errors> 5771 </function> 5772 <function id="GetLocalInt" num="22"> 5773 <synopsis>Get Local Variable - Int</synopsis> 5774 <description> 5775 This function can be used to retrieve the value of a local 5776 variable whose type is <code>int</code>, 5777 <code>short</code>, <code>char</code>, <code>byte</code>, or 5778 <code>boolean</code>. 5779 </description> 5780 <origin>jvmdi</origin> 5781 <capabilities> 5782 <required id="can_access_local_variables"></required> 5783 </capabilities> 5784 <parameters> 5785 <param id="thread"> 5786 <jthread null="current" frame="frame"/> 5787 <description> 5788 The thread of the frame containing the variable's value. 5789 </description> 5790 </param> 5791 <param id="depth"> 5792 <jframeID thread="thread"/> 5793 <description> 5794 The depth of the frame containing the variable's value. 5795 </description> 5796 </param> 5797 <param id="slot"> 5798 <jint/> 5799 <description> 5800 The variable's slot number. 5801 </description> 5802 </param> 5803 <param id="value_ptr"> 5804 <outptr><jint/></outptr> 5805 <description> 5806 On return, points to the variable's value. 5807 </description> 5808 </param> 5809 </parameters> 5810 <errors> 5811 <error id="JVMTI_ERROR_INVALID_SLOT"> 5812 Invalid <code>slot</code>. 5813 </error> 5814 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 5815 The variable type is not 5816 <code>int</code>, <code>short</code>, 5817 <code>char</code>, <code>byte</code>, or 5818 <code>boolean</code>. 5819 </error> 5820 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 5821 Not a visible frame 5822 </error> 5823 </errors> 5824 </function> 5825 5826 <function id="GetLocalLong" num="23"> 5827 <synopsis>Get Local Variable - Long</synopsis> 5828 <description> 5829 This function can be used to retrieve the value of a local 5830 variable whose type is <code>long</code>. 5831 </description> 5832 <origin>jvmdi</origin> 5833 <capabilities> 5834 <required id="can_access_local_variables"></required> 5835 </capabilities> 5836 <parameters> 5837 <param id="thread"> 5838 <jthread null="current" frame="frame"/> 5839 <description> 5840 The thread of the frame containing the variable's value. 5841 </description> 5842 </param> 5843 <param id="depth"> 5844 <jframeID thread="thread"/> 5845 <description> 5846 The depth of the frame containing the variable's value. 5847 </description> 5848 </param> 5849 <param id="slot"> 5850 <jint/> 5851 <description> 5852 The variable's slot number. 5853 </description> 5854 </param> 5855 <param id="value_ptr"> 5856 <outptr><jlong/></outptr> 5857 <description> 5858 On return, points to the variable's value. 5859 </description> 5860 </param> 5861 </parameters> 5862 <errors> 5863 <error id="JVMTI_ERROR_INVALID_SLOT"> 5864 Invalid <code>slot</code>. 5865 </error> 5866 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 5867 The variable type is not <code>long</code>. 5868 </error> 5869 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 5870 Not a visible frame 5871 </error> 5872 </errors> 5873 </function> 5874 5875 <function id="GetLocalFloat" num="24"> 5876 <synopsis>Get Local Variable - Float</synopsis> 5877 <description> 5878 This function can be used to retrieve the value of a local 5879 variable whose type is <code>float</code>. 5880 </description> 5881 <origin>jvmdi</origin> 5882 <capabilities> 5883 <required id="can_access_local_variables"></required> 5884 </capabilities> 5885 <parameters> 5886 <param id="thread"> 5887 <jthread null="current" frame="frame"/> 5888 <description> 5889 The thread of the frame containing the variable's value. 5890 </description> 5891 </param> 5892 <param id="depth"> 5893 <jframeID thread="thread"/> 5894 <description> 5895 The depth of the frame containing the variable's value. 5896 </description> 5897 </param> 5898 <param id="slot"> 5899 <jint/> 5900 <description> 5901 The variable's slot number. 5902 </description> 5903 </param> 5904 <param id="value_ptr"> 5905 <outptr><jfloat/></outptr> 5906 <description> 5907 On return, points to the variable's value. 5908 </description> 5909 </param> 5910 </parameters> 5911 <errors> 5912 <error id="JVMTI_ERROR_INVALID_SLOT"> 5913 Invalid <code>slot</code>. 5914 </error> 5915 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 5916 The variable type is not <code>float</code>. 5917 </error> 5918 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 5919 Not a visible frame 5920 </error> 5921 </errors> 5922 </function> 5923 5924 <function id="GetLocalDouble" num="25"> 5925 <synopsis>Get Local Variable - Double</synopsis> 5926 <description> 5927 This function can be used to retrieve the value of a local 5928 variable whose type is <code>long</code>. 5929 </description> 5930 <origin>jvmdi</origin> 5931 <capabilities> 5932 <required id="can_access_local_variables"></required> 5933 </capabilities> 5934 <parameters> 5935 <param id="thread"> 5936 <jthread null="current" frame="frame"/> 5937 <description> 5938 The thread of the frame containing the variable's value. 5939 </description> 5940 </param> 5941 <param id="depth"> 5942 <jframeID thread="thread"/> 5943 <description> 5944 The depth of the frame containing the variable's value. 5945 </description> 5946 </param> 5947 <param id="slot"> 5948 <jint/> 5949 <description> 5950 The variable's slot number. 5951 </description> 5952 </param> 5953 <param id="value_ptr"> 5954 <outptr><jdouble/></outptr> 5955 <description> 5956 On return, points to the variable's value. 5957 </description> 5958 </param> 5959 </parameters> 5960 <errors> 5961 <error id="JVMTI_ERROR_INVALID_SLOT"> 5962 Invalid <code>slot</code>. 5963 </error> 5964 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 5965 The variable type is not <code>double</code>. 5966 </error> 5967 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 5968 Not a visible frame 5969 </error> 5970 </errors> 5971 </function> 5972 5973 <function id="SetLocalObject" num="26"> 5974 <synopsis>Set Local Variable - Object</synopsis> 5975 <description> 5976 This function can be used to set the value of a local 5977 variable whose type is <code>Object</code> or a subclass of <code>Object</code>. 5978 </description> 5979 <origin>jvmdi</origin> 5980 <capabilities> 5981 <required id="can_access_local_variables"></required> 5982 </capabilities> 5983 <parameters> 5984 <param id="thread"> 5985 <jthread null="current" frame="frame"/> 5986 <description> 5987 The thread of the frame containing the variable's value. 5988 </description> 5989 </param> 5990 <param id="depth"> 5991 <jframeID thread="thread"/> 5992 <description> 5993 The depth of the frame containing the variable's value. 5994 </description> 5995 </param> 5996 <param id="slot"> 5997 <jint/> 5998 <description> 5999 The variable's slot number. 6000 </description> 6001 </param> 6002 <param id="value"> 6003 <jobject/> 6004 <description> 6005 The new value for the variable. 6006 </description> 6007 </param> 6008 </parameters> 6009 <errors> 6010 <error id="JVMTI_ERROR_INVALID_SLOT"> 6011 Invalid <code>slot</code>. 6012 </error> 6013 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 6014 The variable type is not 6015 <code>Object</code> or a subclass of <code>Object</code>. 6016 </error> 6017 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 6018 The supplied <paramlink id="value"/> is not compatible 6019 with the variable type. 6020 </error> 6021 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 6022 Not a visible frame 6023 </error> 6024 </errors> 6025 </function> 6026 6027 <function id="SetLocalInt" num="27"> 6028 <synopsis>Set Local Variable - Int</synopsis> 6029 <description> 6030 This function can be used to set the value of a local 6031 variable whose type is <code>int</code>, 6032 <code>short</code>, <code>char</code>, <code>byte</code>, or 6033 <code>boolean</code>. 6034 </description> 6035 <origin>jvmdi</origin> 6036 <capabilities> 6037 <required id="can_access_local_variables"></required> 6038 </capabilities> 6039 <parameters> 6040 <param id="thread"> 6041 <jthread null="current" frame="frame"/> 6042 <description> 6043 The thread of the frame containing the variable's value. 6044 </description> 6045 </param> 6046 <param id="depth"> 6047 <jframeID thread="thread"/> 6048 <description> 6049 The depth of the frame containing the variable's value. 6050 </description> 6051 </param> 6052 <param id="slot"> 6053 <jint/> 6054 <description> 6055 The variable's slot number. 6056 </description> 6057 </param> 6058 <param id="value"> 6059 <jint/> 6060 <description> 6061 The new value for the variable. 6062 </description> 6063 </param> 6064 </parameters> 6065 <errors> 6066 <error id="JVMTI_ERROR_INVALID_SLOT"> 6067 Invalid <code>slot</code>. 6068 </error> 6069 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 6070 The variable type is not 6071 <code>int</code>, <code>short</code>, 6072 <code>char</code>, <code>byte</code>, or 6073 <code>boolean</code>. 6074 </error> 6075 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 6076 Not a visible frame 6077 </error> 6078 </errors> 6079 </function> 6080 6081 <function id="SetLocalLong" num="28"> 6082 <synopsis>Set Local Variable - Long</synopsis> 6083 <description> 6084 This function can be used to set the value of a local 6085 variable whose type is <code>long</code>. 6086 </description> 6087 <origin>jvmdi</origin> 6088 <capabilities> 6089 <required id="can_access_local_variables"></required> 6090 </capabilities> 6091 <parameters> 6092 <param id="thread"> 6093 <jthread null="current" frame="frame"/> 6094 <description> 6095 The thread of the frame containing the variable's value. 6096 </description> 6097 </param> 6098 <param id="depth"> 6099 <jframeID thread="thread"/> 6100 <description> 6101 The depth of the frame containing the variable's value. 6102 </description> 6103 </param> 6104 <param id="slot"> 6105 <jint/> 6106 <description> 6107 The variable's slot number. 6108 </description> 6109 </param> 6110 <param id="value"> 6111 <jlong/> 6112 <description> 6113 The new value for the variable. 6114 </description> 6115 </param> 6116 </parameters> 6117 <errors> 6118 <error id="JVMTI_ERROR_INVALID_SLOT"> 6119 Invalid <code>slot</code>. 6120 </error> 6121 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 6122 The variable type is not <code>long</code>. 6123 </error> 6124 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 6125 Not a visible frame 6126 </error> 6127 </errors> 6128 </function> 6129 6130 <function id="SetLocalFloat" num="29"> 6131 <synopsis>Set Local Variable - Float</synopsis> 6132 <description> 6133 This function can be used to set the value of a local 6134 variable whose type is <code>float</code>. 6135 </description> 6136 <origin>jvmdi</origin> 6137 <capabilities> 6138 <required id="can_access_local_variables"></required> 6139 </capabilities> 6140 <parameters> 6141 <param id="thread"> 6142 <jthread null="current" frame="frame"/> 6143 <description> 6144 The thread of the frame containing the variable's value. 6145 </description> 6146 </param> 6147 <param id="depth"> 6148 <jframeID thread="thread"/> 6149 <description> 6150 The depth of the frame containing the variable's value. 6151 </description> 6152 </param> 6153 <param id="slot"> 6154 <jint/> 6155 <description> 6156 The variable's slot number. 6157 </description> 6158 </param> 6159 <param id="value"> 6160 <jfloat/> 6161 <description> 6162 The new value for the variable. 6163 </description> 6164 </param> 6165 </parameters> 6166 <errors> 6167 <error id="JVMTI_ERROR_INVALID_SLOT"> 6168 Invalid <code>slot</code>. 6169 </error> 6170 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 6171 The variable type is not <code>float</code>. 6172 </error> 6173 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 6174 Not a visible frame 6175 </error> 6176 </errors> 6177 </function> 6178 6179 <function id="SetLocalDouble" num="30"> 6180 <synopsis>Set Local Variable - Double</synopsis> 6181 <description> 6182 This function can be used to set the value of a local 6183 variable whose type is <code>double</code>. 6184 </description> 6185 <origin>jvmdi</origin> 6186 <capabilities> 6187 <required id="can_access_local_variables"></required> 6188 </capabilities> 6189 <parameters> 6190 <param id="thread"> 6191 <jthread null="current" frame="frame"/> 6192 <description> 6193 The thread of the frame containing the variable's value. 6194 </description> 6195 </param> 6196 <param id="depth"> 6197 <jframeID thread="thread"/> 6198 <description> 6199 The depth of the frame containing the variable's value. 6200 </description> 6201 </param> 6202 <param id="slot"> 6203 <jint/> 6204 <description> 6205 The variable's slot number. 6206 </description> 6207 </param> 6208 <param id="value"> 6209 <jdouble/> 6210 <description> 6211 The new value for the variable. 6212 </description> 6213 </param> 6214 </parameters> 6215 <errors> 6216 <error id="JVMTI_ERROR_INVALID_SLOT"> 6217 Invalid <code>slot</code>. 6218 </error> 6219 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 6220 The variable type is not <code>double</code>. 6221 </error> 6222 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 6223 Not a visible frame 6224 </error> 6225 </errors> 6226 </function> 6227 </category> 6228 6229 <category id="breakpointCategory" label="Breakpoint"> 6230 6231 <intro> 6232 </intro> 6233 6234 <function id="SetBreakpoint" num="38"> 6235 <synopsis>Set Breakpoint</synopsis> 6236 <description> 6237 Set a breakpoint at the instruction indicated by 6238 <code>method</code> and <code>location</code>. 6239 An instruction can only have one breakpoint. 6240 <p/> 6241 Whenever the designated instruction is about to be executed, a 6242 <eventlink id="Breakpoint"></eventlink> event is generated. 6243 </description> 6244 <origin>jvmdi</origin> 6245 <capabilities> 6246 <required id="can_generate_breakpoint_events"></required> 6247 </capabilities> 6248 <parameters> 6249 <param id="klass"> 6250 <jclass method="method"/> 6251 <description> 6252 The class in which to set the breakpoint 6253 </description> 6254 </param> 6255 <param id="method"> 6256 <jmethodID class="klass"/> 6257 <description> 6258 The method in which to set the breakpoint 6259 </description> 6260 </param> 6261 <param id="location"> 6262 <jlocation/> 6263 <description> 6264 the index of the instruction at which to set the breakpoint 6265 6266 </description> 6267 </param> 6268 </parameters> 6269 <errors> 6270 <error id="JVMTI_ERROR_DUPLICATE"> 6271 The designated bytecode already has a breakpoint. 6272 </error> 6273 </errors> 6274 </function> 6275 6276 <function id="ClearBreakpoint" num="39"> 6277 <synopsis>Clear Breakpoint</synopsis> 6278 <description> 6279 Clear the breakpoint at the bytecode indicated by 6280 <code>method</code> and <code>location</code>. 6281 </description> 6282 <origin>jvmdi</origin> 6283 <capabilities> 6284 <required id="can_generate_breakpoint_events"></required> 6285 </capabilities> 6286 <parameters> 6287 <param id="klass"> 6288 <jclass method="method"/> 6289 <description> 6290 The class in which to clear the breakpoint 6291 </description> 6292 </param> 6293 <param id="method"> 6294 <jmethodID class="klass"/> 6295 <description> 6296 The method in which to clear the breakpoint 6297 </description> 6298 </param> 6299 <param id="location"> 6300 <jlocation/> 6301 <description> 6302 the index of the instruction at which to clear the breakpoint 6303 </description> 6304 </param> 6305 </parameters> 6306 <errors> 6307 <error id="JVMTI_ERROR_NOT_FOUND"> 6308 There's no breakpoint at the designated bytecode. 6309 </error> 6310 </errors> 6311 </function> 6312 6313 </category> 6314 6315 <category id="fieldWatch" label="Watched Field"> 6316 6317 <intro> 6318 </intro> 6319 6320 <function id="SetFieldAccessWatch" num="41"> 6321 <synopsis>Set Field Access Watch</synopsis> 6322 <description> 6323 Generate a <eventlink id="FieldAccess"></eventlink> event 6324 when the field specified 6325 by <code>klass</code> and 6326 <code>field</code> is about to be accessed. 6327 An event will be generated for each access of the field 6328 until it is canceled with 6329 <functionlink id="ClearFieldAccessWatch"></functionlink>. 6330 Field accesses from Java programming language code or from JNI code are watched, 6331 fields modified by other means are not watched. 6332 Note that <jvmti/> users should be aware that their own field accesses 6333 will trigger the watch. 6334 A field can only have one field access watch set. 6335 Modification of a field is not considered an access--use 6336 <functionlink id="SetFieldModificationWatch"></functionlink> 6337 to monitor modifications. 6338 </description> 6339 <origin>jvmdi</origin> 6340 <capabilities> 6341 <required id="can_generate_field_access_events"></required> 6342 </capabilities> 6343 <parameters> 6344 <param id="klass"> 6345 <jclass field="field"/> 6346 <description> 6347 The class containing the field to watch 6348 </description> 6349 </param> 6350 <param id="field"> 6351 <jfieldID class="klass"/> 6352 <description> 6353 The field to watch 6354 6355 </description> 6356 </param> 6357 </parameters> 6358 <errors> 6359 <error id="JVMTI_ERROR_DUPLICATE"> 6360 The designated field is already being watched for accesses. 6361 </error> 6362 </errors> 6363 </function> 6364 6365 <function id="ClearFieldAccessWatch" num="42"> 6366 <synopsis>Clear Field Access Watch</synopsis> 6367 <description> 6368 Cancel a field access watch previously set by 6369 <functionlink id="SetFieldAccessWatch"></functionlink>, on the 6370 field specified 6371 by <code>klass</code> and 6372 <code>field</code>. 6373 </description> 6374 <origin>jvmdi</origin> 6375 <capabilities> 6376 <required id="can_generate_field_access_events"></required> 6377 </capabilities> 6378 <parameters> 6379 <param id="klass"> 6380 <jclass field="field"/> 6381 <description> 6382 The class containing the field to watch 6383 </description> 6384 </param> 6385 <param id="field"> 6386 <jfieldID class="klass"/> 6387 <description> 6388 The field to watch 6389 6390 </description> 6391 </param> 6392 </parameters> 6393 <errors> 6394 <error id="JVMTI_ERROR_NOT_FOUND"> 6395 The designated field is not being watched for accesses. 6396 </error> 6397 </errors> 6398 </function> 6399 6400 <function id="SetFieldModificationWatch" num="43"> 6401 <synopsis>Set Field Modification Watch</synopsis> 6402 <description> 6403 Generate a <eventlink id="FieldModification"></eventlink> event 6404 when the field specified 6405 by <code>klass</code> and 6406 <code>field</code> is about to be modified. 6407 An event will be generated for each modification of the field 6408 until it is canceled with 6409 <functionlink id="ClearFieldModificationWatch"></functionlink>. 6410 Field modifications from Java programming language code or from JNI code are watched, 6411 fields modified by other means are not watched. 6412 Note that <jvmti/> users should be aware that their own field modifications 6413 will trigger the watch. 6414 A field can only have one field modification watch set. 6415 </description> 6416 <origin>jvmdi</origin> 6417 <capabilities> 6418 <required id="can_generate_field_modification_events"></required> 6419 </capabilities> 6420 <parameters> 6421 <param id="klass"> 6422 <jclass field="field"/> 6423 <description> 6424 The class containing the field to watch 6425 </description> 6426 </param> 6427 <param id="field"> 6428 <jfieldID class="klass"/> 6429 <description> 6430 The field to watch 6431 6432 </description> 6433 </param> 6434 </parameters> 6435 <errors> 6436 <error id="JVMTI_ERROR_DUPLICATE"> 6437 The designated field is already being watched for modifications. 6438 </error> 6439 </errors> 6440 </function> 6441 6442 <function id="ClearFieldModificationWatch" num="44"> 6443 <synopsis>Clear Field Modification Watch</synopsis> 6444 <description> 6445 6446 Cancel a field modification watch previously set by 6447 <functionlink id="SetFieldModificationWatch"></functionlink>, on the 6448 field specified 6449 by <code>klass</code> and 6450 <code>field</code>. 6451 </description> 6452 <origin>jvmdi</origin> 6453 <capabilities> 6454 <required id="can_generate_field_modification_events"></required> 6455 </capabilities> 6456 <parameters> 6457 <param id="klass"> 6458 <jclass field="field"/> 6459 <description> 6460 The class containing the field to watch 6461 </description> 6462 </param> 6463 <param id="field"> 6464 <jfieldID class="klass"/> 6465 <description> 6466 The field to watch 6467 6468 </description> 6469 </param> 6470 </parameters> 6471 <errors> 6472 <error id="JVMTI_ERROR_NOT_FOUND"> 6473 The designated field is not being watched for modifications. 6474 </error> 6475 </errors> 6476 </function> 6477 </category> 6478 6479 <category id="module" label="Module"> 6480 6481 <intro> 6482 </intro> 6483 6484 <function id="GetAllModules" num="3" since="9"> 6485 <synopsis>Get All Modules</synopsis> 6486 <description> 6487 Return an array of all modules loaded in the virtual machine. 6488 The array includes the unnamed module for each class loader. 6489 The number of modules in the array is returned via 6490 <code>module_count_ptr</code>, and the array itself via 6491 <code>modules_ptr</code>. 6492 <p/> 6493 </description> 6494 <origin>new</origin> 6495 <capabilities> 6496 </capabilities> 6497 <parameters> 6498 <param id="module_count_ptr"> 6499 <outptr><jint/></outptr> 6500 <description> 6501 On return, points to the number of returned modules. 6502 </description> 6503 </param> 6504 <param id="modules_ptr"> 6505 <allocbuf outcount="module_count_ptr"><jobject/></allocbuf> 6506 <description> 6507 On return, points to an array of references, one 6508 for each module. 6509 </description> 6510 </param> 6511 </parameters> 6512 <errors> 6513 </errors> 6514 </function> 6515 6516 <function id="GetNamedModule" num="40" since="9"> 6517 <synopsis>Get Named Module</synopsis> 6518 <description> 6519 Return the <code>java.lang.Module</code> object for a named 6520 module defined to a class loader that contains a given package. 6521 The module is returned via <code>module_ptr</code>. 6522 <p/> 6523 If a named module is defined to the class loader and it 6524 contains the package then that named module is returned, 6525 otherwise <code>NULL</code> is returned. 6526 <p/> 6527 </description> 6528 <origin>new</origin> 6529 <capabilities> 6530 </capabilities> 6531 <parameters> 6532 <param id="class_loader"> 6533 <ptrtype> 6534 <jobject/> 6535 <nullok>the bootstrap loader is assumed</nullok> 6536 </ptrtype> 6537 <description> 6538 A class loader. 6539 If the <code>class_loader</code> is not <code>NULL</code> 6540 or a subclass of <code>java.lang.ClassLoader</code> 6541 this function returns 6542 <errorlink id="JVMTI_ERROR_ILLEGAL_ARGUMENT"></errorlink>. 6543 </description> 6544 </param> 6545 <param id="package_name"> 6546 <inbuf><char/></inbuf> 6547 <description> 6548 The name of the package, encoded as a 6549 <internallink id="mUTF">modified UTF-8</internallink> string. 6550 The package name is in internal form (JVMS 4.2.1); 6551 identifiers are separated by forward slashes rather than periods. 6552 </description> 6553 </param> 6554 <param id="module_ptr"> 6555 <outptr><jobject/></outptr> 6556 <description> 6557 On return, points to a <code>java.lang.Module</code> object 6558 or points to <code>NULL</code>. 6559 </description> 6560 </param> 6561 </parameters> 6562 <errors> 6563 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 6564 If class loader is not <code>NULL</code> and is not a class loader object. 6565 </error> 6566 </errors> 6567 </function> 6568 6569 <function id="AddModuleReads" num="94" since="9"> 6570 <synopsis>Add Module Reads</synopsis> 6571 <description> 6572 Update a module to read another module. This function is a no-op 6573 when <paramlink id="module"></paramlink> is an unnamed module. 6574 This function facilitates the instrumentation of code 6575 in named modules where that instrumentation requires 6576 expanding the set of modules that a module reads. 6577 </description> 6578 <origin>new</origin> 6579 <capabilities> 6580 </capabilities> 6581 <parameters> 6582 <param id="module"> 6583 <ptrtype><jobject/></ptrtype> 6584 <description> 6585 The module to update. 6586 </description> 6587 </param> 6588 <param id="to_module"> 6589 <ptrtype><jobject/></ptrtype> 6590 <description> 6591 The additional module to read. 6592 </description> 6593 </param> 6594 </parameters> 6595 <errors> 6596 <error id="JVMTI_ERROR_INVALID_MODULE"> 6597 If <paramlink id="module"></paramlink> is not a module object. 6598 </error> 6599 <error id="JVMTI_ERROR_INVALID_MODULE"> 6600 If <paramlink id="to_module"></paramlink> is not a module object. 6601 </error> 6602 <error id="JVMTI_ERROR_UNMODIFIABLE_MODULE"> 6603 if the module cannot be modified. 6604 See <functionlink id="IsModifiableModule"/>. 6605 </error> 6606 </errors> 6607 </function> 6608 6609 <function id="AddModuleExports" num="95" since="9"> 6610 <synopsis>Add Module Exports</synopsis> 6611 <description> 6612 Update a module to export a package to another module. 6613 This function is a no-op when <paramlink id="module"></paramlink> 6614 is an unnamed module or an open module. 6615 This function facilitates the instrumentation of code 6616 in named modules where that instrumentation requires 6617 expanding the set of packages that a module exports. 6618 </description> 6619 <origin>new</origin> 6620 <capabilities> 6621 </capabilities> 6622 <parameters> 6623 <param id="module"> 6624 <ptrtype><jobject/></ptrtype> 6625 <description> 6626 The module to update. 6627 </description> 6628 </param> 6629 <param id="pkg_name"> 6630 <inbuf><char/></inbuf> 6631 <description> 6632 The exported package name. 6633 </description> 6634 </param> 6635 <param id="to_module"> 6636 <ptrtype><jobject/></ptrtype> 6637 <description> 6638 The module the package is exported to. 6639 If the <code>to_module</code> is not a subclass of 6640 <code>java.lang.Module</code> this function returns 6641 <errorlink id="JVMTI_ERROR_INVALID_MODULE"></errorlink>. 6642 </description> 6643 </param> 6644 </parameters> 6645 <errors> 6646 <error id="JVMTI_ERROR_INVALID_MODULE"> 6647 If <paramlink id="module"></paramlink> is not a module object. 6648 </error> 6649 <error id="JVMTI_ERROR_INVALID_MODULE"> 6650 If <paramlink id="to_module"></paramlink> is not a module object. 6651 </error> 6652 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 6653 If the package <paramlink id="pkg_name"></paramlink> 6654 does not belong to the module. 6655 </error> 6656 <error id="JVMTI_ERROR_UNMODIFIABLE_MODULE"> 6657 if the module cannot be modified. 6658 See <functionlink id="IsModifiableModule"/>. 6659 </error> 6660 </errors> 6661 </function> 6662 6663 <function id="AddModuleOpens" num="96" since="9"> 6664 <synopsis>Add Module Opens</synopsis> 6665 <description> 6666 Update a module to open a package to another module. 6667 This function is a no-op when <paramlink id="module"></paramlink> 6668 is an unnamed module or an open module. 6669 This function facilitates the instrumentation of code 6670 in modules where that instrumentation requires 6671 expanding the set of packages that a module opens to 6672 other modules. 6673 </description> 6674 <origin>new</origin> 6675 <capabilities> 6676 </capabilities> 6677 <parameters> 6678 <param id="module"> 6679 <ptrtype><jobject/></ptrtype> 6680 <description> 6681 The module to update. 6682 </description> 6683 </param> 6684 <param id="pkg_name"> 6685 <inbuf><char/></inbuf> 6686 <description> 6687 The package name of the package to open. 6688 </description> 6689 </param> 6690 <param id="to_module"> 6691 <ptrtype><jobject/></ptrtype> 6692 <description> 6693 The module with the package to open. 6694 If the <code>to_module</code> is not a subclass of 6695 <code>java.lang.Module</code> this function returns 6696 <errorlink id="JVMTI_ERROR_INVALID_MODULE"></errorlink>. 6697 </description> 6698 </param> 6699 </parameters> 6700 <errors> 6701 <error id="JVMTI_ERROR_INVALID_MODULE"> 6702 If <paramlink id="module"></paramlink> is not a module object. 6703 </error> 6704 <error id="JVMTI_ERROR_INVALID_MODULE"> 6705 If <paramlink id="to_module"></paramlink> is not a module object. 6706 </error> 6707 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 6708 If the package <paramlink id="pkg_name"></paramlink> 6709 does not belong to the module. 6710 </error> 6711 <error id="JVMTI_ERROR_UNMODIFIABLE_MODULE"> 6712 if the module cannot be modified. 6713 See <functionlink id="IsModifiableModule"/>. 6714 </error> 6715 </errors> 6716 </function> 6717 6718 <function id="AddModuleUses" num="97" since="9"> 6719 <synopsis>Add Module Uses</synopsis> 6720 <description> 6721 Updates a module to add a service to the set of services that 6722 a module uses. This function is a no-op when the module 6723 is an unnamed module. 6724 This function facilitates the instrumentation of code 6725 in named modules where that instrumentation requires 6726 expanding the set of services that a module is using. 6727 </description> 6728 <origin>new</origin> 6729 <capabilities> 6730 </capabilities> 6731 <parameters> 6732 <param id="module"> 6733 <ptrtype><jobject/></ptrtype> 6734 <description> 6735 The module to update. 6736 </description> 6737 </param> 6738 <param id="service"> 6739 <ptrtype><jclass/></ptrtype> 6740 <description> 6741 The service to use. 6742 </description> 6743 </param> 6744 </parameters> 6745 <errors> 6746 <error id="JVMTI_ERROR_INVALID_MODULE"> 6747 If <paramlink id="module"></paramlink> is not a module object. 6748 </error> 6749 <error id="JVMTI_ERROR_INVALID_CLASS"> 6750 If <paramlink id="service"></paramlink> is not a class object. 6751 </error> 6752 <error id="JVMTI_ERROR_UNMODIFIABLE_MODULE"> 6753 if the module cannot be modified. 6754 See <functionlink id="IsModifiableModule"/>. 6755 </error> 6756 </errors> 6757 </function> 6758 6759 <function id="AddModuleProvides" num="98" since="9"> 6760 <synopsis>Add Module Provides</synopsis> 6761 <description> 6762 Updates a module to add a service to the set of services that 6763 a module provides. This function is a no-op when the module 6764 is an unnamed module. 6765 This function facilitates the instrumentation of code 6766 in named modules where that instrumentation requires 6767 changes to the services that are provided. 6768 </description> 6769 <origin>new</origin> 6770 <capabilities> 6771 </capabilities> 6772 <parameters> 6773 <param id="module"> 6774 <ptrtype><jobject/></ptrtype> 6775 <description> 6776 The module to update. 6777 </description> 6778 </param> 6779 <param id="service"> 6780 <ptrtype><jclass/></ptrtype> 6781 <description> 6782 The service to provide. 6783 </description> 6784 </param> 6785 <param id="impl_class"> 6786 <ptrtype><jclass/></ptrtype> 6787 <description> 6788 The implementation class for the provided service. 6789 </description> 6790 </param> 6791 </parameters> 6792 <errors> 6793 <error id="JVMTI_ERROR_INVALID_MODULE"> 6794 If <paramlink id="module"></paramlink> is not a module object. 6795 </error> 6796 <error id="JVMTI_ERROR_INVALID_CLASS"> 6797 If <paramlink id="service"></paramlink> is not a class object. 6798 </error> 6799 <error id="JVMTI_ERROR_INVALID_CLASS"> 6800 If <paramlink id="impl_class"></paramlink> is not a class object. 6801 </error> 6802 <error id="JVMTI_ERROR_UNMODIFIABLE_MODULE"> 6803 if the module cannot be modified. 6804 See <functionlink id="IsModifiableModule"/>. 6805 </error> 6806 </errors> 6807 </function> 6808 6809 <function id="IsModifiableModule" num="99" since="9"> 6810 <synopsis>Is Modifiable Module</synopsis> 6811 <description> 6812 Determines whether a module is modifiable. 6813 If a module is modifiable then this module can be updated with 6814 <functionlink id="AddModuleReads"/>, <functionlink id="AddModuleExports"/>, 6815 <functionlink id="AddModuleOpens"/>, <functionlink id="AddModuleUses"/>, 6816 and <functionlink id="AddModuleProvides"/>. If a module is not modifiable 6817 then the module can not be updated with these functions. The result of 6818 this function is always <code>JNI_TRUE</code> when called to determine 6819 if an unnamed module is modifiable. 6820 </description> 6821 <origin>new</origin> 6822 <capabilities> 6823 </capabilities> 6824 <parameters> 6825 <param id="module"> 6826 <ptrtype><jobject/></ptrtype> 6827 <description> 6828 The module to query. 6829 </description> 6830 </param> 6831 <param id="is_modifiable_module_ptr"> 6832 <outptr><jboolean/></outptr> 6833 <description> 6834 On return, points to the boolean result of this function. 6835 </description> 6836 </param> 6837 </parameters> 6838 <errors> 6839 <error id="JVMTI_ERROR_INVALID_MODULE"> 6840 If <paramlink id="module"></paramlink> is not a module object. 6841 </error> 6842 </errors> 6843 </function> 6844 6845 </category> 6846 6847 <category id="class" label="Class"> 6848 <function id="GetLoadedClasses" jkernel="yes" num="78"> 6849 <synopsis>Get Loaded Classes</synopsis> 6850 <description> 6851 Return an array of all classes loaded in the virtual machine. 6852 The number of classes in the array is returned via 6853 <code>class_count_ptr</code>, and the array itself via 6854 <code>classes_ptr</code>. 6855 <p/> 6856 A class or interface creation can be triggered by one of the following: 6857 <ul> 6858 <li>By loading and deriving a class from a <code>class</code> file representation 6859 using a class loader (see <vmspec chapter="5.3"/>).</li> 6860 <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> 6861 that creates a hidden class or interface from a <code>class</code> file representation.</li> 6862 <li>By invoking methods in certain Java SE Platform APIs such as reflection.</li> 6863 </ul> 6864 <p/> 6865 An array class is created directly by the Java virtual machine. The creation 6866 can be triggered by using class loaders or by invoking methods in certain 6867 Java SE Platform APIs such as reflection. 6868 <p/> 6869 The returned list includes all classes and interfaces, including 6870 <externallink id="../api/java.base/java/lang/Class.html#isHidden()"> 6871 hidden classes or interfaces</externallink>, 6872 and also array classes of all types 6873 (including arrays of primitive types). 6874 Primitive classes (for example, <code>java.lang.Integer.TYPE</code>) are 6875 <i>not</i> included in the returned list. 6876 </description> 6877 <origin>jvmdi</origin> 6878 <capabilities> 6879 </capabilities> 6880 <parameters> 6881 <param id="class_count_ptr"> 6882 <outptr><jint/></outptr> 6883 <description> 6884 On return, points to the number of classes. 6885 </description> 6886 </param> 6887 <param id="classes_ptr"> 6888 <allocbuf outcount="class_count_ptr"><jclass/></allocbuf> 6889 <description> 6890 On return, points to an array of references, one 6891 for each class. 6892 </description> 6893 </param> 6894 </parameters> 6895 <errors> 6896 </errors> 6897 </function> 6898 6899 <function id="GetClassLoaderClasses" jkernel="yes" num="79"> 6900 <synopsis>Get Classloader Classes</synopsis> 6901 <description> 6902 Returns an array of all classes which this class loader 6903 can find by name via 6904 <externallink id="../api/java.base/java/lang/ClassLoader.html#loadClass(java.lang.String,boolean)">ClassLoader::loadClass</externallink>, 6905 <externallink id="../api/java.base/java/lang/Class.html#forName(java.lang.String,boolean,java.lang.ClassLoader)">Class::forName</externallink> and bytecode linkage. 6906 That is, all classes for which <code>initiating_loader</code> 6907 has been recorded as an initiating loader. 6908 Each class in the returned array was created by this class loader, 6909 either by defining it directly or by delegation to another class loader. 6910 See <vmspec chapter="5.3"/>. 6911 <p/> 6912 The returned list does not include 6913 <externallink id="../api/java.base/java/lang/Class.html#isHidden()">hidden 6914 classes or interfaces</externallink> or array classes whose 6915 element type is a hidden class or interface as they cannot be discovered 6916 by any class loader. 6917 <p/> 6918 The number of classes in the array is returned via 6919 <code>class_count_ptr</code>, and the array itself via 6920 <code>classes_ptr</code>. 6921 <p/> 6922 See <externallink id="../api/java.base/java/lang/invoke/MethodHandles.Lookup.html#defineHiddenClass(byte[],boolean,java.lang.invoke.MethodHandles.Lookup.ClassOption...)">Lookup::defineHiddenClass</externallink>. 6923 </description> 6924 <origin>jvmdi</origin> 6925 <capabilities> 6926 </capabilities> 6927 <parameters> 6928 <param id="initiating_loader"> 6929 <ptrtype> 6930 <jobject/> 6931 <nullok>the classes initiated by the bootstrap loader will be returned</nullok> 6932 </ptrtype> 6933 <description> 6934 An initiating class loader. 6935 </description> 6936 </param> 6937 <param id="class_count_ptr"> 6938 <outptr><jint/></outptr> 6939 <description> 6940 On return, points to the number of classes. 6941 </description> 6942 </param> 6943 <param id="classes_ptr"> 6944 <allocbuf outcount="class_count_ptr"><jclass/></allocbuf> 6945 <description> 6946 On return, points to an array of references, one 6947 for each class. 6948 </description> 6949 </param> 6950 </parameters> 6951 <errors> 6952 </errors> 6953 </function> 6954 6955 <function id="GetClassSignature" phase="start" num="48"> 6956 <synopsis>Get Class Signature</synopsis> 6957 <description> 6958 Return the name and the generic signature of the class indicated by <code>klass</code>. 6959 <p/> 6960 If the class is a class or interface, then: 6961 <ul> 6962 <li>If the class or interface is not <externallink id="../api/java.base/java/lang/Class.html#isHidden()">hidden</externallink>, 6963 then the returned name is the <externallink id="jni/types.html#type-signatures"> 6964 JNI type signature</externallink>. 6965 For example, java.util.List is "Ljava/util/List;" 6966 </li> 6967 <li>If the class or interface is <externallink id="../api/java.base/java/lang/Class.html#isHidden()">hidden</externallink>, 6968 then the returned name is a string of the form: 6969 <code>"L" + N + "." + S + ";"</code> 6970 where <code>N</code> is the binary name encoded in internal form (JVMS 4.2.1) 6971 indicated by the <code>class</code> file passed to 6972 <externallink id="../api/java.base/java/lang/invoke/MethodHandles.Lookup.html#defineHiddenClass(byte[],boolean,java.lang.invoke.MethodHandles.Lookup.ClassOption...)">Lookup::defineHiddenClass</externallink>, 6973 and <code>S</code> is an unqualified name. 6974 The returned name is not a type descriptor and does not conform to JVMS 4.3.2. 6975 For example, com.foo.Foo/AnySuffix is "Lcom/foo/Foo.AnySuffix;" 6976 </li> 6977 </ul> 6978 <p/> 6979 If the class indicated by <code>klass</code> represents an array class, then 6980 the returned name is a string consisting of one or more "<code>[</code>" characters 6981 representing the depth of the array nesting, followed by the class signature 6982 of the element type. For example the class signature of java.lang.String[] is 6983 "[Ljava/lang/String;" and that of int[] is "[I". 6984 <p/> 6985 If the class indicated by <code>klass</code> represents primitive type or <code>void</code>, 6986 then the returned name is the <externallink id="jni/types.html#type-signatures"> 6987 type signature character of the corresponding primitive type</externallink>. 6988 For example, java.lang.Integer.TYPE is "I". 6989 </description> 6990 <origin>jvmdiClone</origin> 6991 <capabilities> 6992 </capabilities> 6993 <parameters> 6994 <param id="klass"> 6995 <jclass/> 6996 <description> 6997 The class to query. 6998 </description> 6999 </param> 7000 <param id="signature_ptr"> 7001 <allocbuf> 7002 <char/> 7003 <nullok>the signature is not returned</nullok> 7004 </allocbuf> 7005 <description> 7006 On return, points to the JNI type signature of the class, encoded as a 7007 <internallink id="mUTF">modified UTF-8</internallink> string. 7008 </description> 7009 </param> 7010 <param id="generic_ptr"> 7011 <allocbuf> 7012 <char/> 7013 <nullok>the generic signature is not returned</nullok> 7014 </allocbuf> 7015 <description> 7016 On return, points to the generic signature of the class, encoded as a 7017 <internallink id="mUTF">modified UTF-8</internallink> string. 7018 If there is no generic signature attribute for the class, then, 7019 on return, points to <code>NULL</code>. 7020 </description> 7021 </param> 7022 </parameters> 7023 <errors> 7024 </errors> 7025 </function> 7026 7027 <function id="GetClassStatus" phase="start" num="49"> 7028 <synopsis>Get Class Status</synopsis> 7029 <description> 7030 Get the status of the class. Zero or more of the following bits can be 7031 set. 7032 <constants id="jvmtiClassStatus" label="Class Status Flags" kind="bits"> 7033 <constant id="JVMTI_CLASS_STATUS_VERIFIED" num="1"> 7034 Class bytecodes have been verified 7035 </constant> 7036 <constant id="JVMTI_CLASS_STATUS_PREPARED" num="2"> 7037 Class preparation is complete 7038 </constant> 7039 <constant id="JVMTI_CLASS_STATUS_INITIALIZED" num="4"> 7040 Class initialization is complete. Static initializer has been run. 7041 </constant> 7042 <constant id="JVMTI_CLASS_STATUS_ERROR" num="8"> 7043 Error during initialization makes class unusable 7044 </constant> 7045 <constant id="JVMTI_CLASS_STATUS_ARRAY" num="16"> 7046 Class is an array. If set, all other bits are zero. 7047 </constant> 7048 <constant id="JVMTI_CLASS_STATUS_PRIMITIVE" num="32"> 7049 Class is a primitive class (for example, <code>java.lang.Integer.TYPE</code>). 7050 If set, all other bits are zero. 7051 </constant> 7052 </constants> 7053 </description> 7054 <origin>jvmdi</origin> 7055 <capabilities> 7056 </capabilities> 7057 <parameters> 7058 <param id="klass"> 7059 <jclass/> 7060 <description> 7061 The class to query. 7062 </description> 7063 </param> 7064 <param id="status_ptr"> 7065 <outptr><jint/></outptr> 7066 <description> 7067 On return, points to the current state of this class as one or 7068 more of the <internallink id="jvmtiClassStatus">class status flags</internallink>. 7069 </description> 7070 </param> 7071 </parameters> 7072 <errors> 7073 </errors> 7074 </function> 7075 7076 <function id="GetSourceFileName" phase="start" num="50"> 7077 <synopsis>Get Source File Name</synopsis> 7078 <description> 7079 For the class indicated by <code>klass</code>, return the source file 7080 name via <code>source_name_ptr</code>. The returned string 7081 is a file name only and never contains a directory name. 7082 <p/> 7083 For primitive classes (for example, <code>java.lang.Integer.TYPE</code>) 7084 and for arrays this function returns 7085 <errorlink id="JVMTI_ERROR_ABSENT_INFORMATION"></errorlink>. 7086 </description> 7087 <origin>jvmdi</origin> 7088 <capabilities> 7089 <required id="can_get_source_file_name"></required> 7090 </capabilities> 7091 <parameters> 7092 <param id="klass"> 7093 <jclass/> 7094 <description> 7095 The class to query. 7096 </description> 7097 </param> 7098 <param id="source_name_ptr"> 7099 <allocbuf><char/></allocbuf> 7100 <description> 7101 On return, points to the class's source file name, encoded as a 7102 <internallink id="mUTF">modified UTF-8</internallink> string. 7103 </description> 7104 </param> 7105 </parameters> 7106 <errors> 7107 <error id="JVMTI_ERROR_ABSENT_INFORMATION"> 7108 Class information does not include a source file name. This includes 7109 cases where the class is an array class or primitive class. 7110 </error> 7111 </errors> 7112 </function> 7113 7114 <function id="GetClassModifiers" phase="start" num="51"> 7115 <synopsis>Get Class Modifiers</synopsis> 7116 <description> 7117 For the class indicated by <code>klass</code>, return the access 7118 flags 7119 via <code>modifiers_ptr</code>. 7120 Access flags are defined in <vmspec chapter="4"/>. 7121 <p/> 7122 If the class is an array class, then its public, private, and protected 7123 modifiers are the same as those of its component type. For arrays of 7124 primitives, this component type is represented by one of the primitive 7125 classes (for example, <code>java.lang.Integer.TYPE</code>). 7126 <p/> 7127 If the class is a primitive class, its public modifier is always true, 7128 and its protected and private modifiers are always false. 7129 <p/> 7130 If the class is an array class or a primitive class then its final 7131 modifier is always true and its interface modifier is always false. 7132 The values of its other modifiers are not determined by this specification. 7133 7134 </description> 7135 <origin>jvmdi</origin> 7136 <capabilities> 7137 </capabilities> 7138 <parameters> 7139 <param id="klass"> 7140 <jclass/> 7141 <description> 7142 The class to query. 7143 </description> 7144 </param> 7145 <param id="modifiers_ptr"> 7146 <outptr><jint/></outptr> 7147 <description> 7148 On return, points to the current access flags of this class. 7149 7150 </description> 7151 </param> 7152 </parameters> 7153 <errors> 7154 </errors> 7155 </function> 7156 7157 <function id="GetClassMethods" phase="start" num="52"> 7158 <synopsis>Get Class Methods</synopsis> 7159 <description> 7160 For the class indicated by <code>klass</code>, return a count of 7161 methods via <code>method_count_ptr</code> and a list of 7162 method IDs via <code>methods_ptr</code>. The method list contains 7163 constructors and static initializers as well as true methods. 7164 Only directly declared methods are returned (not inherited methods). 7165 An empty method list is returned for array classes and primitive classes 7166 (for example, <code>java.lang.Integer.TYPE</code>). 7167 </description> 7168 <origin>jvmdi</origin> 7169 <capabilities> 7170 <capability id="can_maintain_original_method_order"/> 7171 </capabilities> 7172 <parameters> 7173 <param id="klass"> 7174 <jclass/> 7175 <description> 7176 The class to query. 7177 </description> 7178 </param> 7179 <param id="method_count_ptr"> 7180 <outptr><jint/></outptr> 7181 <description> 7182 On return, points to the number of methods declared in this class. 7183 </description> 7184 </param> 7185 <param id="methods_ptr"> 7186 <allocbuf outcount="method_count_ptr"><jmethodID class="klass"/></allocbuf> 7187 <description> 7188 On return, points to the method ID array. 7189 </description> 7190 </param> 7191 </parameters> 7192 <errors> 7193 <error id="JVMTI_ERROR_CLASS_NOT_PREPARED"> 7194 <paramlink id="klass"></paramlink> is not prepared. 7195 </error> 7196 </errors> 7197 </function> 7198 7199 <function id="GetClassFields" phase="start" num="53"> 7200 <synopsis>Get Class Fields</synopsis> 7201 <description> 7202 For the class indicated by <code>klass</code>, return a count of fields 7203 via <code>field_count_ptr</code> and a list of field IDs via 7204 <code>fields_ptr</code>. 7205 Only directly declared fields are returned (not inherited fields). 7206 Fields are returned in the order they occur in the class file. 7207 An empty field list is returned for array classes and primitive classes 7208 (for example, <code>java.lang.Integer.TYPE</code>). 7209 Use JNI to determine the length of an array. 7210 </description> 7211 <origin>jvmdi</origin> 7212 <capabilities> 7213 </capabilities> 7214 <parameters> 7215 <param id="klass"> 7216 <jclass/> 7217 <description> 7218 The class to query. 7219 </description> 7220 </param> 7221 <param id="field_count_ptr"> 7222 <outptr><jint/></outptr> 7223 <description> 7224 On return, points to the number of fields declared in this class. 7225 </description> 7226 </param> 7227 <param id="fields_ptr"> 7228 <allocbuf outcount="field_count_ptr"><jfieldID/></allocbuf> 7229 <description> 7230 On return, points to the field ID array. 7231 </description> 7232 </param> 7233 </parameters> 7234 <errors> 7235 <error id="JVMTI_ERROR_CLASS_NOT_PREPARED"> 7236 <paramlink id="klass"></paramlink> is not prepared. 7237 </error> 7238 </errors> 7239 </function> 7240 7241 <function id="GetImplementedInterfaces" phase="start" num="54"> 7242 <synopsis>Get Implemented Interfaces</synopsis> 7243 <description> 7244 Return the direct super-interfaces of this class. For a class, this 7245 function returns the interfaces declared in its <code>implements</code> 7246 clause. For an interface, this function returns the interfaces declared in 7247 its <code>extends</code> clause. 7248 An empty interface list is returned for array classes and primitive classes 7249 (for example, <code>java.lang.Integer.TYPE</code>). 7250 </description> 7251 <origin>jvmdi</origin> 7252 <capabilities> 7253 </capabilities> 7254 <parameters> 7255 <param id="klass"> 7256 <jclass/> 7257 <description> 7258 The class to query. 7259 </description> 7260 </param> 7261 <param id="interface_count_ptr"> 7262 <outptr><jint/></outptr> 7263 <description> 7264 On return, points to the number of interfaces. 7265 </description> 7266 </param> 7267 <param id="interfaces_ptr"> 7268 <allocbuf outcount="interface_count_ptr"><jclass/></allocbuf> 7269 <description> 7270 On return, points to the interface array. 7271 </description> 7272 </param> 7273 </parameters> 7274 <errors> 7275 <error id="JVMTI_ERROR_CLASS_NOT_PREPARED"> 7276 <paramlink id="klass"></paramlink> is not prepared. 7277 </error> 7278 </errors> 7279 </function> 7280 7281 <function id="GetClassVersionNumbers" phase="start" num="145" since="1.1"> 7282 <synopsis>Get Class Version Numbers</synopsis> 7283 <description> 7284 For the class indicated by <code>klass</code>, 7285 return the minor and major version numbers, 7286 as defined in 7287 <vmspec chapter="4"/>. 7288 </description> 7289 <origin>new</origin> 7290 <capabilities> 7291 </capabilities> 7292 <parameters> 7293 <param id="klass"> 7294 <jclass/> 7295 <description> 7296 The class to query. 7297 </description> 7298 </param> 7299 <param id="minor_version_ptr"> 7300 <outptr><jint/></outptr> 7301 <description> 7302 On return, points to the value of the 7303 <code>minor_version</code> item of the 7304 Class File Format. 7305 Note: to be consistent with the Class File Format, 7306 the minor version number is the first parameter. 7307 </description> 7308 </param> 7309 <param id="major_version_ptr"> 7310 <outptr><jint/></outptr> 7311 <description> 7312 On return, points to the value of the 7313 <code>major_version</code> item of the 7314 Class File Format. 7315 </description> 7316 </param> 7317 </parameters> 7318 <errors> 7319 <error id="JVMTI_ERROR_ABSENT_INFORMATION"> 7320 The class is a primitive or array class. 7321 </error> 7322 </errors> 7323 </function> 7324 7325 <function id="GetConstantPool" phase="start" num="146" since="1.1"> 7326 <synopsis>Get Constant Pool</synopsis> 7327 <description> 7328 For the class indicated by <code>klass</code>, 7329 return the raw bytes of the constant pool in the format of the 7330 <code>constant_pool</code> item of 7331 <vmspec chapter="4"/>. 7332 The format of the constant pool may differ between versions 7333 of the Class File Format, so, the 7334 <functionlink id="GetClassVersionNumbers">minor and major 7335 class version numbers</functionlink> should be checked for 7336 compatibility. 7337 <p/> 7338 The returned constant pool might not have the same layout or 7339 contents as the constant pool in the defining class file. 7340 The constant pool returned by GetConstantPool() may have 7341 more or fewer entries than the defining constant pool. 7342 Entries may be in a different order. 7343 The constant pool returned by GetConstantPool() will match the 7344 constant pool used by 7345 <functionlink id="GetBytecodes">GetBytecodes()</functionlink>. 7346 That is, the bytecodes returned by GetBytecodes() will have 7347 constant pool indices which refer to constant pool entries returned 7348 by GetConstantPool(). 7349 Note that since <functionlink id="RetransformClasses"/> 7350 and <functionlink id="RedefineClasses"/> can change 7351 the constant pool, the constant pool returned by this function 7352 can change accordingly. Thus, the correspondence between 7353 GetConstantPool() and GetBytecodes() does not hold if there 7354 is an intervening class retransformation or redefinition. 7355 The value of a constant pool entry used by a given bytecode will 7356 match that of the defining class file (even if the indices don't match). 7357 Constant pool entries which are not used directly or indirectly by 7358 bytecodes (for example, UTF-8 strings associated with annotations) are 7359 not required to exist in the returned constant pool. 7360 </description> 7361 <origin>new</origin> 7362 <capabilities> 7363 <required id="can_get_constant_pool"></required> 7364 </capabilities> 7365 <parameters> 7366 <param id="klass"> 7367 <jclass/> 7368 <description> 7369 The class to query. 7370 </description> 7371 </param> 7372 <param id="constant_pool_count_ptr"> 7373 <outptr><jint/></outptr> 7374 <description> 7375 On return, points to the number of entries 7376 in the constant pool table plus one. 7377 This corresponds to the <code>constant_pool_count</code> 7378 item of the Class File Format. 7379 </description> 7380 </param> 7381 <param id="constant_pool_byte_count_ptr"> 7382 <outptr><jint/></outptr> 7383 <description> 7384 On return, points to the number of bytes 7385 in the returned raw constant pool. 7386 </description> 7387 </param> 7388 <param id="constant_pool_bytes_ptr"> 7389 <allocbuf outcount="constant_pool_byte_count_ptr"><uchar/></allocbuf> 7390 <description> 7391 On return, points to the raw constant pool, that is the bytes 7392 defined by the <code>constant_pool</code> item of the 7393 Class File Format 7394 </description> 7395 </param> 7396 </parameters> 7397 <errors> 7398 <error id="JVMTI_ERROR_ABSENT_INFORMATION"> 7399 The class is a primitive or array class. 7400 </error> 7401 </errors> 7402 </function> 7403 7404 <function id="IsInterface" phase="start" num="55"> 7405 <synopsis>Is Interface</synopsis> 7406 <description> 7407 Determines whether a class object reference represents an interface. 7408 The <code>jboolean</code> result is 7409 <code>JNI_TRUE</code> if the "class" is actually an interface, 7410 <code>JNI_FALSE</code> otherwise. 7411 </description> 7412 <origin>jvmdi</origin> 7413 <capabilities> 7414 </capabilities> 7415 <parameters> 7416 <param id="klass"> 7417 <jclass/> 7418 <description> 7419 The class to query. 7420 </description> 7421 </param> 7422 <param id="is_interface_ptr"> 7423 <outptr><jboolean/></outptr> 7424 <description> 7425 On return, points to the boolean result of this function. 7426 7427 </description> 7428 </param> 7429 </parameters> 7430 <errors> 7431 </errors> 7432 </function> 7433 7434 <function id="IsArrayClass" phase="start" num="56"> 7435 <synopsis>Is Array Class</synopsis> 7436 <description> 7437 Determines whether a class object reference represents an array. 7438 The <code>jboolean</code> result is 7439 <code>JNI_TRUE</code> if the class is an array, 7440 <code>JNI_FALSE</code> otherwise. 7441 </description> 7442 <origin>jvmdi</origin> 7443 <capabilities> 7444 </capabilities> 7445 <parameters> 7446 <param id="klass"> 7447 <jclass/> 7448 <description> 7449 The class to query. 7450 </description> 7451 </param> 7452 <param id="is_array_class_ptr"> 7453 <outptr><jboolean/></outptr> 7454 <description> 7455 On return, points to the boolean result of this function. 7456 7457 </description> 7458 </param> 7459 </parameters> 7460 <errors> 7461 </errors> 7462 </function> 7463 7464 <function id="IsModifiableClass" jkernel="yes" phase="start" num="45" since="1.1"> 7465 <synopsis>Is Modifiable Class</synopsis> 7466 <description> 7467 Determines whether a class is modifiable. 7468 If a class is modifiable (<paramlink id="is_modifiable_class_ptr"/> 7469 returns <code>JNI_TRUE</code>) the class can be 7470 redefined with <functionlink id="RedefineClasses"/> (assuming 7471 the agent possesses the 7472 <fieldlink id="can_redefine_classes" struct="jvmtiCapabilities"/> 7473 capability) or 7474 retransformed with <functionlink id="RetransformClasses"/> (assuming 7475 the agent possesses the 7476 <fieldlink id="can_retransform_classes" struct="jvmtiCapabilities"/> 7477 capability). 7478 If a class is not modifiable (<paramlink id="is_modifiable_class_ptr"/> 7479 returns <code>JNI_FALSE</code>) the class can be neither 7480 redefined nor retransformed. 7481 <p/> 7482 Primitive classes (for example, <code>java.lang.Integer.TYPE</code>), 7483 array classes, and some implementation defined classes are never modifiable. 7484 <p/> 7485 </description> 7486 <origin>new</origin> 7487 <capabilities> 7488 <capability id="can_redefine_any_class"> 7489 If possessed then all classes (except primitive, array, and some implementation defined 7490 classes) are modifiable with <functionlink id="RedefineClasses"/>. 7491 </capability> 7492 <capability id="can_retransform_any_class"> 7493 If possessed then all classes (except primitive, array, and some implementation defined 7494 classes) are modifiable with <functionlink id="RetransformClasses"/>. 7495 </capability> 7496 <capability id="can_redefine_classes"> 7497 No effect on the result of the function. 7498 But must additionally be possessed to modify the class with 7499 <functionlink id="RedefineClasses"/>. 7500 </capability> 7501 <capability id="can_retransform_classes"> 7502 No effect on the result of the function. 7503 But must additionally be possessed to modify the class with 7504 <functionlink id="RetransformClasses"/>. 7505 </capability> 7506 </capabilities> 7507 <parameters> 7508 <param id="klass"> 7509 <jclass/> 7510 <description> 7511 The class to query. 7512 </description> 7513 </param> 7514 <param id="is_modifiable_class_ptr"> 7515 <outptr><jboolean/></outptr> 7516 <description> 7517 On return, points to the boolean result of this function. 7518 </description> 7519 </param> 7520 </parameters> 7521 <errors> 7522 </errors> 7523 </function> 7524 7525 <function id="GetClassLoader" phase="start" num="57"> 7526 <synopsis>Get Class Loader</synopsis> 7527 <description> 7528 For the class indicated by <code>klass</code>, return via 7529 <code>classloader_ptr</code> a reference to the class loader for the 7530 class. 7531 </description> 7532 <origin>jvmdi</origin> 7533 <capabilities> 7534 </capabilities> 7535 <parameters> 7536 <param id="klass"> 7537 <jclass/> 7538 <description> 7539 The class to query. 7540 </description> 7541 </param> 7542 <param id="classloader_ptr"> 7543 <outptr><jobject/></outptr> 7544 <description> 7545 On return, points to the class loader that loaded 7546 this class. 7547 If the class was not created by a class loader 7548 or if the class loader is the bootstrap class loader, 7549 points to <code>NULL</code>. 7550 </description> 7551 </param> 7552 </parameters> 7553 <errors> 7554 </errors> 7555 7556 </function> 7557 7558 <function id="GetSourceDebugExtension" phase="start" num="90"> 7559 <synopsis>Get Source Debug Extension</synopsis> 7560 <description> 7561 For the class indicated by <code>klass</code>, return the debug 7562 extension via <code>source_debug_extension_ptr</code>. 7563 The returned string 7564 contains exactly the debug extension information present in the 7565 class file of <code>klass</code>. 7566 </description> 7567 <origin>jvmdi</origin> 7568 <capabilities> 7569 <required id="can_get_source_debug_extension"></required> 7570 </capabilities> 7571 <parameters> 7572 <param id="klass"> 7573 <jclass/> 7574 <description> 7575 The class to query. 7576 </description> 7577 </param> 7578 <param id="source_debug_extension_ptr"> 7579 <allocbuf><char/></allocbuf> 7580 <description> 7581 On return, points to the class's debug extension, encoded as a 7582 <internallink id="mUTF">modified UTF-8</internallink> string. 7583 </description> 7584 </param> 7585 </parameters> 7586 <errors> 7587 <error id="JVMTI_ERROR_ABSENT_INFORMATION"> 7588 Class information does not include a debug extension. 7589 </error> 7590 </errors> 7591 </function> 7592 7593 <function id="RetransformClasses" jkernel="yes" num="152" since="1.1"> 7594 <synopsis>Retransform Classes</synopsis> 7595 <description> 7596 This function facilitates the 7597 <internallink id="bci">bytecode instrumentation</internallink> 7598 of already loaded classes. 7599 To replace the class definition without reference to the existing 7600 bytecodes, as one might do when recompiling from source for 7601 fix-and-continue debugging, <functionlink id="RedefineClasses"/> 7602 function should be used instead. 7603 <p/> 7604 When classes are initially loaded or when they are 7605 <functionlink id="RedefineClasses">redefined</functionlink>, 7606 the initial class file bytes can be transformed with the 7607 <eventlink id="ClassFileLoadHook"/> event. 7608 This function reruns the transformation process 7609 (whether or not a transformation has previously occurred). 7610 This retransformation follows these steps: 7611 <ul> 7612 <li>starting from the initial class file bytes 7613 </li> 7614 <li>for each <fieldlink id="can_retransform_classes" 7615 struct="jvmtiCapabilities">retransformation 7616 incapable</fieldlink> 7617 agent which received a 7618 <code>ClassFileLoadHook</code> event during the previous 7619 load or redefine, the bytes it returned 7620 (via the <code>new_class_data</code> parameter) 7621 are reused as the output of the transformation; 7622 note that this is equivalent to reapplying 7623 the previous transformation, unaltered. except that 7624 the <code>ClassFileLoadHook</code> event 7625 is <b>not</b> sent to these agents 7626 </li> 7627 <li>for each <fieldlink id="can_retransform_classes" 7628 struct="jvmtiCapabilities">retransformation 7629 capable</fieldlink> 7630 agent, the <code>ClassFileLoadHook</code> event is sent, 7631 allowing a new transformation to be applied 7632 </li> 7633 <li>the transformed class file bytes are installed as the new 7634 definition of the class 7635 </li> 7636 </ul> 7637 See the <eventlink id="ClassFileLoadHook"/> event for more details. 7638 <p/> 7639 The initial class file bytes represent the bytes passed to 7640 <code>ClassLoader.defineClass</code> 7641 or <code>RedefineClasses</code> (before any transformations 7642 were applied), however they may not exactly match them. 7643 The constant pool may differ in ways described in 7644 <functionlink id="GetConstantPool"/>. 7645 Constant pool indices in the bytecodes of methods will correspond. 7646 Some attributes may not be present. 7647 Where order is not meaningful, for example the order of methods, 7648 order may not be preserved. 7649 <p/> 7650 Retransformation can cause new versions of methods to be installed. 7651 Old method versions may become 7652 <internallink id="obsoleteMethods">obsolete</internallink> 7653 The new method version will be used on new invokes. 7654 If a method has active stack frames, those active frames continue to 7655 run the bytecodes of the original method version. 7656 <p/> 7657 This function does not cause any initialization except that which 7658 would occur under the customary JVM semantics. 7659 In other words, retransforming a class does not cause its initializers to be 7660 run. The values of static fields will remain as they were 7661 prior to the call. 7662 <p/> 7663 Threads need not be suspended. 7664 <p/> 7665 All breakpoints in the class are cleared. 7666 <p/> 7667 All attributes are updated. 7668 <p/> 7669 Instances of the retransformed class are not affected -- fields retain their 7670 previous values. 7671 <functionlink id="GetTag">Tags</functionlink> on the instances are 7672 also unaffected. 7673 <p/> 7674 In response to this call, no events other than the 7675 <eventlink id="ClassFileLoadHook"/> event 7676 will be sent. 7677 <p/> 7678 The retransformation may change method bodies, the constant pool and attributes 7679 (unless explicitly prohibited). 7680 The retransformation must not add, remove or rename fields or methods, change the 7681 signatures of methods, change modifiers, or change inheritance. 7682 The retransformation must not change the <code>NestHost</code>, 7683 <code>NestMembers</code>, or <code>Record</code> attributes. 7684 These restrictions may be lifted in future versions. 7685 See the error return description below for information on error codes 7686 returned if an unsupported retransformation is attempted. 7687 The class file bytes are not verified or installed until they have passed 7688 through the chain of <eventlink id="ClassFileLoadHook"/> events, thus the 7689 returned error code reflects the result of the transformations. 7690 If any error code is returned other than <code>JVMTI_ERROR_NONE</code>, 7691 none of the classes to be retransformed will have a new definition installed. 7692 When this function returns (with the error code of <code>JVMTI_ERROR_NONE</code>) 7693 all of the classes to be retransformed will have their new definitions installed. 7694 </description> 7695 <origin>new</origin> 7696 <capabilities> 7697 <required id="can_retransform_classes"></required> 7698 <capability id="can_retransform_any_class"></capability> 7699 </capabilities> 7700 <parameters> 7701 <param id="class_count"> 7702 <jint min="0"/> 7703 <description> 7704 The number of classes to be retransformed. 7705 </description> 7706 </param> 7707 <param id="classes"> 7708 <inbuf incount="class_count"><jclass/></inbuf> 7709 <description> 7710 The array of classes to be retransformed. 7711 </description> 7712 </param> 7713 </parameters> 7714 <errors> 7715 <error id="JVMTI_ERROR_UNMODIFIABLE_CLASS"> 7716 One of the <paramlink id="classes"/> cannot be modified. 7717 See <functionlink id="IsModifiableClass"/>. 7718 </error> 7719 <error id="JVMTI_ERROR_INVALID_CLASS"> 7720 One of the <paramlink id="classes"/> is not a valid class. 7721 </error> 7722 <error id="JVMTI_ERROR_UNSUPPORTED_VERSION"> 7723 A retransformed class file has a version number not supported by this VM. 7724 </error> 7725 <error id="JVMTI_ERROR_INVALID_CLASS_FORMAT"> 7726 A retransformed class file is malformed (The VM would return a <code>ClassFormatError</code>). 7727 </error> 7728 <error id="JVMTI_ERROR_CIRCULAR_CLASS_DEFINITION"> 7729 The retransformed class file definitions would lead to a circular definition 7730 (the VM would return a <code>ClassCircularityError</code>). 7731 </error> 7732 <error id="JVMTI_ERROR_FAILS_VERIFICATION"> 7733 The retransformed class file bytes fail verification. 7734 </error> 7735 <error id="JVMTI_ERROR_NAMES_DONT_MATCH"> 7736 The class name defined in a retransformed class file is 7737 different from the name in the old class object. 7738 </error> 7739 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_ADDED"> 7740 A retransformed class file would require adding a method. 7741 </error> 7742 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED"> 7743 A retransformed class file changes a field. 7744 </error> 7745 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED"> 7746 A direct superclass is different for a retransformed class file, 7747 or the set of directly implemented 7748 interfaces is different. 7749 </error> 7750 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_DELETED"> 7751 A retransformed class file does not declare a method 7752 declared in the old class version. 7753 </error> 7754 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_ATTRIBUTE_CHANGED"> 7755 A retransformed class file has unsupported differences in class attributes. 7756 </error> 7757 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED"> 7758 A retransformed class file has different class modifiers. 7759 </error> 7760 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED"> 7761 A method in the retransformed class file has different modifiers 7762 than its counterpart in the old class version. 7763 </error> 7764 </errors> 7765 </function> 7766 7767 <function id="RedefineClasses" jkernel="yes" num="87"> 7768 <synopsis>Redefine Classes</synopsis> 7769 <typedef id="jvmtiClassDefinition" label="Class redefinition description"> 7770 <field id="klass"> 7771 <jclass/> 7772 <description> 7773 Class object for this class 7774 </description> 7775 </field> 7776 <field id="class_byte_count"> 7777 <jint/> 7778 <description> 7779 Number of bytes defining class (below) 7780 </description> 7781 </field> 7782 <field id="class_bytes"> 7783 <inbuf incount="class_byte_count"><uchar/></inbuf> 7784 <description> 7785 Bytes defining class (in <vmspec chapter="4"/>) 7786 </description> 7787 </field> 7788 </typedef> 7789 <description> 7790 All classes given are redefined according to the definitions 7791 supplied. 7792 This function is used to replace the definition of a class 7793 with a new definition, as might be needed in fix-and-continue 7794 debugging. 7795 Where the existing class file bytes are to be transformed, for 7796 example in 7797 <internallink id="bci">bytecode instrumentation</internallink>, 7798 <functionlink id="RetransformClasses"/> should be used. 7799 <p/> 7800 Redefinition can cause new versions of methods to be installed. 7801 Old method versions may become 7802 <internallink id="obsoleteMethods">obsolete</internallink> 7803 The new method version will be used on new invokes. 7804 If a method has active stack frames, those active frames continue to 7805 run the bytecodes of the original method version. 7806 If resetting of stack frames is desired, use 7807 <functionlink id="PopFrame"></functionlink> 7808 to pop frames with obsolete method versions. 7809 <p/> 7810 This function does not cause any initialization except that which 7811 would occur under the customary JVM semantics. 7812 In other words, redefining a class does not cause its initializers to be 7813 run. The values of static fields will remain as they were 7814 prior to the call. 7815 <p/> 7816 Threads need not be suspended. 7817 <p/> 7818 All breakpoints in the class are cleared. 7819 <p/> 7820 All attributes are updated. 7821 <p/> 7822 Instances of the redefined class are not affected -- fields retain their 7823 previous values. 7824 <functionlink id="GetTag">Tags</functionlink> on the instances are 7825 also unaffected. 7826 <p/> 7827 In response to this call, the <jvmti/> event 7828 <eventlink id="ClassFileLoadHook">Class File Load Hook</eventlink> 7829 will be sent (if enabled), but no other <jvmti/> events will be sent. 7830 <p/> 7831 The redefinition may change method bodies, the constant pool and attributes 7832 (unless explicitly prohibited). 7833 The redefinition must not add, remove or rename fields or methods, change the 7834 signatures of methods, change modifiers, or change inheritance. 7835 The redefinition must not change the <code>NestHost</code>, 7836 <code>NestMembers</code>, or <code>Record</code> attributes. 7837 These restrictions may be lifted in future versions. 7838 See the error return description below for information on error codes 7839 returned if an unsupported redefinition is attempted. 7840 The class file bytes are not verified or installed until they have passed 7841 through the chain of <eventlink id="ClassFileLoadHook"/> events, thus the 7842 returned error code reflects the result of the transformations applied 7843 to the bytes passed into <paramlink id="class_definitions"/>. 7844 If any error code is returned other than <code>JVMTI_ERROR_NONE</code>, 7845 none of the classes to be redefined will have a new definition installed. 7846 When this function returns (with the error code of <code>JVMTI_ERROR_NONE</code>) 7847 all of the classes to be redefined will have their new definitions installed. 7848 </description> 7849 <origin>jvmdi</origin> 7850 <capabilities> 7851 <required id="can_redefine_classes"></required> 7852 <capability id="can_redefine_any_class"></capability> 7853 </capabilities> 7854 <parameters> 7855 <param id="class_count"> 7856 <jint min="0"/> 7857 <description> 7858 The number of classes specified in <code>class_definitions</code> 7859 </description> 7860 </param> 7861 <param id="class_definitions"> 7862 <inbuf incount="class_count"><struct>jvmtiClassDefinition</struct></inbuf> 7863 <description> 7864 The array of new class definitions 7865 </description> 7866 </param> 7867 </parameters> 7868 <errors> 7869 <error id="JVMTI_ERROR_NULL_POINTER"> 7870 One of <code>class_bytes</code> is <code>NULL</code>. 7871 </error> 7872 <error id="JVMTI_ERROR_UNMODIFIABLE_CLASS"> 7873 An element of <code>class_definitions</code> cannot be modified. 7874 See <functionlink id="IsModifiableClass"/>. 7875 </error> 7876 <error id="JVMTI_ERROR_INVALID_CLASS"> 7877 An element of <code>class_definitions</code> is not a valid class. 7878 </error> 7879 <error id="JVMTI_ERROR_UNSUPPORTED_VERSION"> 7880 A new class file has a version number not supported by this VM. 7881 </error> 7882 <error id="JVMTI_ERROR_INVALID_CLASS_FORMAT"> 7883 A new class file is malformed (The VM would return a <code>ClassFormatError</code>). 7884 </error> 7885 <error id="JVMTI_ERROR_CIRCULAR_CLASS_DEFINITION"> 7886 The new class file definitions would lead to a circular definition 7887 (the VM would return a <code>ClassCircularityError</code>). 7888 </error> 7889 <error id="JVMTI_ERROR_FAILS_VERIFICATION"> 7890 The class bytes fail verification. 7891 </error> 7892 <error id="JVMTI_ERROR_NAMES_DONT_MATCH"> 7893 The class name defined in a new class file is 7894 different from the name in the old class object. 7895 </error> 7896 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_ADDED"> 7897 A new class file would require adding a method. 7898 </error> 7899 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED"> 7900 A new class version changes a field. 7901 </error> 7902 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED"> 7903 A direct superclass is different for a new class 7904 version, or the set of directly implemented 7905 interfaces is different. 7906 </error> 7907 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_DELETED"> 7908 A new class version does not declare a method 7909 declared in the old class version. 7910 </error> 7911 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_ATTRIBUTE_CHANGED"> 7912 A new class version has unsupported differences in class attributes. 7913 </error> 7914 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED"> 7915 A new class version has different modifiers. 7916 </error> 7917 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED"> 7918 A method in the new class version has different modifiers 7919 than its counterpart in the old class version. 7920 </error> 7921 <error id="JVMTI_ERROR_UNMODIFIABLE_MODULE"> 7922 A module cannot be modified. 7923 See <functionlink id="IsModifiableModule"/>. 7924 </error> 7925 </errors> 7926 </function> 7927 7928 </category> 7929 7930 <category id="object" label="Object"> 7931 7932 <function id="GetObjectSize" jkernel="yes" phase="start" num="154"> 7933 <synopsis>Get Object Size</synopsis> 7934 <description> 7935 For the object indicated by <code>object</code>, 7936 return via <code>size_ptr</code> the size of the object. 7937 This size is an implementation-specific approximation of 7938 the amount of storage consumed by this object. 7939 It may include some or all of the object's overhead, and thus 7940 is useful for comparison within an implementation but not 7941 between implementations. 7942 The estimate may change during a single invocation of the JVM. 7943 </description> 7944 <origin>new</origin> 7945 <capabilities> 7946 </capabilities> 7947 <parameters> 7948 <param id="object"> 7949 <jobject/> 7950 <description> 7951 The object to query. 7952 </description> 7953 </param> 7954 <param id="size_ptr"> 7955 <outptr><jlong/></outptr> 7956 <description> 7957 On return, points to the object's size in bytes. 7958 </description> 7959 </param> 7960 </parameters> 7961 <errors> 7962 </errors> 7963 </function> 7964 7965 <function id="GetObjectHashCode" phase="start" num="58"> 7966 <synopsis>Get Object Hash Code</synopsis> 7967 <description> 7968 For the object indicated by <code>object</code>, 7969 return via <code>hash_code_ptr</code> a hash code. 7970 This hash code could be used to maintain a hash table of object references, 7971 however, on some implementations this can cause significant performance 7972 impacts--in most cases 7973 <internallink id="Heap">tags</internallink> 7974 will be a more efficient means of associating information with objects. 7975 This function guarantees 7976 the same hash code value for a particular object throughout its life 7977 </description> 7978 <origin>jvmdi</origin> 7979 <capabilities> 7980 </capabilities> 7981 <parameters> 7982 <param id="object"> 7983 <jobject/> 7984 <description> 7985 The object to query. 7986 </description> 7987 </param> 7988 <param id="hash_code_ptr"> 7989 <outptr><jint/></outptr> 7990 <description> 7991 On return, points to the object's hash code. 7992 </description> 7993 </param> 7994 </parameters> 7995 <errors> 7996 </errors> 7997 </function> 7998 7999 <function id="GetObjectMonitorUsage" num="59"> 8000 <synopsis>Get Object Monitor Usage</synopsis> 8001 <typedef id="jvmtiMonitorUsage" label="Object monitor usage information"> 8002 <field id="owner"> 8003 <jthread/> 8004 <description> 8005 The thread owning this monitor, or <code>NULL</code> if unused 8006 </description> 8007 </field> 8008 <field id="entry_count"> 8009 <jint/> 8010 <description> 8011 The number of times the owning thread has entered the monitor 8012 </description> 8013 </field> 8014 <field id="waiter_count"> 8015 <jint/> 8016 <description> 8017 The number of threads waiting to own this monitor 8018 </description> 8019 </field> 8020 <field id="waiters"> 8021 <allocfieldbuf><jthread/></allocfieldbuf> 8022 <description> 8023 The <code>waiter_count</code> waiting threads 8024 </description> 8025 </field> 8026 <field id="notify_waiter_count"> 8027 <jint/> 8028 <description> 8029 The number of threads waiting to be notified by this monitor 8030 </description> 8031 </field> 8032 <field id="notify_waiters"> 8033 <allocfieldbuf><jthread/></allocfieldbuf> 8034 <description> 8035 The <code>notify_waiter_count</code> threads waiting to be notified 8036 </description> 8037 </field> 8038 </typedef> 8039 <description> 8040 Get information about the object's monitor. 8041 The fields of the <functionlink id="jvmtiMonitorUsage"></functionlink> structure 8042 are filled in with information about usage of the monitor. 8043 <todo> 8044 Decide and then clarify suspend requirements. 8045 </todo> 8046 </description> 8047 <origin>jvmdi</origin> 8048 <capabilities> 8049 <required id="can_get_monitor_info"></required> 8050 </capabilities> 8051 <parameters> 8052 <param id="object"> 8053 <jobject/> 8054 <description> 8055 The object to query. 8056 </description> 8057 </param> 8058 <param id="info_ptr"> 8059 <outptr><struct>jvmtiMonitorUsage</struct></outptr> 8060 <description> 8061 On return, filled with monitor information for the 8062 specified object. 8063 </description> 8064 </param> 8065 </parameters> 8066 <errors> 8067 </errors> 8068 </function> 8069 8070 <elide> 8071 <function id="GetObjectMonitors" num="116"> 8072 <synopsis>Get Object Monitors</synopsis> 8073 <description> 8074 Return the list of object monitors. 8075 <p/> 8076 Note: details about each monitor can be examined with 8077 <functionlink id="GetObjectMonitorUsage"></functionlink>. 8078 </description> 8079 <origin>new</origin> 8080 <capabilities> 8081 <required id="can_get_monitor_info"></required> 8082 </capabilities> 8083 <parameters> 8084 <param id="monitorCnt"> 8085 <outptr><jint/></outptr> 8086 <description> 8087 On return, pointer to the number 8088 of monitors returned in <code>monitors_ptr</code>. 8089 </description> 8090 </param> 8091 <param id="monitors_ptr"> 8092 <allocbuf outcount="monitorCnt"><jobject/></allocbuf> 8093 <description> 8094 On return, pointer to the monitor list. 8095 </description> 8096 </param> 8097 </parameters> 8098 <errors> 8099 </errors> 8100 </function> 8101 </elide> 8102 8103 </category> 8104 8105 <category id="fieldCategory" label="Field"> 8106 8107 <intro> 8108 </intro> 8109 8110 <function id="GetFieldName" phase="start" num="60"> 8111 <synopsis>Get Field Name (and Signature)</synopsis> 8112 <description> 8113 For the field indicated by <paramlink id="klass"/> and <paramlink id="field"/>, 8114 return the field name via <paramlink id="name_ptr"/> and field signature via 8115 <paramlink id="signature_ptr"/>. 8116 <p/> 8117 Field signatures are defined in the 8118 <externallink id="jni/index.html">JNI Specification</externallink> 8119 and are referred to as <code>field descriptors</code> in 8120 <vmspec chapter="4.3.2"/>. 8121 </description> 8122 <origin>jvmdiClone</origin> 8123 <capabilities> 8124 </capabilities> 8125 <parameters> 8126 <param id="klass"> 8127 <jclass field="field"/> 8128 <description> 8129 The class of the field to query. 8130 </description> 8131 </param> 8132 <param id="field"> 8133 <jfieldID class="klass"/> 8134 <description> 8135 The field to query. 8136 </description> 8137 </param> 8138 <param id="name_ptr"> 8139 <allocbuf> 8140 <char/> 8141 <nullok>the name is not returned</nullok> 8142 </allocbuf> 8143 <description> 8144 On return, points to the field name, encoded as a 8145 <internallink id="mUTF">modified UTF-8</internallink> string. 8146 </description> 8147 </param> 8148 <param id="signature_ptr"> 8149 <allocbuf> 8150 <char/> 8151 <nullok>the signature is not returned</nullok> 8152 </allocbuf> 8153 <description> 8154 On return, points to the field signature, encoded as a 8155 <internallink id="mUTF">modified UTF-8</internallink> string. 8156 </description> 8157 </param> 8158 <param id="generic_ptr"> 8159 <allocbuf> 8160 <char/> 8161 <nullok>the generic signature is not returned</nullok> 8162 </allocbuf> 8163 <description> 8164 On return, points to the generic signature of the field, encoded as a 8165 <internallink id="mUTF">modified UTF-8</internallink> string. 8166 If there is no generic signature attribute for the field, then, 8167 on return, points to <code>NULL</code>. 8168 </description> 8169 </param> 8170 </parameters> 8171 <errors> 8172 </errors> 8173 </function> 8174 8175 <function id="GetFieldDeclaringClass" phase="start" num="61"> 8176 <synopsis>Get Field Declaring Class</synopsis> 8177 <description> 8178 For the field indicated by <code>klass</code> and <code>field</code> 8179 return the class that defined it via <code>declaring_class_ptr</code>. 8180 The declaring class will either be <code>klass</code>, a superclass, or 8181 an implemented interface. 8182 </description> 8183 <origin>jvmdi</origin> 8184 <capabilities> 8185 </capabilities> 8186 <parameters> 8187 <param id="klass"> 8188 <jclass field="field"/> 8189 <description> 8190 The class to query. 8191 </description> 8192 </param> 8193 <param id="field"> 8194 <jfieldID class="klass"/> 8195 <description> 8196 The field to query. 8197 </description> 8198 </param> 8199 <param id="declaring_class_ptr"> 8200 <outptr><jclass/></outptr> 8201 <description> 8202 On return, points to the declaring class 8203 </description> 8204 </param> 8205 </parameters> 8206 <errors> 8207 </errors> 8208 </function> 8209 8210 <function id="GetFieldModifiers" phase="start" num="62"> 8211 <synopsis>Get Field Modifiers</synopsis> 8212 <description> 8213 For the field indicated by <code>klass</code> and <code>field</code> 8214 return the access flags via <code>modifiers_ptr</code>. 8215 Access flags are defined in <vmspec chapter="4"/>. 8216 </description> 8217 <origin>jvmdi</origin> 8218 <capabilities> 8219 </capabilities> 8220 <parameters> 8221 <param id="klass"> 8222 <jclass field="field"/> 8223 <description> 8224 The class to query. 8225 </description> 8226 </param> 8227 <param id="field"> 8228 <jfieldID class="klass"/> 8229 <description> 8230 The field to query. 8231 </description> 8232 </param> 8233 <param id="modifiers_ptr"> 8234 <outptr><jint/></outptr> 8235 <description> 8236 On return, points to the access flags. 8237 </description> 8238 </param> 8239 </parameters> 8240 <errors> 8241 </errors> 8242 </function> 8243 8244 <function id="IsFieldSynthetic" phase="start" num="63"> 8245 <synopsis>Is Field Synthetic</synopsis> 8246 <description> 8247 For the field indicated by <code>klass</code> and <code>field</code>, return a 8248 value indicating whether the field is synthetic via <code>is_synthetic_ptr</code>. 8249 Synthetic fields are generated by the compiler but not present in the 8250 original source code. 8251 </description> 8252 <origin>jvmdi</origin> 8253 <capabilities> 8254 <required id="can_get_synthetic_attribute"></required> 8255 </capabilities> 8256 <parameters> 8257 <param id="klass"> 8258 <jclass field="field"/> 8259 <description> 8260 The class of the field to query. 8261 </description> 8262 </param> 8263 <param id="field"> 8264 <jfieldID class="klass"/> 8265 <description> 8266 The field to query. 8267 </description> 8268 </param> 8269 <param id="is_synthetic_ptr"> 8270 <outptr><jboolean/></outptr> 8271 <description> 8272 On return, points to the boolean result of this function. 8273 </description> 8274 </param> 8275 </parameters> 8276 <errors> 8277 </errors> 8278 </function> 8279 8280 </category> 8281 8282 <category id="method" label="Method"> 8283 8284 <intro> 8285 These functions provide information about a method (represented as a 8286 <typelink id="jmethodID"/>) and set how methods are processed. 8287 </intro> 8288 8289 <intro id="obsoleteMethods" label="Obsolete Methods"> 8290 The functions <functionlink id="RetransformClasses"/> and 8291 <functionlink id="RedefineClasses"/> can cause new versions 8292 of methods to be installed. 8293 An original version of a method is considered equivalent 8294 to the new version if: 8295 <ul> 8296 <li>their bytecodes are the same except for indices into the 8297 constant pool and </li> 8298 <li>the referenced constants are equal.</li> 8299 </ul> 8300 An original method version which is not equivalent to the 8301 new method version is called obsolete and is assigned a new method ID; 8302 the original method ID now refers to the new method version. 8303 A method ID can be tested for obsolescence with 8304 <functionlink id="IsMethodObsolete"/>. 8305 </intro> 8306 8307 <function id="GetMethodName" phase="start" num="64"> 8308 <synopsis>Get Method Name (and Signature)</synopsis> 8309 <description> 8310 For the method indicated by <code>method</code>, 8311 return the method name via <code>name_ptr</code> and method signature via 8312 <code>signature_ptr</code>. 8313 <p/> 8314 Method signatures are defined in the 8315 <externallink id="jni/index.html">JNI Specification</externallink> 8316 and are referred to as <code>method descriptors</code> in 8317 <vmspec chapter="4.3.3"/>. 8318 Note this is different 8319 than method signatures as defined in the <i>Java Language Specification</i>. 8320 </description> 8321 <origin>jvmdiClone</origin> 8322 <capabilities> 8323 </capabilities> 8324 <parameters> 8325 <param id="method"> 8326 <jmethodID/> 8327 <description> 8328 The method to query. 8329 </description> 8330 </param> 8331 <param id="name_ptr"> 8332 <allocbuf> 8333 <char/> 8334 <nullok>the name is not returned</nullok> 8335 </allocbuf> 8336 <description> 8337 On return, points to the method name, encoded as a 8338 <internallink id="mUTF">modified UTF-8</internallink> string. 8339 </description> 8340 </param> 8341 <param id="signature_ptr"> 8342 <allocbuf> 8343 <char/> 8344 <nullok>the signature is not returned</nullok> 8345 </allocbuf> 8346 <description> 8347 On return, points to the method signature, encoded as a 8348 <internallink id="mUTF">modified UTF-8</internallink> string. 8349 </description> 8350 </param> 8351 <param id="generic_ptr"> 8352 <allocbuf> 8353 <char/> 8354 <nullok>the generic signature is not returned</nullok> 8355 </allocbuf> 8356 <description> 8357 On return, points to the generic signature of the method, encoded as a 8358 <internallink id="mUTF">modified UTF-8</internallink> string. 8359 If there is no generic signature attribute for the method, then, 8360 on return, points to <code>NULL</code>. 8361 </description> 8362 </param> 8363 </parameters> 8364 <errors> 8365 </errors> 8366 </function> 8367 8368 <function id="GetMethodDeclaringClass" phase="start" num="65"> 8369 <synopsis>Get Method Declaring Class</synopsis> 8370 <description> 8371 For the method indicated by <code>method</code>, 8372 return the class that defined it via <code>declaring_class_ptr</code>. 8373 </description> 8374 <origin>jvmdi</origin> 8375 <capabilities> 8376 </capabilities> 8377 <parameters> 8378 <param id="klass"> 8379 <jclass method="method"/> 8380 <description> 8381 The class to query. 8382 </description> 8383 </param> 8384 <param id="method"> 8385 <jmethodID class="klass"/> 8386 <description> 8387 The method to query. 8388 </description> 8389 </param> 8390 <param id="declaring_class_ptr"> 8391 <outptr><jclass/></outptr> 8392 <description> 8393 On return, points to the declaring class 8394 </description> 8395 </param> 8396 </parameters> 8397 <errors> 8398 </errors> 8399 </function> 8400 8401 <function id="GetMethodModifiers" phase="start" num="66"> 8402 <synopsis>Get Method Modifiers</synopsis> 8403 <description> 8404 For the method indicated by <code>method</code>, 8405 return the access flags via <code>modifiers_ptr</code>. 8406 Access flags are defined in <vmspec chapter="4"/>. 8407 </description> 8408 <origin>jvmdi</origin> 8409 <capabilities> 8410 </capabilities> 8411 <parameters> 8412 <param id="klass"> 8413 <jclass method="method"/> 8414 <description> 8415 The class to query. 8416 </description> 8417 </param> 8418 <param id="method"> 8419 <jmethodID class="klass"/> 8420 <description> 8421 The method to query. 8422 </description> 8423 </param> 8424 <param id="modifiers_ptr"> 8425 <outptr><jint/></outptr> 8426 <description> 8427 On return, points to the access flags. 8428 </description> 8429 </param> 8430 </parameters> 8431 <errors> 8432 </errors> 8433 </function> 8434 8435 <function id="GetMaxLocals" phase="start" num="68"> 8436 <synopsis>Get Max Locals</synopsis> 8437 <description> 8438 For the method indicated by <code>method</code>, 8439 return the number of local variable slots used by the method, 8440 including the local variables used to pass parameters to the 8441 method on its invocation. 8442 <p/> 8443 See <code>max_locals</code> in <vmspec chapter="4.7.3"/>. 8444 </description> 8445 <origin>jvmdi</origin> 8446 <capabilities> 8447 </capabilities> 8448 <parameters> 8449 <param id="klass"> 8450 <jclass method="method"/> 8451 <description> 8452 The class to query. 8453 </description> 8454 </param> 8455 <param id="method"> 8456 <jmethodID class="klass" native="error"/> 8457 <description> 8458 The method to query. 8459 </description> 8460 </param> 8461 <param id="max_ptr"> 8462 <outptr><jint/></outptr> 8463 <description> 8464 On return, points to the maximum number of local slots 8465 </description> 8466 </param> 8467 </parameters> 8468 <errors> 8469 </errors> 8470 </function> 8471 8472 <function id="GetArgumentsSize" phase="start" num="69"> 8473 <synopsis>Get Arguments Size</synopsis> 8474 <description> 8475 For the method indicated by <code>method</code>, 8476 return via <code>max_ptr</code> the number of local variable slots used 8477 by the method's arguments. 8478 Note that two-word arguments use two slots. 8479 </description> 8480 <origin>jvmdi</origin> 8481 <capabilities> 8482 </capabilities> 8483 <parameters> 8484 <param id="klass"> 8485 <jclass method="method"/> 8486 <description> 8487 The class to query. 8488 </description> 8489 </param> 8490 <param id="method"> 8491 <jmethodID class="klass" native="error"/> 8492 <description> 8493 The method to query. 8494 </description> 8495 </param> 8496 <param id="size_ptr"> 8497 <outptr><jint/></outptr> 8498 <description> 8499 On return, points to the number of argument slots 8500 </description> 8501 </param> 8502 </parameters> 8503 <errors> 8504 </errors> 8505 </function> 8506 8507 <function id="GetLineNumberTable" phase="start" num="70"> 8508 <synopsis>Get Line Number Table</synopsis> 8509 <typedef id="jvmtiLineNumberEntry" label="Line number table entry"> 8510 <field id="start_location"> 8511 <jlocation/> 8512 <description> 8513 the <datalink id="jlocation"></datalink> where the line begins 8514 </description> 8515 </field> 8516 <field id="line_number"> 8517 <jint/> 8518 <description> 8519 the line number 8520 </description> 8521 </field> 8522 </typedef> 8523 <description> 8524 For the method indicated by <code>method</code>, 8525 return a table of source line number entries. The size of the table is 8526 returned via <code>entry_count_ptr</code> and the table itself is 8527 returned via <code>table_ptr</code>. 8528 </description> 8529 <origin>jvmdi</origin> 8530 <capabilities> 8531 <required id="can_get_line_numbers"></required> 8532 </capabilities> 8533 <parameters> 8534 <param id="klass"> 8535 <jclass method="method"/> 8536 <description> 8537 The class to query. 8538 </description> 8539 </param> 8540 <param id="method"> 8541 <jmethodID class="klass" native="error"/> 8542 <description> 8543 The method to query. 8544 </description> 8545 </param> 8546 <param id="entry_count_ptr"> 8547 <outptr><jint/></outptr> 8548 <description> 8549 On return, points to the number of entries in the table 8550 </description> 8551 </param> 8552 <param id="table_ptr"> 8553 <allocbuf outcount="entry_count_ptr"><struct>jvmtiLineNumberEntry</struct></allocbuf> 8554 <description> 8555 On return, points to the line number table pointer. 8556 </description> 8557 </param> 8558 </parameters> 8559 <errors> 8560 <error id="JVMTI_ERROR_ABSENT_INFORMATION"> 8561 Class information does not include line numbers. 8562 </error> 8563 </errors> 8564 </function> 8565 8566 <function id="GetMethodLocation" phase="start" num="71"> 8567 <synopsis>Get Method Location</synopsis> 8568 <description> 8569 For the method indicated by <code>method</code>, 8570 return the beginning and ending addresses through 8571 <code>start_location_ptr</code> and <code>end_location_ptr</code>. In a 8572 conventional bytecode indexing scheme, 8573 <code>start_location_ptr</code> will always point to zero 8574 and <code>end_location_ptr</code> 8575 will always point to the bytecode count minus one. 8576 </description> 8577 <origin>jvmdi</origin> 8578 <capabilities> 8579 </capabilities> 8580 <parameters> 8581 <param id="klass"> 8582 <jclass method="method"/> 8583 <description> 8584 The class to query. 8585 </description> 8586 </param> 8587 <param id="method"> 8588 <jmethodID class="klass" native="error"/> 8589 <description> 8590 The method to query. 8591 </description> 8592 </param> 8593 <param id="start_location_ptr"> 8594 <outptr><jlocation/></outptr> 8595 <description> 8596 On return, points to the first location, or 8597 <code>-1</code> if location information is not available. 8598 If the information is available and 8599 <functionlink id="GetJLocationFormat"></functionlink> 8600 returns <datalink id="JVMTI_JLOCATION_JVMBCI"></datalink> 8601 then this will always be zero. 8602 </description> 8603 </param> 8604 <param id="end_location_ptr"> 8605 <outptr><jlocation/></outptr> 8606 <description> 8607 On return, points to the last location, 8608 or <code>-1</code> if location information is not available. 8609 </description> 8610 </param> 8611 </parameters> 8612 <errors> 8613 <error id="JVMTI_ERROR_ABSENT_INFORMATION"> 8614 Class information does not include method sizes. 8615 </error> 8616 </errors> 8617 </function> 8618 8619 <function id="GetLocalVariableTable" num="72"> 8620 <synopsis>Get Local Variable Table</synopsis> 8621 <typedef id="jvmtiLocalVariableEntry" label="Local variable table entry"> 8622 <field id="start_location"> 8623 <jlocation/> 8624 <description> 8625 The code array index where the local variable is first valid 8626 (that is, where it must have a value). 8627 </description> 8628 </field> 8629 <field id="length"> 8630 <jint/> 8631 <description> 8632 The length of the valid section for this local variable. 8633 The last code array index where the local variable is valid 8634 is <code>start_location + length</code>. 8635 </description> 8636 </field> 8637 <field id="name"> 8638 <allocfieldbuf><char/></allocfieldbuf> 8639 <description> 8640 The local variable name, encoded as a 8641 <internallink id="mUTF">modified UTF-8</internallink> string. 8642 </description> 8643 </field> 8644 <field id="signature"> 8645 <allocfieldbuf><char/></allocfieldbuf> 8646 <description> 8647 The local variable's type signature, encoded as a 8648 <internallink id="mUTF">modified UTF-8</internallink> string. 8649 The signature format is the same as that defined in 8650 <vmspec chapter="4.3.2"/>. 8651 </description> 8652 </field> 8653 <field id="generic_signature"> 8654 <allocfieldbuf><char/></allocfieldbuf> 8655 <description> 8656 The local variable's generic signature, encoded as a 8657 <internallink id="mUTF">modified UTF-8</internallink> string. 8658 The value of this field will be <code>NULL</code> for any local 8659 variable which does not have a generic type. 8660 </description> 8661 </field> 8662 <field id="slot"> 8663 <jint/> 8664 <description> 8665 The local variable's slot. See <internallink id="local">Local Variables</internallink>. 8666 </description> 8667 </field> 8668 </typedef> 8669 <description> 8670 Return local variable information. 8671 </description> 8672 <origin>jvmdiClone</origin> 8673 <capabilities> 8674 <required id="can_access_local_variables"></required> 8675 </capabilities> 8676 <parameters> 8677 <param id="method"> 8678 <jmethodID native="error"/> 8679 <description> 8680 The method to query. 8681 </description> 8682 </param> 8683 <param id="entry_count_ptr"> 8684 <outptr><jint/></outptr> 8685 <description> 8686 On return, points to the number of entries in the table 8687 </description> 8688 </param> 8689 <param id="table_ptr"> 8690 <allocbuf outcount="entry_count_ptr"><struct>jvmtiLocalVariableEntry</struct></allocbuf> 8691 <description> 8692 On return, points to an array of local variable table entries. 8693 </description> 8694 </param> 8695 </parameters> 8696 <errors> 8697 <error id="JVMTI_ERROR_ABSENT_INFORMATION"> 8698 Class information does not include local variable 8699 information. 8700 </error> 8701 </errors> 8702 </function> 8703 8704 <function id="GetBytecodes" phase="start" num="75"> 8705 <synopsis>Get Bytecodes</synopsis> 8706 <description> 8707 For the method indicated by <code>method</code>, 8708 return the bytecodes that implement the method. The number of 8709 bytecodes is returned via <code>bytecode_count_ptr</code>. The bytecodes 8710 themselves are returned via <code>bytecodes_ptr</code>. 8711 </description> 8712 <origin>jvmdi</origin> 8713 <capabilities> 8714 <required id="can_get_bytecodes"></required> 8715 </capabilities> 8716 <parameters> 8717 <param id="klass"> 8718 <jclass method="method"/> 8719 <description> 8720 The class to query. 8721 </description> 8722 </param> 8723 <param id="method"> 8724 <jmethodID class="klass" native="error"/> 8725 <description> 8726 The method to query. 8727 </description> 8728 </param> 8729 <param id="bytecode_count_ptr"> 8730 <outptr><jint/></outptr> 8731 <description> 8732 On return, points to the length of the bytecode array 8733 </description> 8734 </param> 8735 <param id="bytecodes_ptr"> 8736 <allocbuf outcount="bytecode_count_ptr"><uchar/></allocbuf> 8737 <description> 8738 On return, points to the pointer to the bytecode array 8739 </description> 8740 </param> 8741 </parameters> 8742 <errors> 8743 </errors> 8744 </function> 8745 8746 <function id="IsMethodNative" phase="start" num="76"> 8747 <synopsis>Is Method Native</synopsis> 8748 <description> 8749 For the method indicated by <code>method</code>, return a 8750 value indicating whether the method is native via <code>is_native_ptr</code> 8751 </description> 8752 <origin>jvmdi</origin> 8753 <capabilities> 8754 </capabilities> 8755 <parameters> 8756 <param id="klass"> 8757 <jclass method="method"/> 8758 <description> 8759 The class to query. 8760 </description> 8761 </param> 8762 <param id="method"> 8763 <jmethodID class="klass"/> 8764 <description> 8765 The method to query. 8766 </description> 8767 </param> 8768 <param id="is_native_ptr"> 8769 <outptr><jboolean/></outptr> 8770 <description> 8771 On return, points to the boolean result of this function. 8772 </description> 8773 </param> 8774 </parameters> 8775 <errors> 8776 </errors> 8777 </function> 8778 8779 <function id="IsMethodSynthetic" phase="start" num="77"> 8780 <synopsis>Is Method Synthetic</synopsis> 8781 <description> 8782 For the method indicated by <code>method</code>, return a 8783 value indicating whether the method is synthetic via <code>is_synthetic_ptr</code>. 8784 Synthetic methods are generated by the compiler but not present in the 8785 original source code. 8786 </description> 8787 <origin>jvmdi</origin> 8788 <capabilities> 8789 <required id="can_get_synthetic_attribute"></required> 8790 </capabilities> 8791 <parameters> 8792 <param id="klass"> 8793 <jclass method="method"/> 8794 <description> 8795 The class to query. 8796 </description> 8797 </param> 8798 <param id="method"> 8799 <jmethodID class="klass"/> 8800 <description> 8801 The method to query. 8802 </description> 8803 </param> 8804 <param id="is_synthetic_ptr"> 8805 <outptr><jboolean/></outptr> 8806 <description> 8807 On return, points to the boolean result of this function. 8808 </description> 8809 </param> 8810 </parameters> 8811 <errors> 8812 </errors> 8813 </function> 8814 8815 <function id="IsMethodObsolete" phase="start" num="91"> 8816 <synopsis>Is Method Obsolete</synopsis> 8817 <description> 8818 Determine if a method ID refers to an 8819 <internallink id="obsoleteMethods">obsolete</internallink> 8820 method version. 8821 </description> 8822 <origin>jvmdi</origin> 8823 <capabilities> 8824 </capabilities> 8825 <parameters> 8826 <param id="klass"> 8827 <jclass method="method"/> 8828 <description> 8829 The class to query. 8830 </description> 8831 </param> 8832 <param id="method"> 8833 <jmethodID class="klass"/> 8834 <description> 8835 The method ID to query. 8836 </description> 8837 </param> 8838 <param id="is_obsolete_ptr"> 8839 <outptr><jboolean/></outptr> 8840 <description> 8841 On return, points to the boolean result of this function. 8842 </description> 8843 </param> 8844 </parameters> 8845 <errors> 8846 </errors> 8847 </function> 8848 8849 <function id="SetNativeMethodPrefix" jkernel="yes" phase="any" num="73" since="1.1"> 8850 <synopsis>Set Native Method Prefix</synopsis> 8851 <description> 8852 This function modifies the failure handling of 8853 native method resolution by allowing retry 8854 with a prefix applied to the name. 8855 When used with the 8856 <eventlink id="ClassFileLoadHook">ClassFileLoadHook 8857 event</eventlink>, it enables native methods to be 8858 <internallink id="bci">instrumented</internallink>. 8859 <p/> 8860 Since native methods cannot be directly instrumented 8861 (they have no bytecodes), they must be wrapped with 8862 a non-native method which can be instrumented. 8863 For example, if we had: 8864 <example> 8865 native boolean foo(int x);</example> 8866 <p/> 8867 We could transform the class file (with the 8868 ClassFileLoadHook event) so that this becomes: 8869 <example> 8870 boolean foo(int x) { 8871 <i>... record entry to foo ...</i> 8872 return wrapped_foo(x); 8873 } 8874 8875 native boolean wrapped_foo(int x);</example> 8876 <p/> 8877 Where foo becomes a wrapper for the actual native method 8878 with the appended prefix "wrapped_". Note that 8879 "wrapped_" would be a poor choice of prefix since it 8880 might conceivably form the name of an existing method 8881 thus something like "$$$MyAgentWrapped$$$_" would be 8882 better but would make these examples less readable. 8883 <p/> 8884 The wrapper will allow data to be collected on the native 8885 method call, but now the problem becomes linking up the 8886 wrapped method with the native implementation. 8887 That is, the method <code>wrapped_foo</code> needs to be 8888 resolved to the native implementation of <code>foo</code>, 8889 which might be: 8890 <example> 8891 Java_somePackage_someClass_foo(JNIEnv* env, jint x)</example> 8892 <p/> 8893 This function allows the prefix to be specified and the 8894 proper resolution to occur. 8895 Specifically, when the standard resolution fails, the 8896 resolution is retried taking the prefix into consideration. 8897 There are two ways that resolution occurs, explicit 8898 resolution with the JNI function <code>RegisterNatives</code> 8899 and the normal automatic resolution. For 8900 <code>RegisterNatives</code>, the VM will attempt this 8901 association: 8902 <example> 8903 method(foo) -> nativeImplementation(foo)</example> 8904 <p/> 8905 When this fails, the resolution will be retried with 8906 the specified prefix prepended to the method name, 8907 yielding the correct resolution: 8908 <example> 8909 method(wrapped_foo) -> nativeImplementation(foo)</example> 8910 <p/> 8911 For automatic resolution, the VM will attempt: 8912 <example> 8913 method(wrapped_foo) -> nativeImplementation(wrapped_foo)</example> 8914 <p/> 8915 When this fails, the resolution will be retried with 8916 the specified prefix deleted from the implementation name, 8917 yielding the correct resolution: 8918 <example> 8919 method(wrapped_foo) -> nativeImplementation(foo)</example> 8920 <p/> 8921 Note that since the prefix is only used when standard 8922 resolution fails, native methods can be wrapped selectively. 8923 <p/> 8924 Since each <jvmti/> environment is independent and 8925 can do its own transformation of the bytecodes, more 8926 than one layer of wrappers may be applied. Thus each 8927 environment needs its own prefix. Since transformations 8928 are applied in order, the prefixes, if applied, will 8929 be applied in the same order. 8930 The order of transformation application is described in 8931 the <eventlink id="ClassFileLoadHook"/> event. 8932 Thus if three environments applied 8933 wrappers, <code>foo</code> might become 8934 <code>$env3_$env2_$env1_foo</code>. But if, say, 8935 the second environment did not apply a wrapper to 8936 <code>foo</code> it would be just 8937 <code>$env3_$env1_foo</code>. To be able to 8938 efficiently determine the sequence of prefixes, 8939 an intermediate prefix is only applied if its non-native 8940 wrapper exists. Thus, in the last example, even though 8941 <code>$env1_foo</code> is not a native method, the 8942 <code>$env1_</code> prefix is applied since 8943 <code>$env1_foo</code> exists. 8944 <p/> 8945 Since the prefixes are used at resolution time 8946 and since resolution may be arbitrarily delayed, a 8947 native method prefix must remain set as long as there 8948 are corresponding prefixed native methods. 8949 </description> 8950 <origin>new</origin> 8951 <capabilities> 8952 <required id="can_set_native_method_prefix"></required> 8953 </capabilities> 8954 <parameters> 8955 <param id="prefix"> 8956 <inbuf> 8957 <char/> 8958 <nullok> 8959 any existing prefix in this environment is cancelled 8960 </nullok> 8961 </inbuf> 8962 <description> 8963 The prefix to apply, encoded as a 8964 <internallink id="mUTF">modified UTF-8</internallink> string. 8965 </description> 8966 </param> 8967 </parameters> 8968 <errors> 8969 </errors> 8970 </function> 8971 8972 <function id="SetNativeMethodPrefixes" jkernel="yes" phase="any" num="74" since="1.1"> 8973 <synopsis>Set Native Method Prefixes</synopsis> 8974 <description> 8975 For a normal agent, <functionlink id="SetNativeMethodPrefix"/> 8976 will provide all needed native method prefixing. 8977 For a meta-agent that performs multiple independent class 8978 file transformations (for example as a proxy for another 8979 layer of agents) this function allows each transformation 8980 to have its own prefix. 8981 The prefixes are applied in the order supplied and are 8982 processed in the same manner as described for the 8983 application of prefixes from multiple <jvmti/> environments 8984 in <functionlink id="SetNativeMethodPrefix"/>. 8985 <p/> 8986 Any previous prefixes are replaced. Thus, calling this 8987 function with a <paramlink id="prefix_count"/> of <code>0</code> 8988 disables prefixing in this environment. 8989 <p/> 8990 <functionlink id="SetNativeMethodPrefix"/> and this function 8991 are the two ways to set the prefixes. 8992 Calling <code>SetNativeMethodPrefix</code> with 8993 a prefix is the same as calling this function with 8994 <paramlink id="prefix_count"/> of <code>1</code>. 8995 Calling <code>SetNativeMethodPrefix</code> with 8996 <code>NULL</code> is the same as calling this function with 8997 <paramlink id="prefix_count"/> of <code>0</code>. 8998 </description> 8999 <origin>new</origin> 9000 <capabilities> 9001 <required id="can_set_native_method_prefix"></required> 9002 </capabilities> 9003 <parameters> 9004 <param id="prefix_count"> 9005 <jint min="0"/> 9006 <description> 9007 The number of prefixes to apply. 9008 </description> 9009 </param> 9010 <param id="prefixes"> 9011 <agentbuf> 9012 <char/> 9013 </agentbuf> 9014 <description> 9015 The prefixes to apply for this environment, each encoded as a 9016 <internallink id="mUTF">modified UTF-8</internallink> string. 9017 </description> 9018 </param> 9019 </parameters> 9020 <errors> 9021 </errors> 9022 </function> 9023 9024 </category> 9025 9026 <category id="RawMonitors" label="Raw Monitor"> 9027 9028 <function id="CreateRawMonitor" phase="onload" callbacksafe="safe" num="31"> 9029 <synopsis>Create Raw Monitor</synopsis> 9030 <description> 9031 Create a raw monitor. 9032 </description> 9033 <origin>jvmdi</origin> 9034 <capabilities> 9035 </capabilities> 9036 <parameters> 9037 <param id="name"> 9038 <inbuf><char/></inbuf> 9039 <description> 9040 A name to identify the monitor, encoded as a 9041 <internallink id="mUTF">modified UTF-8</internallink> string. 9042 </description> 9043 </param> 9044 <param id="monitor_ptr"> 9045 <outptr><jrawMonitorID/></outptr> 9046 <description> 9047 On return, points to the created monitor. 9048 </description> 9049 </param> 9050 </parameters> 9051 <errors> 9052 </errors> 9053 </function> 9054 9055 <function id="DestroyRawMonitor" phase="onload" callbacksafe="safe" num="32"> 9056 <synopsis>Destroy Raw Monitor</synopsis> 9057 <description> 9058 Destroy the raw monitor. 9059 If the monitor being destroyed has been entered by this thread, it will be 9060 exited before it is destroyed. 9061 If the monitor being destroyed has been entered by another thread, 9062 an error will be returned and the monitor will not be destroyed. 9063 </description> 9064 <origin>jvmdi</origin> 9065 <capabilities> 9066 </capabilities> 9067 <parameters> 9068 <param id="monitor"> 9069 <jrawMonitorID/> 9070 <description> 9071 The monitor 9072 </description> 9073 </param> 9074 </parameters> 9075 <errors> 9076 <error id="JVMTI_ERROR_NOT_MONITOR_OWNER"> 9077 Not monitor owner 9078 </error> 9079 </errors> 9080 </function> 9081 9082 <function id="RawMonitorEnter" phase="any" callbacksafe="safe" impl="innative notrace" num="33"> 9083 <synopsis>Raw Monitor Enter</synopsis> 9084 <description> 9085 Gain exclusive ownership of a raw monitor. 9086 The same thread may enter a monitor more then once. 9087 The thread must 9088 <functionlink id="RawMonitorExit">exit</functionlink> 9089 the monitor the same number of times as it is entered. 9090 If a monitor is entered during <code>OnLoad</code> (before attached threads exist) 9091 and has not exited when attached threads come into existence, the enter 9092 is considered to have occurred on the main thread. 9093 </description> 9094 <origin>jvmdi</origin> 9095 <capabilities> 9096 </capabilities> 9097 <parameters> 9098 <param id="monitor"> 9099 <jrawMonitorID/> 9100 <description> 9101 The monitor 9102 </description> 9103 </param> 9104 </parameters> 9105 <errors> 9106 </errors> 9107 </function> 9108 9109 <function id="RawMonitorExit" phase="any" callbacksafe="safe" impl="innative notrace" num="34"> 9110 <synopsis>Raw Monitor Exit</synopsis> 9111 <description> 9112 Release exclusive ownership of a raw monitor. 9113 </description> 9114 <origin>jvmdi</origin> 9115 <capabilities> 9116 </capabilities> 9117 <parameters> 9118 <param id="monitor"> 9119 <jrawMonitorID/> 9120 <description> 9121 The monitor 9122 </description> 9123 </param> 9124 </parameters> 9125 <errors> 9126 <error id="JVMTI_ERROR_NOT_MONITOR_OWNER"> 9127 Not monitor owner 9128 </error> 9129 </errors> 9130 </function> 9131 9132 <function id="RawMonitorWait" phase="any" callbacksafe="safe" impl="innative notrace" num="35"> 9133 <synopsis>Raw Monitor Wait</synopsis> 9134 <description> 9135 Wait for notification of the raw monitor. 9136 <p/> 9137 Causes the current thread to wait until either another thread calls 9138 <functionlink id="RawMonitorNotify"/> or 9139 <functionlink id="RawMonitorNotifyAll"/> 9140 for the specified raw monitor, or the specified 9141 <paramlink id="millis">timeout</paramlink> 9142 has elapsed. 9143 </description> 9144 <origin>jvmdi</origin> 9145 <capabilities> 9146 </capabilities> 9147 <parameters> 9148 <param id="monitor"> 9149 <jrawMonitorID/> 9150 <description> 9151 The monitor 9152 </description> 9153 </param> 9154 <param id="millis"> 9155 <jlong/> 9156 <description> 9157 The timeout, in milliseconds. If the timeout is 9158 zero, then real time is not taken into consideration 9159 and the thread simply waits until notified. 9160 </description> 9161 </param> 9162 </parameters> 9163 <errors> 9164 <error id="JVMTI_ERROR_NOT_MONITOR_OWNER"> 9165 Not monitor owner 9166 </error> 9167 <error id="JVMTI_ERROR_INTERRUPT"> 9168 Wait was interrupted, try again 9169 </error> 9170 </errors> 9171 </function> 9172 9173 <function id="RawMonitorNotify" phase="any" callbacksafe="safe" impl="notrace" num="36"> 9174 <synopsis>Raw Monitor Notify</synopsis> 9175 <description> 9176 Notify a single thread waiting on the raw monitor. 9177 </description> 9178 <origin>jvmdi</origin> 9179 <capabilities> 9180 </capabilities> 9181 <parameters> 9182 <param id="monitor"> 9183 <jrawMonitorID/> 9184 <description> 9185 The monitor 9186 </description> 9187 </param> 9188 </parameters> 9189 <errors> 9190 <error id="JVMTI_ERROR_NOT_MONITOR_OWNER"> 9191 Not monitor owner 9192 </error> 9193 </errors> 9194 </function> 9195 9196 <function id="RawMonitorNotifyAll" phase="any" callbacksafe="safe" impl="notrace" num="37"> 9197 <synopsis>Raw Monitor Notify All</synopsis> 9198 <description> 9199 Notify all threads waiting on the raw monitor. 9200 </description> 9201 <origin>jvmdi</origin> 9202 <capabilities> 9203 </capabilities> 9204 <parameters> 9205 <param id="monitor"> 9206 <jrawMonitorID/> 9207 <description> 9208 The monitor 9209 </description> 9210 </param> 9211 </parameters> 9212 <errors> 9213 <error id="JVMTI_ERROR_NOT_MONITOR_OWNER"> 9214 Not monitor owner 9215 </error> 9216 </errors> 9217 </function> 9218 9219 <elide> 9220 <function id="GetRawMonitorUse" num="118"> 9221 <synopsis>Get Raw Monitor Use</synopsis> 9222 <description> 9223 The fields of the <functionlink id="jvmtiMonitorUsage"></functionlink> structure 9224 are filled in with information about usage of the raw monitor. 9225 </description> 9226 <origin>new</origin> 9227 <capabilities> 9228 <required id="can_get_raw_monitor_usage"></required> 9229 </capabilities> 9230 <parameters> 9231 <param id="monitor"> 9232 <jrawMonitorID/> 9233 <description> 9234 the raw monitor to query. 9235 </description> 9236 </param> 9237 <param id="info_ptr"> 9238 <outptr><struct>jvmtiMonitorUsage</struct></outptr> 9239 <description> 9240 On return, filled with monitor information for the 9241 specified raw monitor. 9242 </description> 9243 </param> 9244 </parameters> 9245 <errors> 9246 </errors> 9247 </function> 9248 9249 <function id="GetRawMonitors" num="119"> 9250 <synopsis>Get Raw Monitors</synopsis> 9251 <description> 9252 Return the list of raw monitors. 9253 <p/> 9254 Note: details about each monitor can be examined with 9255 <functionlink id="GetRawMonitorUse"></functionlink>. 9256 </description> 9257 <origin>new</origin> 9258 <capabilities> 9259 <required id="can_get_raw_monitor_usage"></required> 9260 </capabilities> 9261 <parameters> 9262 <param id="monitorCnt"> 9263 <outptr><jint/></outptr> 9264 <description> 9265 On return, pointer to the number 9266 of monitors returned in <code>monitors_ptr</code>. 9267 </description> 9268 </param> 9269 <param id="monitors_ptr"> 9270 <allocbuf outcount="monitorCnt"><jrawMonitorID/></allocbuf> 9271 <description> 9272 On return, pointer to the monitor list. 9273 </description> 9274 </param> 9275 </parameters> 9276 <errors> 9277 </errors> 9278 </function> 9279 </elide> 9280 </category> 9281 9282 <category id="jniIntercept" label="JNI Function Interception"> 9283 9284 <intro> 9285 Provides the ability to intercept and resend 9286 Java Native Interface (JNI) function calls 9287 by manipulating the JNI function table. 9288 See <externallink id="jni/functions.html">JNI 9289 Functions</externallink> in the <i>Java Native Interface Specification</i>. 9290 <p/> 9291 The following example illustrates intercepting the 9292 <code>NewGlobalRef</code> JNI call in order to count reference 9293 creation. 9294 <example> 9295 JNIEnv original_jni_Functions; 9296 JNIEnv redirected_jni_Functions; 9297 int my_global_ref_count = 0; 9298 9299 jobject 9300 MyNewGlobalRef(JNIEnv *jni_env, jobject lobj) { 9301 ++my_global_ref_count; 9302 return originalJNIFunctions->NewGlobalRef(env, lobj); 9303 } 9304 9305 void 9306 myInit() { 9307 jvmtiError err; 9308 9309 err = (*jvmti_env)->GetJNIFunctionTable(jvmti_env, &original_jni_Functions); 9310 if (err != JVMTI_ERROR_NONE) { 9311 die(); 9312 } 9313 err = (*jvmti_env)->GetJNIFunctionTable(jvmti_env, &redirected_jni_Functions); 9314 if (err != JVMTI_ERROR_NONE) { 9315 die(); 9316 } 9317 redirectedJNIFunctions->NewGlobalRef = MyNewGlobalRef; 9318 err = (*jvmti_env)->SetJNIFunctionTable(jvmti_env, redirected_jni_Functions); 9319 if (err != JVMTI_ERROR_NONE) { 9320 die(); 9321 } 9322 } 9323 </example> 9324 Sometime after <code>myInit</code> is called the user's JNI 9325 code is executed which makes the call to create a new global 9326 reference. Instead of going to the normal JNI implementation 9327 the call goes to <code>myNewGlobalRef</code>. Note that a 9328 copy of the original function table is kept so that the normal 9329 JNI function can be called after the data is collected. 9330 Note also that any JNI functions which are not overwritten 9331 will behave normally. 9332 <todo> 9333 check that the example compiles and executes. 9334 </todo> 9335 </intro> 9336 9337 <function id="SetJNIFunctionTable" phase="start" num="120"> 9338 <synopsis>Set JNI Function Table</synopsis> 9339 <description> 9340 Set the JNI function table 9341 in all current and future JNI environments. 9342 As a result, all future JNI calls are directed to the specified functions. 9343 Use <functionlink id="GetJNIFunctionTable"></functionlink> to get the 9344 function table to pass to this function. 9345 For this function to take effect the the updated table entries must be 9346 used by the JNI clients. 9347 Since the table is defined <code>const</code> some compilers may optimize 9348 away the access to the table, thus preventing this function from taking 9349 effect. 9350 The table is copied--changes to the local copy of the 9351 table have no effect. 9352 This function affects only the function table, all other aspects of the environment are 9353 unaffected. 9354 See the examples <internallink id="jniIntercept">above</internallink>. 9355 </description> 9356 <origin>new</origin> 9357 <capabilities> 9358 </capabilities> 9359 <parameters> 9360 <param id="function_table"> 9361 <inptr> 9362 <struct>jniNativeInterface</struct> 9363 </inptr> 9364 <description> 9365 Points to the new JNI function table. 9366 </description> 9367 </param> 9368 </parameters> 9369 <errors> 9370 </errors> 9371 </function> 9372 9373 <function id="GetJNIFunctionTable" phase="start" num="121"> 9374 <synopsis>Get JNI Function Table</synopsis> 9375 <description> 9376 Get the JNI function table. 9377 The JNI function table is copied into allocated memory. 9378 If <functionlink id="SetJNIFunctionTable"></functionlink> 9379 has been called, the modified (not the original) function 9380 table is returned. 9381 Only the function table is copied, no other aspects of the environment 9382 are copied. 9383 See the examples <internallink id="jniIntercept">above</internallink>. 9384 </description> 9385 <origin>new</origin> 9386 <capabilities> 9387 </capabilities> 9388 <parameters> 9389 <param id="function_table"> 9390 <allocbuf> 9391 <struct>jniNativeInterface</struct> 9392 </allocbuf> 9393 <description> 9394 On return, <code>*function_table</code> 9395 points a newly allocated copy of the JNI function table. 9396 </description> 9397 </param> 9398 </parameters> 9399 <errors> 9400 </errors> 9401 </function> 9402 9403 </category> 9404 9405 <category id="eventManagement" label="Event Management"> 9406 9407 <function id="SetEventCallbacks" jkernel="yes" phase="onload" num="122"> 9408 <synopsis>Set Event Callbacks</synopsis> 9409 <description> 9410 Set the functions to be called for each event. 9411 The callbacks are specified by supplying a replacement function table. 9412 The function table is copied--changes to the local copy of the 9413 table have no effect. 9414 This is an atomic action, all callbacks are set at once. 9415 No events are sent before this function is called. 9416 When an entry is <code>NULL</code> or when the event is beyond 9417 <paramlink id="size_of_callbacks"></paramlink> no event is sent. 9418 Details on events are 9419 described <internallink id="EventSection">later</internallink> in this document. 9420 An event must be enabled and have a callback in order to be 9421 sent--the order in which this function and 9422 <functionlink id="SetEventNotificationMode"></functionlink> 9423 are called does not affect the result. 9424 </description> 9425 <origin>new</origin> 9426 <capabilities> 9427 </capabilities> 9428 <parameters> 9429 <param id="callbacks"> 9430 <inptr> 9431 <struct>jvmtiEventCallbacks</struct> 9432 <nullok>remove the existing callbacks</nullok> 9433 </inptr> 9434 <description> 9435 The new event callbacks. 9436 </description> 9437 </param> 9438 <param id="size_of_callbacks"> 9439 <jint min="0"/> 9440 <description> 9441 <code>sizeof(jvmtiEventCallbacks)</code>--for version 9442 compatibility. 9443 </description> 9444 </param> 9445 </parameters> 9446 <errors> 9447 </errors> 9448 </function> 9449 9450 <function id="SetEventNotificationMode" jkernel="yes" phase="onload" num="2"> 9451 <synopsis>Set Event Notification Mode</synopsis> 9452 <description> 9453 Control the generation of events. 9454 <constants id="jvmtiEventMode" label="Event Enable/Disable" kind="enum"> 9455 <constant id="JVMTI_ENABLE" num="1"> 9456 If <paramlink id="mode"></paramlink> is <code>JVMTI_ENABLE</code>, 9457 the event <paramlink id="event_type"></paramlink> will be enabled 9458 </constant> 9459 <constant id="JVMTI_DISABLE" num="0"> 9460 If <paramlink id="mode"></paramlink> is <code>JVMTI_DISABLE</code>, 9461 the event <paramlink id="event_type"></paramlink> will be disabled 9462 </constant> 9463 </constants> 9464 If <code>event_thread</code> is <code>NULL</code>, 9465 the event is enabled or disabled globally; otherwise, it is 9466 enabled or disabled for a particular thread. 9467 An event is generated for 9468 a particular thread if it is enabled either at the thread or global 9469 levels. 9470 <p/> 9471 See <internallink id="EventIndex">below</internallink> for information on specific events. 9472 <p/> 9473 The following events cannot be controlled at the thread 9474 level through this function. 9475 <ul> 9476 <li><eventlink id="VMInit"></eventlink></li> 9477 <li><eventlink id="VMStart"></eventlink></li> 9478 <li><eventlink id="VMDeath"></eventlink></li> 9479 <li><eventlink id="ThreadStart"></eventlink></li> 9480 <li><eventlink id="CompiledMethodLoad"></eventlink></li> 9481 <li><eventlink id="CompiledMethodUnload"></eventlink></li> 9482 <li><eventlink id="DynamicCodeGenerated"></eventlink></li> 9483 <li><eventlink id="DataDumpRequest"></eventlink></li> 9484 </ul> 9485 <p/> 9486 Initially, no events are enabled at either the thread level 9487 or the global level. 9488 <p/> 9489 Any needed capabilities (see Event Enabling Capabilities below) must be possessed 9490 before calling this function. 9491 <p/> 9492 Details on events are 9493 described <internallink id="EventSection">below</internallink>. 9494 </description> 9495 <origin>jvmdiClone</origin> 9496 <eventcapabilities></eventcapabilities> 9497 <parameters> 9498 <param id="mode"> 9499 <enum>jvmtiEventMode</enum> 9500 <description> 9501 <code>JVMTI_ENABLE</code> or <code>JVMTI_DISABLE</code> 9502 </description> 9503 </param> 9504 <param id="event_type"> 9505 <enum>jvmtiEvent</enum> 9506 <description> 9507 the event to control 9508 </description> 9509 </param> 9510 <param id="event_thread"> 9511 <ptrtype> 9512 <jthread impl="noconvert"/> 9513 <nullok>event is controlled at the global level</nullok> 9514 </ptrtype> 9515 <description> 9516 The thread to control 9517 </description> 9518 </param> 9519 <param id="..."> 9520 <varargs/> 9521 <description> 9522 for future expansion 9523 </description> 9524 </param> 9525 </parameters> 9526 <errors> 9527 <error id="JVMTI_ERROR_INVALID_THREAD"> 9528 <paramlink id="event_thread"/> is non-<code>NULL</code> and is not a valid thread. 9529 </error> 9530 <error id="JVMTI_ERROR_THREAD_NOT_ALIVE"> 9531 <paramlink id="event_thread"/> is non-<code>NULL</code> and is not live (has not been started or is now dead). 9532 </error> 9533 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 9534 thread level control was attempted on events which do not 9535 permit thread level control. 9536 </error> 9537 <error id="JVMTI_ERROR_MUST_POSSESS_CAPABILITY"> 9538 The Required Event Enabling Capability is not possessed. 9539 </error> 9540 </errors> 9541 </function> 9542 9543 <function id="GenerateEvents" num="123"> 9544 <synopsis>Generate Events</synopsis> 9545 <description> 9546 Generate events to represent the current state of the VM. 9547 For example, if <paramlink id="event_type"/> is 9548 <code>JVMTI_EVENT_COMPILED_METHOD_LOAD</code>, 9549 a <eventlink id="CompiledMethodLoad"></eventlink> event will be 9550 sent for each currently compiled method. 9551 Methods that were loaded and now have been unloaded are not sent. 9552 The history of what events have previously been sent does not 9553 effect what events are sent by this function--for example, 9554 all currently compiled methods 9555 will be sent each time this function is called. 9556 <p/> 9557 This function is useful when 9558 events may have been missed due to the agent attaching after program 9559 execution begins; this function generates the missed events. 9560 <p/> 9561 Attempts to execute Java programming language code or 9562 JNI functions may be paused until this function returns - 9563 so neither should be called from the thread sending the event. 9564 This function returns only after the missed events have been 9565 sent, processed and have returned. 9566 The event may be sent on a different thread than the thread 9567 on which the event occurred. 9568 The callback for the event must be set with 9569 <functionlink id="SetEventCallbacks"></functionlink> 9570 and the event must be enabled with 9571 <functionlink id="SetEventNotificationMode"></functionlink> 9572 or the events will not occur. 9573 If the VM no longer has the information to generate some or 9574 all of the requested events, the events are simply not sent - 9575 no error is returned. 9576 <p/> 9577 Only the following events are supported: 9578 <ul> 9579 <li><eventlink id="CompiledMethodLoad"></eventlink></li> 9580 <li><eventlink id="DynamicCodeGenerated"></eventlink></li> 9581 </ul> 9582 </description> 9583 <origin>new</origin> 9584 <capabilities> 9585 <capability id="can_generate_compiled_method_load_events"></capability> 9586 </capabilities> 9587 <parameters> 9588 <param id="event_type"> 9589 <enum>jvmtiEvent</enum> 9590 <description> 9591 The type of event to generate. Must be one of these: 9592 <ul> 9593 <li><eventlink id="CompiledMethodLoad"><code>JVMTI_EVENT_COMPILED_METHOD_LOAD</code></eventlink></li> 9594 <li><eventlink id="DynamicCodeGenerated"><code>JVMTI_EVENT_DYNAMIC_CODE_GENERATED</code></eventlink></li> 9595 </ul> 9596 </description> 9597 </param> 9598 </parameters> 9599 <errors> 9600 <error id="JVMTI_ERROR_MUST_POSSESS_CAPABILITY"> 9601 <paramlink id="event_type"/> is 9602 <eventlink id="CompiledMethodLoad"><code>JVMTI_EVENT_COMPILED_METHOD_LOAD</code></eventlink> 9603 and <fieldlink id="can_generate_compiled_method_load_events" struct="jvmtiCapabilities"></fieldlink> 9604 is <code>false</code>. 9605 </error> 9606 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 9607 <paramlink id="event_type"/> is other than 9608 <eventlink id="CompiledMethodLoad"><code>JVMTI_EVENT_COMPILED_METHOD_LOAD</code></eventlink> 9609 or <eventlink id="DynamicCodeGenerated"><code>JVMTI_EVENT_DYNAMIC_CODE_GENERATED</code></eventlink>. 9610 </error> 9611 </errors> 9612 </function> 9613 9614 </category> 9615 9616 <category id="extension" label="Extension Mechanism"> 9617 9618 <intro> 9619 These functions 9620 allow a <jvmti/> implementation to provide functions and events 9621 beyond those defined in this specification. 9622 <p/> 9623 Both extension functions and extension events have parameters 9624 each of which has a 'type' and 'kind' chosen from the following tables: 9625 9626 <constants id="jvmtiParamTypes" label="Extension Function/Event Parameter Types" kind="enum"> 9627 <constant id="JVMTI_TYPE_JBYTE" num="101"> 9628 Java programming language primitive type - <code>byte</code>. 9629 JNI type <code>jbyte</code>. 9630 </constant> 9631 <constant id="JVMTI_TYPE_JCHAR" num="102"> 9632 Java programming language primitive type - <code>char</code>. 9633 JNI type <code>jchar</code>. 9634 </constant> 9635 <constant id="JVMTI_TYPE_JSHORT" num="103"> 9636 Java programming language primitive type - <code>short</code>. 9637 JNI type <code>jshort</code>. 9638 </constant> 9639 <constant id="JVMTI_TYPE_JINT" num="104"> 9640 Java programming language primitive type - <code>int</code>. 9641 JNI type <datalink id="jint"></datalink>. 9642 </constant> 9643 <constant id="JVMTI_TYPE_JLONG" num="105"> 9644 Java programming language primitive type - <code>long</code>. 9645 JNI type <datalink id="jlong"></datalink>. 9646 </constant> 9647 <constant id="JVMTI_TYPE_JFLOAT" num="106"> 9648 Java programming language primitive type - <code>float</code>. 9649 JNI type <datalink id="jfloat"></datalink>. 9650 </constant> 9651 <constant id="JVMTI_TYPE_JDOUBLE" num="107"> 9652 Java programming language primitive type - <code>double</code>. 9653 JNI type <datalink id="jdouble"></datalink>. 9654 </constant> 9655 <constant id="JVMTI_TYPE_JBOOLEAN" num="108"> 9656 Java programming language primitive type - <code>boolean</code>. 9657 JNI type <datalink id="jboolean"></datalink>. 9658 </constant> 9659 <constant id="JVMTI_TYPE_JOBJECT" num="109"> 9660 Java programming language object type - <code>java.lang.Object</code>. 9661 JNI type <datalink id="jobject"></datalink>. 9662 Returned values are JNI local references and must be managed. 9663 </constant> 9664 <constant id="JVMTI_TYPE_JTHREAD" num="110"> 9665 Java programming language object type - <code>java.lang.Thread</code>. 9666 <jvmti/> type <datalink id="jthread"></datalink>. 9667 Returned values are JNI local references and must be managed. 9668 </constant> 9669 <constant id="JVMTI_TYPE_JCLASS" num="111"> 9670 Java programming language object type - <code>java.lang.Class</code>. 9671 JNI type <datalink id="jclass"></datalink>. 9672 Returned values are JNI local references and must be managed. 9673 </constant> 9674 <constant id="JVMTI_TYPE_JVALUE" num="112"> 9675 Union of all Java programming language primitive and object types - 9676 JNI type <datalink id="jvalue"></datalink>. 9677 Returned values which represent object types are JNI local references and must be managed. 9678 </constant> 9679 <constant id="JVMTI_TYPE_JFIELDID" num="113"> 9680 Java programming language field identifier - 9681 JNI type <datalink id="jfieldID"></datalink>. 9682 </constant> 9683 <constant id="JVMTI_TYPE_JMETHODID" num="114"> 9684 Java programming language method identifier - 9685 JNI type <datalink id="jmethodID"></datalink>. 9686 </constant> 9687 <constant id="JVMTI_TYPE_CCHAR" num="115"> 9688 C programming language type - <code>char</code>. 9689 </constant> 9690 <constant id="JVMTI_TYPE_CVOID" num="116"> 9691 C programming language type - <code>void</code>. 9692 </constant> 9693 <constant id="JVMTI_TYPE_JNIENV" num="117"> 9694 JNI environment - <code>JNIEnv</code>. 9695 Should be used with the correct <datalink id="jvmtiParamKind"/> to make it a pointer type. 9696 </constant> 9697 </constants> 9698 9699 <constants id="jvmtiParamKind" label="Extension Function/Event Parameter Kinds" kind="enum"> 9700 <constant id="JVMTI_KIND_IN" num="91"> 9701 Ingoing argument - <code>foo</code>. 9702 </constant> 9703 <constant id="JVMTI_KIND_IN_PTR" num="92"> 9704 Ingoing pointer argument - <code>const foo*</code>. 9705 </constant> 9706 <constant id="JVMTI_KIND_IN_BUF" num="93"> 9707 Ingoing array argument - <code>const foo*</code>. 9708 </constant> 9709 <constant id="JVMTI_KIND_ALLOC_BUF" num="94"> 9710 Outgoing allocated array argument - <code>foo**</code>. 9711 Free with <code>Deallocate</code>. 9712 </constant> 9713 <constant id="JVMTI_KIND_ALLOC_ALLOC_BUF" num="95"> 9714 Outgoing allocated array of allocated arrays argument - <code>foo***</code>. 9715 Free with <code>Deallocate</code>. 9716 </constant> 9717 <constant id="JVMTI_KIND_OUT" num="96"> 9718 Outgoing argument - <code>foo*</code>. 9719 </constant> 9720 <constant id="JVMTI_KIND_OUT_BUF" num="97"> 9721 Outgoing array argument (pre-allocated by agent) - <code>foo*</code>. 9722 Do not <code>Deallocate</code>. 9723 </constant> 9724 </constants> 9725 9726 </intro> 9727 9728 <typedef id="jvmtiParamInfo" label="Extension Function/Event Parameter Info"> 9729 <field id="name"> 9730 <allocfieldbuf><char/></allocfieldbuf> 9731 <description> 9732 The parameter name, encoded as a 9733 <internallink id="mUTF">modified UTF-8</internallink> string 9734 </description> 9735 </field> 9736 <field id="kind"> 9737 <enum>jvmtiParamKind</enum> 9738 <description> 9739 The kind of the parameter - type modifiers 9740 </description> 9741 </field> 9742 <field id="base_type"> 9743 <enum>jvmtiParamTypes</enum> 9744 <description> 9745 The base type of the parameter - modified by <code>kind</code> 9746 </description> 9747 </field> 9748 <field id="null_ok"> 9749 <jboolean/> 9750 <description> 9751 Is a <code>NULL</code> argument permitted? Applies only to pointer and object types. 9752 </description> 9753 </field> 9754 </typedef> 9755 9756 <callback id="jvmtiExtensionFunction"> 9757 <enum>jvmtiError</enum> 9758 <synopsis>Extension Function</synopsis> 9759 <description> 9760 This is the implementation-specific extension function. 9761 </description> 9762 <parameters> 9763 <param id="jvmti_env"> 9764 <outptr> 9765 <struct>jvmtiEnv</struct> 9766 </outptr> 9767 <description> 9768 The <jvmti/> environment is the only fixed parameter for extension functions. 9769 </description> 9770 </param> 9771 <param id="..."> 9772 <varargs/> 9773 <description> 9774 The extension function-specific parameters 9775 </description> 9776 </param> 9777 </parameters> 9778 </callback> 9779 9780 <function id="GetExtensionFunctions" phase="onload" num="124"> 9781 <synopsis>Get Extension Functions</synopsis> 9782 9783 <typedef id="jvmtiExtensionFunctionInfo" label="Extension Function Info"> 9784 <field id="func"> 9785 <ptrtype> 9786 <struct>jvmtiExtensionFunction</struct> 9787 </ptrtype> 9788 <description> 9789 The actual function to call 9790 </description> 9791 </field> 9792 <field id="id"> 9793 <allocfieldbuf><char/></allocfieldbuf> 9794 <description> 9795 The identifier for the extension function, encoded as a 9796 <internallink id="mUTF">modified UTF-8</internallink> string. 9797 Uses package name conventions. 9798 For example, <code>com.sun.hotspot.bar</code> 9799 </description> 9800 </field> 9801 <field id="short_description"> 9802 <allocfieldbuf><char/></allocfieldbuf> 9803 <description> 9804 A one sentence description of the function, encoded as a 9805 <internallink id="mUTF">modified UTF-8</internallink> string. 9806 </description> 9807 </field> 9808 <field id="param_count"> 9809 <jint/> 9810 <description> 9811 The number of parameters excluding <code>jvmtiEnv *jvmti_env</code> 9812 </description> 9813 </field> 9814 <field id="params"> 9815 <allocfieldbuf outcount="param_count"> 9816 <struct>jvmtiParamInfo</struct> 9817 </allocfieldbuf> 9818 <description> 9819 Array of 9820 <fieldlink id="param_count" struct="jvmtiExtensionFunctionInfo"></fieldlink> 9821 parameters (<code>jvmtiEnv *jvmti_env</code> excluded) 9822 </description> 9823 </field> 9824 <field id="error_count"> 9825 <jint/> 9826 <description> 9827 The number of possible error returns (excluding universal errors) 9828 </description> 9829 </field> 9830 <field id="errors"> 9831 <allocfieldbuf outcount="error_count"> 9832 <enum>jvmtiError</enum> 9833 </allocfieldbuf> 9834 <description> 9835 Array of <fieldlink id="error_count" struct="jvmtiExtensionFunctionInfo"></fieldlink> 9836 possible errors 9837 </description> 9838 </field> 9839 </typedef> 9840 9841 <description> 9842 Returns the set of extension functions. 9843 </description> 9844 <origin>new</origin> 9845 <capabilities> 9846 </capabilities> 9847 <parameters> 9848 <param id="extension_count_ptr"> 9849 <outptr><jint/></outptr> 9850 <description> 9851 On return, points to the number of extension functions 9852 </description> 9853 </param> 9854 <param id="extensions"> 9855 <allocbuf outcount="extension_count_ptr"><struct>jvmtiExtensionFunctionInfo</struct></allocbuf> 9856 <description> 9857 Returns an array of extension function info, one per function 9858 </description> 9859 </param> 9860 </parameters> 9861 <errors> 9862 </errors> 9863 </function> 9864 9865 <function id="GetExtensionEvents" phase="onload" num="125"> 9866 <synopsis>Get Extension Events</synopsis> 9867 9868 <typedef id="jvmtiExtensionEventInfo" label="Extension Event Info"> 9869 <field id="extension_event_index"> 9870 <jint/> 9871 <description> 9872 The identifying index of the event 9873 </description> 9874 </field> 9875 <field id="id"> 9876 <allocfieldbuf><char/></allocfieldbuf> 9877 <description> 9878 The identifier for the extension event, encoded as a 9879 <internallink id="mUTF">modified UTF-8</internallink> string. 9880 Uses package name conventions. 9881 For example, <code>com.sun.hotspot.bar</code> 9882 </description> 9883 </field> 9884 <field id="short_description"> 9885 <allocfieldbuf><char/></allocfieldbuf> 9886 <description> 9887 A one sentence description of the event, encoded as a 9888 <internallink id="mUTF">modified UTF-8</internallink> string. 9889 </description> 9890 </field> 9891 <field id="param_count"> 9892 <jint/> 9893 <description> 9894 The number of parameters excluding <code>jvmtiEnv *jvmti_env</code> 9895 </description> 9896 </field> 9897 <field id="params"> 9898 <allocfieldbuf outcount="param_count"> 9899 <struct>jvmtiParamInfo</struct> 9900 </allocfieldbuf> 9901 <description> 9902 Array of 9903 <fieldlink id="param_count" struct="jvmtiExtensionEventInfo"></fieldlink> 9904 parameters (<code>jvmtiEnv *jvmti_env</code> excluded) 9905 </description> 9906 </field> 9907 </typedef> 9908 9909 <description> 9910 Returns the set of extension events. 9911 </description> 9912 <origin>new</origin> 9913 <capabilities> 9914 </capabilities> 9915 <parameters> 9916 <param id="extension_count_ptr"> 9917 <outptr><jint/></outptr> 9918 <description> 9919 On return, points to the number of extension events 9920 </description> 9921 </param> 9922 <param id="extensions"> 9923 <allocbuf outcount="extension_count_ptr"><struct>jvmtiExtensionEventInfo</struct></allocbuf> 9924 <description> 9925 Returns an array of extension event info, one per event 9926 </description> 9927 </param> 9928 </parameters> 9929 <errors> 9930 </errors> 9931 </function> 9932 9933 <callback id="jvmtiExtensionEvent"> 9934 <void/> 9935 <synopsis>Extension Event</synopsis> 9936 <description> 9937 This is the implementation-specific event. 9938 The event handler is set with 9939 <functionlink id="SetExtensionEventCallback"/>. 9940 <p/> 9941 Event handlers for extension events must be declared varargs to match this definition. 9942 Failure to do so could result in calling convention mismatch and undefined behavior 9943 on some platforms. 9944 <p/> 9945 For example, if the <code>jvmtiParamInfo</code> 9946 returned by <functionlink id="GetExtensionEvents"/> indicates that 9947 there is a <code>jint</code> parameter, the event handler should be 9948 declared: 9949 <example> 9950 void JNICALL myHandler(jvmtiEnv* jvmti_env, jint myInt, ...) 9951 </example> 9952 Note the terminal "<code>...</code>" which indicates varargs. 9953 </description> 9954 <parameters> 9955 <param id="jvmti_env"> 9956 <outptr> 9957 <struct>jvmtiEnv</struct> 9958 </outptr> 9959 <description> 9960 The <jvmti/> environment is the only fixed parameter for extension events. 9961 </description> 9962 </param> 9963 <param id="..."> 9964 <varargs/> 9965 <description> 9966 The extension event-specific parameters 9967 </description> 9968 </param> 9969 </parameters> 9970 </callback> 9971 9972 <function id="SetExtensionEventCallback" phase="onload" num="126"> 9973 <synopsis>Set Extension Event Callback</synopsis> 9974 9975 <description> 9976 Sets the callback function for an extension event and 9977 enables the event. Or, if the callback is <code>NULL</code>, disables 9978 the event. Note that unlike standard events, setting 9979 the callback and enabling the event are a single operation. 9980 </description> 9981 <origin>new</origin> 9982 <capabilities> 9983 </capabilities> 9984 <parameters> 9985 <param id="extension_event_index"> 9986 <jint/> 9987 <description> 9988 Identifies which callback to set. 9989 This index is the 9990 <fieldlink id="extension_event_index" struct="jvmtiExtensionEventInfo"></fieldlink> 9991 field of 9992 <datalink id="jvmtiExtensionEventInfo"/>. 9993 </description> 9994 </param> 9995 <param id="callback"> 9996 <ptrtype> 9997 <struct>jvmtiExtensionEvent</struct> 9998 <nullok>disable the event</nullok> 9999 </ptrtype> 10000 <description> 10001 If <code>callback</code> is non-<code>NULL</code>, 10002 set <code>callback</code> to be the event callback function 10003 and enable the event. 10004 </description> 10005 </param> 10006 </parameters> 10007 <errors> 10008 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 10009 <paramlink id="extension_event_index"/> is not an 10010 <fieldlink id="extension_event_index" 10011 struct="jvmtiExtensionEventInfo"/> 10012 returned by 10013 <functionlink id="GetExtensionEvents"/> 10014 </error> 10015 </errors> 10016 </function> 10017 10018 </category> 10019 10020 <category id="capability" label="Capability"> 10021 10022 <intro> 10023 The capabilities functions allow you to change the 10024 functionality available to <jvmti/>--that is, 10025 which <jvmti/> 10026 functions can be called, what events can be generated, 10027 and what functionality these events and functions can 10028 provide. 10029 <p/> 10030 The "Capabilities" section of each function and event describe which 10031 capabilities, if any, they are associated with. "Required Functionality" 10032 means it is available for use and no capabilities must be added to use it. 10033 "Optional Functionality" means the agent must possess the capability 10034 before it can be used. 10035 To possess a capability, the agent must 10036 <functionlink id="AddCapabilities">add the capability</functionlink>. 10037 "Optional Features" describe capabilities which, 10038 if added, extend the feature set. 10039 <p/> 10040 The potentially available capabilities of each <jvmti/> implementation are different. 10041 Depending on the implementation, a capability: 10042 <ul> 10043 <li>may never be added</li> 10044 <li>may be added in either the <code>OnLoad</code> or live phase in any environment</li> 10045 <li>may be added only during the <code>OnLoad</code> phase</li> 10046 <li>may be possessed by only one environment at a time</li> 10047 <li>may be possessed by only one environment at a time, 10048 and only during the <code>OnLoad</code> phase</li> 10049 <li>and so on ...</li> 10050 </ul> 10051 Frequently, the addition of a capability may incur a cost in execution speed, start up 10052 time, and/or memory footprint. Note that the overhead of using a capability 10053 is completely different than the overhead of possessing a capability. 10054 Take single stepping as an example. When single stepping is on (that 10055 is, when the event is enabled and thus actively sending events) 10056 the overhead of sending and processing an event 10057 on each instruction is huge in any implementation. 10058 However, the overhead of possessing the capability may be small or large, 10059 depending on the implementation. Also, when and if a capability is potentially 10060 available depends on the implementation. Some examples: 10061 <ul> 10062 <li>One VM might perform all execution by compiling bytecodes into 10063 native code and be unable to generate single step instructions. 10064 In this implementation the capability can not be added.</li> 10065 <li>Another VM may be able to switch execution to a single stepping 10066 interpreter at any time. In this implementation, having the capability has no 10067 overhead and could be added at any time.</li> 10068 <li>Yet another VM might be able to choose a bytecode compiling or single stepping capable interpreted 10069 execution engine at start up, but be unable to switch between them. 10070 In this implementation the capability would need to be added 10071 during the <code>OnLoad</code> phase (before bytecode 10072 execution begins) and would have a large impact on execution speed 10073 even if single stepping was never used.</li> 10074 <li>Still another VM might be able to add an "is single stepping on" check 10075 into compiled bytecodes or a generated interpreter. Again in this implementation 10076 the capability would need to be added during the <code>OnLoad</code> phase but the overhead (a test 10077 and branch on each instruction) would be considerably less.</li> 10078 </ul> 10079 <p/> 10080 Each <jvmti/> <internallink id="environments">environment</internallink> 10081 has its own set of capabilities. 10082 Initially, that set is empty. 10083 Any desired capability must be added. 10084 If possible, capabilities should be added during the <code>OnLoad</code> phase. For most 10085 virtual machines certain capabilities require special set up for 10086 the virtual machine and this set up must happen 10087 during the <code>OnLoad</code> phase, before the virtual machine begins execution. 10088 Once a capability is added, it can 10089 only be removed if explicitly relinquished by the environment. 10090 <p/> 10091 The agent can, 10092 <functionlink id="GetPotentialCapabilities">determine what 10093 capabilities this VM can potentially provide</functionlink>, 10094 <functionlink id="AddCapabilities">add the capabilities 10095 to be used</functionlink>, 10096 <functionlink id="RelinquishCapabilities">release capabilities 10097 which are no longer needed</functionlink>, and 10098 <functionlink id="GetCapabilities">examine the currently available 10099 capabilities</functionlink>. 10100 </intro> 10101 10102 <intro id="capabilityExamples" label="Capability Examples"> 10103 For example, a freshly started agent (in the <code>OnLoad</code> function) 10104 wants to enable all possible capabilities. 10105 Note that, in general, this is not advisable as the agent may suffer 10106 a performance penalty for functionality it is not using. 10107 The code might look like this in C: 10108 <example> 10109 jvmtiCapabilities capa; 10110 jvmtiError err; 10111 10112 err = (*jvmti)->GetPotentialCapabilities(jvmti, &capa); 10113 if (err == JVMTI_ERROR_NONE) { 10114 err = (*jvmti)->AddCapabilities(jvmti, &capa); 10115 </example> 10116 For example, if an agent wants to check if it can get 10117 the bytecodes of a method (that is, it wants to check 10118 if it previously added this capability and has not 10119 relinquished it), the code might 10120 look like this in C: 10121 <example> 10122 jvmtiCapabilities capa; 10123 jvmtiError err; 10124 10125 err = (*jvmti)->GetCapabilities(jvmti, &capa); 10126 if (err == JVMTI_ERROR_NONE) { 10127 if (capa.can_get_bytecodes) { ... } } 10128 </example> 10129 </intro> 10130 10131 <capabilitiestypedef id="jvmtiCapabilities" label="The Capabilities Structure"> 10132 <description> 10133 The functions in this category use this capabilities structure 10134 which contains boolean flags corresponding to each capability: 10135 </description> 10136 <capabilityfield id="can_tag_objects"> 10137 <description> 10138 Can set and get tags, as described in the 10139 <internallink id="Heap">Heap category</internallink>. 10140 </description> 10141 </capabilityfield> 10142 <capabilityfield id="can_generate_field_modification_events"> 10143 <description> 10144 Can set watchpoints on field modification - 10145 <functionlink id="SetFieldModificationWatch"></functionlink> 10146 </description> 10147 </capabilityfield> 10148 <capabilityfield id="can_generate_field_access_events"> 10149 <description> 10150 Can set watchpoints on field access - 10151 <functionlink id="SetFieldAccessWatch"></functionlink> 10152 </description> 10153 </capabilityfield> 10154 <capabilityfield id="can_get_bytecodes"> 10155 <description> 10156 Can get bytecodes of a method <functionlink id="GetBytecodes"></functionlink> 10157 </description> 10158 </capabilityfield> 10159 <capabilityfield id="can_get_synthetic_attribute"> 10160 <description> 10161 Can test if a field or method is synthetic - 10162 <functionlink id="IsFieldSynthetic"></functionlink> and 10163 <functionlink id="IsMethodSynthetic"></functionlink> 10164 </description> 10165 </capabilityfield> 10166 <capabilityfield id="can_get_owned_monitor_info"> 10167 <description> 10168 Can get information about ownership of monitors - 10169 <functionlink id="GetOwnedMonitorInfo"></functionlink> 10170 </description> 10171 </capabilityfield> 10172 <capabilityfield id="can_get_current_contended_monitor"> 10173 <description> 10174 Can <functionlink id="GetCurrentContendedMonitor"></functionlink> 10175 </description> 10176 </capabilityfield> 10177 <capabilityfield id="can_get_monitor_info"> 10178 <description> 10179 Can <functionlink id="GetObjectMonitorUsage"></functionlink> 10180 </description> 10181 </capabilityfield> 10182 <capabilityfield id="can_pop_frame"> 10183 <description> 10184 Can pop frames off the stack - <functionlink id="PopFrame"></functionlink> 10185 </description> 10186 </capabilityfield> 10187 <capabilityfield id="can_redefine_classes"> 10188 <description> 10189 Can redefine classes with <functionlink id="RedefineClasses"/>. 10190 </description> 10191 </capabilityfield> 10192 <capabilityfield id="can_signal_thread"> 10193 <description> 10194 Can send stop or interrupt to threads 10195 </description> 10196 </capabilityfield> 10197 <capabilityfield id="can_get_source_file_name"> 10198 <description> 10199 Can get the source file name of a class 10200 </description> 10201 </capabilityfield> 10202 <capabilityfield id="can_get_line_numbers"> 10203 <description> 10204 Can get the line number table of a method 10205 </description> 10206 </capabilityfield> 10207 <capabilityfield id="can_get_source_debug_extension"> 10208 <description> 10209 Can get the source debug extension of a class 10210 </description> 10211 </capabilityfield> 10212 <capabilityfield id="can_access_local_variables"> 10213 <description> 10214 Can set and get local variables 10215 </description> 10216 </capabilityfield> 10217 <capabilityfield id="can_maintain_original_method_order"> 10218 <description> 10219 Can return methods in the order they occur in the class file 10220 </description> 10221 </capabilityfield> 10222 <capabilityfield id="can_generate_single_step_events"> 10223 <description> 10224 Can get <eventlink id="SingleStep">single step</eventlink> events 10225 </description> 10226 </capabilityfield> 10227 <capabilityfield id="can_generate_exception_events"> 10228 <description> 10229 Can get <eventlink id="Exception">exception thrown</eventlink> and 10230 <eventlink id="ExceptionCatch">exception catch</eventlink> events 10231 </description> 10232 </capabilityfield> 10233 <capabilityfield id="can_generate_frame_pop_events"> 10234 <description> 10235 Can <functionlink id="NotifyFramePop">set</functionlink> and thus get 10236 <eventlink id="FramePop"></eventlink> events 10237 </description> 10238 </capabilityfield> 10239 <capabilityfield id="can_generate_breakpoint_events"> 10240 <description> 10241 Can <functionlink id="SetBreakpoint">set</functionlink> and thus get 10242 <eventlink id="Breakpoint"></eventlink> events 10243 </description> 10244 </capabilityfield> 10245 <capabilityfield id="can_suspend"> 10246 <description> 10247 Can suspend and resume threads 10248 </description> 10249 </capabilityfield> 10250 <capabilityfield id="can_redefine_any_class"> 10251 <description> 10252 <functionlink id="RedefineClasses"/> can be called on any modifiable class. 10253 See <functionlink id="IsModifiableClass"/>. 10254 (<fieldlink id="can_redefine_classes" struct="jvmtiCapabilities"/> 10255 must also be set) 10256 </description> 10257 </capabilityfield> 10258 <capabilityfield id="can_get_current_thread_cpu_time"> 10259 <description> 10260 Can <functionlink id="GetCurrentThreadCpuTime">get</functionlink> 10261 current thread CPU time 10262 </description> 10263 </capabilityfield> 10264 <capabilityfield id="can_get_thread_cpu_time"> 10265 <description> 10266 Can <functionlink id="GetThreadCpuTime">get</functionlink> 10267 thread CPU time 10268 </description> 10269 </capabilityfield> 10270 <capabilityfield id="can_generate_method_entry_events" 10271 disp1="can_generate" disp2="_method_entry_events" 10272 > 10273 <description> 10274 Can generate method entry events on entering a method 10275 </description> 10276 </capabilityfield> 10277 <capabilityfield id="can_generate_method_exit_events" 10278 disp1="can_generate" disp2="_method_exit_events" 10279 > 10280 <description> 10281 Can generate method exit events on leaving a method 10282 </description> 10283 </capabilityfield> 10284 <capabilityfield id="can_generate_all_class_hook_events" 10285 disp1="can_generate" disp2="_all_class_hook_events" 10286 > 10287 <description> 10288 Can generate ClassFileLoadHook events for every loaded class. 10289 </description> 10290 </capabilityfield> 10291 <capabilityfield id="can_generate_compiled_method_load_events" 10292 disp1="can_generate" disp2="_compiled_method_load_events" 10293 > 10294 <description> 10295 Can generate events when a method is compiled or unloaded 10296 </description> 10297 </capabilityfield> 10298 <capabilityfield id="can_generate_monitor_events" 10299 disp1="can_generate" disp2="_monitor_events" 10300 > 10301 <description> 10302 Can generate events on monitor activity 10303 </description> 10304 </capabilityfield> 10305 <capabilityfield id="can_generate_vm_object_alloc_events" 10306 disp1="can_generate" disp2="_vm_object_alloc_events" 10307 > 10308 <description> 10309 Can generate events on VM allocation of an object 10310 </description> 10311 </capabilityfield> 10312 <capabilityfield id="can_generate_native_method_bind_events" 10313 disp1="can_generate" disp2="_native_method_bind_events" 10314 > 10315 <description> 10316 Can generate events when a native method is bound to its 10317 implementation 10318 </description> 10319 </capabilityfield> 10320 <capabilityfield id="can_generate_garbage_collection_events" 10321 disp1="can_generate" disp2="_garbage_collection_events" 10322 > 10323 <description> 10324 Can generate events when garbage collection begins or ends 10325 </description> 10326 </capabilityfield> 10327 <capabilityfield id="can_generate_object_free_events" 10328 disp1="can_generate" disp2="_object_free_events" 10329 > 10330 <description> 10331 Can generate events when the garbage collector frees an object 10332 </description> 10333 </capabilityfield> 10334 <capabilityfield id="can_force_early_return" since="1.1"> 10335 <description> 10336 Can return early from a method, as described in the 10337 <internallink id="ForceEarlyReturn">Force Early Return category</internallink>. 10338 </description> 10339 </capabilityfield> 10340 <capabilityfield id="can_get_owned_monitor_stack_depth_info" since="1.1"> 10341 <description> 10342 Can get information about owned monitors with stack depth - 10343 <functionlink id="GetOwnedMonitorStackDepthInfo"></functionlink> 10344 </description> 10345 </capabilityfield> 10346 <capabilityfield id="can_get_constant_pool" since="1.1"> 10347 <description> 10348 Can get the constant pool of a class - 10349 <functionlink id="GetConstantPool"></functionlink> 10350 </description> 10351 </capabilityfield> 10352 <capabilityfield id="can_set_native_method_prefix" since="1.1"> 10353 <description> 10354 Can set prefix to be applied when native method cannot be resolved - 10355 <functionlink id="SetNativeMethodPrefix"/> and 10356 <functionlink id="SetNativeMethodPrefixes"/> 10357 </description> 10358 </capabilityfield> 10359 <capabilityfield id="can_retransform_classes" since="1.1"> 10360 <description> 10361 Can retransform classes with <functionlink id="RetransformClasses"/>. 10362 In addition to the restrictions imposed by the specific 10363 implementation on this capability (see the 10364 <internallink id="capability">Capability</internallink> section), 10365 this capability must be set before the 10366 <eventlink id="ClassFileLoadHook"/> event is enabled for the 10367 first time in this environment. 10368 An environment that possesses this capability at the time that 10369 <code>ClassFileLoadHook</code> is enabled for the first time is 10370 said to be <i>retransformation capable</i>. 10371 An environment that does not possess this capability at the time that 10372 <code>ClassFileLoadHook</code> is enabled for the first time is 10373 said to be <i>retransformation incapable</i>. 10374 </description> 10375 </capabilityfield> 10376 <capabilityfield id="can_retransform_any_class" since="1.1"> 10377 <description> 10378 <functionlink id="RetransformClasses"/> can be called on any modifiable class. 10379 See <functionlink id="IsModifiableClass"/>. 10380 (<fieldlink id="can_retransform_classes" struct="jvmtiCapabilities"/> 10381 must also be set) 10382 </description> 10383 </capabilityfield> 10384 <capabilityfield id="can_generate_resource_exhaustion_heap_events" since="1.1"> 10385 <description> 10386 Can generate events when the VM is unable to allocate memory from 10387 the <tm>Java</tm> platform heap. 10388 See <eventlink id="ResourceExhausted"/>. 10389 </description> 10390 </capabilityfield> 10391 <capabilityfield id="can_generate_resource_exhaustion_threads_events" since="1.1"> 10392 <description> 10393 Can generate events when the VM is unable to create a thread. 10394 See <eventlink id="ResourceExhausted"/>. 10395 </description> 10396 </capabilityfield> 10397 <capabilityfield id="can_generate_early_vmstart" since="9"> 10398 <description> 10399 Can generate the <code>VMStart</code> event early. 10400 See <eventlink id="VMStart"/>. 10401 </description> 10402 </capabilityfield> 10403 <capabilityfield id="can_generate_early_class_hook_events" since="9"> 10404 <description> 10405 Can generate the <eventlink id="ClassFileLoadHook"/> events 10406 in the primordial phase. If this capability and 10407 <internallink id="jvmtiCapabilities.can_generate_all_class_hook_events"> 10408 <code>can_generate_all_class_hook_events</code></internallink> 10409 are enabled then the <eventlink id="ClassFileLoadHook"/> events 10410 can be posted for classes loaded in the primordial phase. 10411 See <eventlink id="ClassFileLoadHook"/>. 10412 </description> 10413 </capabilityfield> 10414 <capabilityfield id="can_generate_sampled_object_alloc_events" since="11"> 10415 <description> 10416 Can generate sampled allocation events. 10417 If this capability is enabled then the heap sampling method 10418 <functionlink id="SetHeapSamplingInterval"></functionlink> can be 10419 called and <eventlink id="SampledObjectAlloc"></eventlink> events can be generated. 10420 </description> 10421 </capabilityfield> 10422 </capabilitiestypedef> 10423 10424 <function id="GetPotentialCapabilities" jkernel="yes" phase="onload" num="140"> 10425 <synopsis>Get Potential Capabilities</synopsis> 10426 <description> 10427 Returns via <paramlink id="capabilities_ptr"></paramlink> the <jvmti/> 10428 features that can potentially be possessed by this environment 10429 at this time. 10430 The returned capabilities differ from the complete set of capabilities 10431 implemented by the VM in two cases: another environment possesses 10432 capabilities that can only be possessed by one environment, or the 10433 current <functionlink id="GetPhase">phase</functionlink> is live, 10434 and certain capabilities can only be added during the <code>OnLoad</code> phase. 10435 The <functionlink id="AddCapabilities"></functionlink> function 10436 may be used to set any or all or these capabilities. 10437 Currently possessed capabilities are included. 10438 <p/> 10439 Typically this function is used in the <code>OnLoad</code> function. 10440 Some virtual machines may allow a limited set of capabilities to be 10441 added in the live phase. 10442 In this case, the set of potentially available capabilities 10443 will likely differ from the <code>OnLoad</code> phase set. 10444 <p/> 10445 See the 10446 <internallink id="capabilityExamples">Capability Examples</internallink>. 10447 </description> 10448 <origin>new</origin> 10449 <capabilities> 10450 </capabilities> 10451 <parameters> 10452 <param id="capabilities_ptr"> 10453 <outptr><struct>jvmtiCapabilities</struct></outptr> 10454 <description> 10455 On return, points to the <jvmti/> capabilities that may be added. 10456 </description> 10457 </param> 10458 </parameters> 10459 <errors> 10460 </errors> 10461 </function> 10462 10463 <elide> 10464 <function id="EstimateCostOfCapabilities" phase="onload" num="141"> 10465 <synopsis>Estimate Cost Of Capabilities</synopsis> 10466 <description> 10467 <issue>There is strong opposition to this function. The concern is 10468 that it would be difficult or impossible to provide meaningful 10469 numbers, as the amount of impact is conditional on many factors 10470 that a single number could not represent. There is doubt that 10471 conditional implementations would be used or are even a good idea. 10472 The thought is that release documentation for the implementation 10473 would be the best means of exposing this information. 10474 Unless new arguments are presented, I intend to remove this 10475 function in the next revision. 10476 </issue> 10477 <p/> 10478 Return via the <paramlink id="time_impact_ptr"></paramlink> and 10479 <paramlink id="space_impact_ptr"></paramlink> an estimate of the impact 10480 of adding the capabilities pointed to by 10481 <paramlink id="capabilities_ptr"></paramlink>. 10482 The returned estimates are in percentage of additional overhead, thus 10483 a time impact of 100 mean the application might run 10484 at half the speed. 10485 The estimates are very rough approximations and are not guaranteed. 10486 Note also, that the estimates are of the impact of having the 10487 capability available--when and if it is used the impact may be 10488 much greater. 10489 Estimates can be for a single capability or for a set of 10490 capabilities. Note that the costs are not necessarily additive, 10491 adding support for one capability might make another available 10492 for free or conversely having two capabilities at once may 10493 have multiplicative impact. 10494 Estimates are relative to the current set of capabilities - 10495 that is, how much more impact given the currently possessed capabilities. 10496 <p/> 10497 Typically this function is used in the OnLoad function, 10498 some virtual machines may allow a limited set of capabilities to be 10499 added in the live phase. 10500 In this case, the set of potentially available capabilities 10501 will likely differ from the OnLoad phase set. 10502 <p/> 10503 See the 10504 <internallink id="capabilityExamples">Capability Examples</internallink>. 10505 </description> 10506 <origin>new</origin> 10507 <capabilities> 10508 </capabilities> 10509 <parameters> 10510 <param id="capabilities_ptr"> 10511 <inptr><struct>jvmtiCapabilities</struct></inptr> 10512 <description> 10513 points to the <jvmti/> capabilities to evaluate. 10514 </description> 10515 </param> 10516 <param id="time_impact_ptr"> 10517 <outptr><jint/></outptr> 10518 <description> 10519 On return, points to the estimated percentage increase in 10520 run time if this capability was added. 10521 </description> 10522 </param> 10523 <param id="space_impact_ptr"> 10524 <outptr><jint/></outptr> 10525 <description> 10526 On return, points to the estimated percentage increase in 10527 memory space used if this capability was added. 10528 </description> 10529 </param> 10530 </parameters> 10531 <errors> 10532 <error id="JVMTI_ERROR_NOT_AVAILABLE"> 10533 The desired capabilities are not even potentially available. 10534 </error> 10535 </errors> 10536 </function> 10537 </elide> 10538 10539 <function id="AddCapabilities" jkernel="yes" phase="onload" num="142"> 10540 <synopsis>Add Capabilities</synopsis> 10541 <description> 10542 Set new capabilities by adding the capabilities 10543 whose values are set to one (<code>1</code>) in 10544 <code>*</code><paramlink id="capabilities_ptr"></paramlink>. 10545 All previous capabilities are retained. 10546 Typically this function is used in the <code>OnLoad</code> function. 10547 Some virtual machines may allow a limited set of capabilities to be 10548 added in the live phase. 10549 <p/> 10550 See the 10551 <internallink id="capabilityExamples">Capability Examples</internallink>. 10552 </description> 10553 <origin>new</origin> 10554 <capabilities> 10555 </capabilities> 10556 <parameters> 10557 <param id="capabilities_ptr"> 10558 <inptr><struct>jvmtiCapabilities</struct></inptr> 10559 <description> 10560 Points to the <jvmti/> capabilities to add. 10561 </description> 10562 </param> 10563 </parameters> 10564 <errors> 10565 <error id="JVMTI_ERROR_NOT_AVAILABLE"> 10566 The desired capabilities are not even potentially available. 10567 </error> 10568 </errors> 10569 </function> 10570 10571 10572 <function id="RelinquishCapabilities" phase="onload" num="143"> 10573 <synopsis>Relinquish Capabilities</synopsis> 10574 <description> 10575 Relinquish the capabilities 10576 whose values are set to one (<code>1</code>) in 10577 <code>*</code><paramlink id="capabilities_ptr"></paramlink>. 10578 Some implementations may allow only one environment to have a capability 10579 (see the <internallink id="capability">capability introduction</internallink>). 10580 This function releases capabilities 10581 so that they may be used by other agents. 10582 All other capabilities are retained. 10583 The capability will no longer be present in <functionlink id="GetCapabilities"></functionlink>. 10584 Attempting to relinquish a capability that the agent does not possess is not an error. 10585 <issue> 10586 It is possible for the agent to be actively using capabilities 10587 which are being relinquished. For example, a thread is currently 10588 suspended and can_suspend is being relinquished or an event is currently 10589 enabled and can_generate_whatever is being relinquished. 10590 There are three possible ways we could spec this: 10591 <ul> 10592 <li>relinquish automatically releases them</li> 10593 <li>relinquish checks and returns some error code if held</li> 10594 <li>it is the agent's responsibility and it is not checked</li> 10595 </ul> 10596 One of these should be chosen. 10597 </issue> 10598 </description> 10599 <origin>new</origin> 10600 <capabilities> 10601 </capabilities> 10602 <parameters> 10603 <param id="capabilities_ptr"> 10604 <inptr><struct>jvmtiCapabilities</struct></inptr> 10605 <description> 10606 Points to the <jvmti/> capabilities to relinquish. 10607 </description> 10608 </param> 10609 </parameters> 10610 <errors> 10611 </errors> 10612 </function> 10613 10614 10615 10616 <function id="GetCapabilities" jkernel="yes" phase="any" num="89"> 10617 <synopsis>Get Capabilities</synopsis> 10618 <description> 10619 Returns via <paramlink id="capabilities_ptr"></paramlink> the optional <jvmti/> 10620 features which this environment currently possesses. 10621 Each possessed capability is indicated by a one (<code>1</code>) in the 10622 corresponding field of the <internallink id="jvmtiCapabilities">capabilities 10623 structure</internallink>. 10624 An environment does not possess a capability unless it has been successfully added with 10625 <functionlink id="AddCapabilities"/>. 10626 An environment only loses possession of a capability if it has been relinquished with 10627 <functionlink id="RelinquishCapabilities"/>. Thus, this function returns the net result 10628 of the <code>AddCapabilities</code> and <code>RelinquishCapabilities</code> calls which 10629 have been made. 10630 <p/> 10631 See the 10632 <internallink id="capabilityExamples">Capability Examples</internallink>. 10633 </description> 10634 <origin>jvmdiClone</origin> 10635 <capabilities> 10636 </capabilities> 10637 <parameters> 10638 <param id="capabilities_ptr"> 10639 <outptr><struct>jvmtiCapabilities</struct></outptr> 10640 <description> 10641 On return, points to the <jvmti/> capabilities. 10642 </description> 10643 </param> 10644 </parameters> 10645 <errors> 10646 </errors> 10647 </function> 10648 10649 </category> 10650 10651 10652 <category id="timers" label="Timers"> 10653 10654 <intro> 10655 These functions provide timing information. 10656 The resolution at which the time is updated is not specified. 10657 They provides nanosecond precision, but not necessarily nanosecond accuracy. 10658 Details about the timers, such as their maximum values, can be accessed with 10659 the timer information functions. 10660 </intro> 10661 10662 <typedef id="jvmtiTimerInfo" label="Timer Info"> 10663 <description> 10664 The information function for each timer returns this data structure. 10665 </description> 10666 <field id="max_value"> 10667 <jlong/> 10668 <description> 10669 The maximum value the timer can reach. 10670 After this value is reached the timer wraps back to zero. 10671 This is an unsigned value. If tested or printed as a jlong (signed value) 10672 it may appear to be a negative number. 10673 </description> 10674 </field> 10675 <field id="may_skip_forward"> 10676 <jboolean/> 10677 <description> 10678 If true, the timer can be externally adjusted and as a result skip forward. 10679 If false, the timer value will never increase faster than real time. 10680 </description> 10681 </field> 10682 <field id="may_skip_backward"> 10683 <jboolean/> 10684 <description> 10685 If true, the timer can be externally adjusted and as a result skip backward. 10686 If false, the timer value will be monotonically increasing. 10687 </description> 10688 </field> 10689 <field id="kind"> 10690 <enum>jvmtiTimerKind</enum> 10691 <description> 10692 The kind of timer. 10693 On a platform that does not distinguish between user and system time, <datalink 10694 id="JVMTI_TIMER_TOTAL_CPU"><code>JVMTI_TIMER_TOTAL_CPU</code></datalink> 10695 is returned. 10696 </description> 10697 </field> 10698 <field id="reserved1"> 10699 <jlong/> 10700 <description> 10701 Reserved for future use. 10702 </description> 10703 </field> 10704 <field id="reserved2"> 10705 <jlong/> 10706 <description> 10707 Reserved for future use. 10708 </description> 10709 </field> 10710 </typedef> 10711 10712 <intro> 10713 Where the timer kind is -- 10714 10715 <constants id="jvmtiTimerKind" label="Timer Kinds" kind="enum"> 10716 <constant id="JVMTI_TIMER_USER_CPU" num="30"> 10717 CPU time that a thread is in user mode. 10718 </constant> 10719 <constant id="JVMTI_TIMER_TOTAL_CPU" num="31"> 10720 CPU time that a thread is in user or system mode. 10721 </constant> 10722 <constant id="JVMTI_TIMER_ELAPSED" num="32"> 10723 Elapsed time. 10724 </constant> 10725 </constants> 10726 </intro> 10727 10728 <function id="GetCurrentThreadCpuTimerInfo" callbacksafe="safe" impl="innative notrace" phase="start" num="134"> 10729 <synopsis>Get Current Thread CPU Timer Information</synopsis> 10730 <description> 10731 Get information about the 10732 <functionlink id="GetCurrentThreadCpuTime"/> timer. 10733 The fields of the <datalink id="jvmtiTimerInfo"/> structure 10734 are filled in with details about the timer. 10735 This information is specific to the platform and the implementation of 10736 <functionlink id="GetCurrentThreadCpuTime"/> and thus 10737 does not vary by thread nor does it vary 10738 during a particular invocation of the VM. 10739 <p/> 10740 Note that the implementations of <functionlink id="GetCurrentThreadCpuTime"/> 10741 and <functionlink id="GetThreadCpuTime"/> may differ, and thus the values 10742 returned by <code>GetCurrentThreadCpuTimerInfo</code> 10743 and <functionlink id="GetThreadCpuTimerInfo"/> 10744 may differ -- see <functionlink id="GetCurrentThreadCpuTime"/> for more information. 10745 </description> 10746 <origin>new</origin> 10747 <capabilities> 10748 <required id="can_get_current_thread_cpu_time"> 10749 Can get current thread CPU time. 10750 </required> 10751 </capabilities> 10752 <parameters> 10753 <param id="info_ptr"> 10754 <outptr><struct>jvmtiTimerInfo</struct></outptr> 10755 <description> 10756 On return, filled with information describing the time 10757 returned by <functionlink id="GetCurrentThreadCpuTime"/>. 10758 </description> 10759 </param> 10760 </parameters> 10761 <errors> 10762 </errors> 10763 </function> 10764 10765 <function id="GetCurrentThreadCpuTime" callbacksafe="safe" impl="innative notrace" phase="start" num="135"> 10766 <synopsis>Get Current Thread CPU Time</synopsis> 10767 <description> 10768 Return the CPU time utilized by the current thread. 10769 <p/> 10770 Note that the <functionlink id="GetThreadCpuTime"/> 10771 function provides CPU time for any thread, including 10772 the current thread. <code>GetCurrentThreadCpuTime</code> 10773 exists to support platforms which cannot 10774 supply CPU time for threads other than the current 10775 thread or which have more accurate information for 10776 the current thread (see 10777 <functionlink id="GetCurrentThreadCpuTimerInfo"/> vs 10778 <functionlink id="GetThreadCpuTimerInfo"/>). 10779 On many platforms this call will be equivalent to: 10780 <example> 10781 GetThreadCpuTime(env, NULL, nanos_ptr) 10782 </example> 10783 </description> 10784 <origin>new</origin> 10785 <capabilities> 10786 <required id="can_get_current_thread_cpu_time"> 10787 Can get current thread CPU time. 10788 <p/> 10789 If this capability is enabled after threads have started, 10790 the implementation may choose any time up 10791 to and including the time that the capability is enabled 10792 as the point where CPU time collection starts. 10793 <p/> 10794 This capability must be potentially available on any 10795 platform where 10796 <internallink id="jvmtiCapabilities.can_get_thread_cpu_time"><code>can_get_thread_cpu_time</code></internallink> 10797 is potentially available. 10798 </required> 10799 </capabilities> 10800 <parameters> 10801 <param id="nanos_ptr"> 10802 <outptr><jlong/></outptr> 10803 <description> 10804 On return, points to the CPU time used by this thread 10805 in nanoseconds. 10806 This is an unsigned value. If tested or printed as a jlong (signed value) 10807 it may appear to be a negative number. 10808 </description> 10809 </param> 10810 </parameters> 10811 <errors> 10812 </errors> 10813 </function> 10814 10815 <function id="GetThreadCpuTimerInfo" num="136"> 10816 <synopsis>Get Thread CPU Timer Information</synopsis> 10817 <description> 10818 Get information about the 10819 <functionlink id="GetThreadCpuTime"/> timer. 10820 The fields of the <datalink id="jvmtiTimerInfo"/> structure 10821 are filled in with details about the timer. 10822 This information is specific to the platform and the implementation of 10823 <functionlink id="GetThreadCpuTime"/> and thus 10824 does not vary by thread nor does it vary 10825 during a particular invocation of the VM. 10826 <p/> 10827 Note that the implementations of <functionlink id="GetCurrentThreadCpuTime"/> 10828 and <functionlink id="GetThreadCpuTime"/> may differ, and thus the values 10829 returned by <functionlink id="GetCurrentThreadCpuTimerInfo"/> 10830 and <code>GetThreadCpuTimerInfo</code> 10831 may differ -- see <functionlink id="GetCurrentThreadCpuTime"/> for more information. 10832 </description> 10833 <origin>new</origin> 10834 <capabilities> 10835 <required id="can_get_thread_cpu_time"> 10836 Can get thread CPU time. 10837 </required> 10838 </capabilities> 10839 <parameters> 10840 <param id="info_ptr"> 10841 <outptr><struct>jvmtiTimerInfo</struct></outptr> 10842 <description> 10843 On return, filled with information describing the time 10844 returned by <functionlink id="GetThreadCpuTime"/>. 10845 </description> 10846 </param> 10847 </parameters> 10848 <errors> 10849 </errors> 10850 </function> 10851 10852 <function id="GetThreadCpuTime" num="137"> 10853 <synopsis>Get Thread CPU Time</synopsis> 10854 <description> 10855 Return the CPU time utilized by the specified thread. 10856 <p/> 10857 Get information about this timer with 10858 <functionlink id="GetThreadCpuTimerInfo"/>. 10859 </description> 10860 <origin>new</origin> 10861 <capabilities> 10862 <required id="can_get_thread_cpu_time"> 10863 Can get thread CPU time. 10864 <p/> 10865 If this capability is enabled after threads have started, 10866 the implementation may choose any time up 10867 to and including the time that the capability is enabled 10868 as the point where CPU time collection starts. 10869 </required> 10870 </capabilities> 10871 <parameters> 10872 <param id="thread"> 10873 <jthread null="current"/> 10874 <description> 10875 The thread to query. 10876 </description> 10877 </param> 10878 <param id="nanos_ptr"> 10879 <outptr><jlong/></outptr> 10880 <description> 10881 On return, points to the CPU time used by the specified thread 10882 in nanoseconds. 10883 This is an unsigned value. If tested or printed as a jlong (signed value) 10884 it may appear to be a negative number. 10885 </description> 10886 </param> 10887 </parameters> 10888 <errors> 10889 </errors> 10890 </function> 10891 10892 <function id="GetTimerInfo" phase="any" callbacksafe="safe" num="138"> 10893 <synopsis>Get Timer Information</synopsis> 10894 <description> 10895 Get information about the 10896 <functionlink id="GetTime"/> timer. 10897 The fields of the <datalink id="jvmtiTimerInfo"/> structure 10898 are filled in with details about the timer. 10899 This information will not change during a particular invocation of the VM. 10900 </description> 10901 <origin>new</origin> 10902 <capabilities> 10903 </capabilities> 10904 <parameters> 10905 <param id="info_ptr"> 10906 <outptr><struct>jvmtiTimerInfo</struct></outptr> 10907 <description> 10908 On return, filled with information describing the time 10909 returned by <functionlink id="GetTime"/>. 10910 </description> 10911 </param> 10912 </parameters> 10913 <errors> 10914 </errors> 10915 </function> 10916 10917 <function id="GetTime" phase="any" callbacksafe="safe" num="139"> 10918 <synopsis>Get Time</synopsis> 10919 <description> 10920 Return the current value of the system timer, in nanoseconds. 10921 <p/> 10922 The value returned represents nanoseconds since some fixed but 10923 arbitrary time (perhaps in the future, so values may be 10924 negative). This function provides nanosecond precision, but not 10925 necessarily nanosecond accuracy. No guarantees are made about 10926 how frequently values change. 10927 <p/> 10928 Get information about this timer with 10929 <functionlink id="GetTimerInfo"/>. 10930 </description> 10931 <origin>new</origin> 10932 <capabilities> 10933 </capabilities> 10934 <parameters> 10935 <param id="nanos_ptr"> 10936 <outptr><jlong/></outptr> 10937 <description> 10938 On return, points to the time in nanoseconds. 10939 This is an unsigned value. If tested or printed as a jlong (signed value) 10940 it may appear to be a negative number. 10941 </description> 10942 </param> 10943 </parameters> 10944 <errors> 10945 </errors> 10946 </function> 10947 10948 <function id="GetAvailableProcessors" phase="any" num="144"> 10949 <synopsis>Get Available Processors</synopsis> 10950 <description> 10951 Returns the number of processors available to the Java virtual machine. 10952 <p/> 10953 This value may change during a particular invocation of the virtual machine. 10954 Applications that are sensitive to the number of available processors should 10955 therefore occasionally poll this property. 10956 </description> 10957 <origin>new</origin> 10958 <capabilities> 10959 </capabilities> 10960 <parameters> 10961 <param id="processor_count_ptr"> 10962 <outptr><jint/></outptr> 10963 <description> 10964 On return, points to the maximum number of processors available to the 10965 virtual machine; never smaller than one. 10966 </description> 10967 </param> 10968 </parameters> 10969 <errors> 10970 </errors> 10971 </function> 10972 10973 </category> 10974 10975 10976 <category id="classLoaderSearch" label="Class Loader Search"> 10977 10978 <intro> 10979 These functions allow the agent to add to the locations that a class loader searches for a class. 10980 This is useful for installing instrumentation under the correct class loader. 10981 </intro> 10982 10983 <function id="AddToBootstrapClassLoaderSearch" jkernel="yes" phase="onload" num="149"> 10984 <synopsis>Add To Bootstrap Class Loader Search</synopsis> 10985 <description> 10986 This function can be used to cause instrumentation classes to be defined by the 10987 bootstrap class loader. See <vmspec chapter="5.3.1"/>. 10988 After the bootstrap 10989 class loader unsuccessfully searches for a class, the specified platform-dependent 10990 search path <paramlink id="segment"/> will be searched as well. Only one segment may be specified in 10991 the <paramlink id="segment"/>. This function may be called multiple times to add multiple segments, 10992 the segments will be searched in the order that this function was called. 10993 <p/> 10994 In the <code>OnLoad</code> phase the function may be used to specify any platform-dependent 10995 search path segment to be searched after the bootstrap class loader unsuccessfully searches 10996 for a class. The segment is typically a directory or JAR file. 10997 <p/> 10998 In the live phase the <paramlink id="segment"/> may be used to specify any platform-dependent 10999 path to a <externallink id="jar/jar.html"> 11000 JAR file</externallink>. The agent should take care that the JAR file does not 11001 contain any classes or resources other than those to be defined by the bootstrap 11002 class loader for the purposes of instrumentation. 11003 <p/> 11004 <vmspec/> specifies that a subsequent attempt to resolve a symbolic 11005 reference that the Java virtual machine has previously unsuccessfully attempted 11006 to resolve always fails with the same error that was thrown as a result of the 11007 initial resolution attempt. Consequently, if the JAR file contains an entry 11008 that corresponds to a class for which the Java virtual machine has 11009 unsuccessfully attempted to resolve a reference, then subsequent attempts to 11010 resolve that reference will fail with the same error as the initial attempt. 11011 </description> 11012 <origin>new</origin> 11013 <capabilities> 11014 </capabilities> 11015 <parameters> 11016 <param id="segment"> 11017 <inbuf><char/></inbuf> 11018 <description> 11019 The platform-dependent search path segment, encoded as a 11020 <internallink id="mUTF">modified UTF-8</internallink> string. 11021 </description> 11022 </param> 11023 </parameters> 11024 <errors> 11025 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 11026 <paramlink id="segment"/> is an invalid path. In the live phase, anything other than an 11027 existing JAR file is an invalid path. 11028 </error> 11029 </errors> 11030 </function> 11031 11032 <function id="AddToSystemClassLoaderSearch" jkernel="yes" phase="onload" num="151" since="1.1"> 11033 <synopsis>Add To System Class Loader Search</synopsis> 11034 <description> 11035 This function can be used to cause instrumentation classes to be 11036 defined by the system class loader. See <vmspec chapter="5.3.2"/>. 11037 After the class loader unsuccessfully searches for a class, the specified platform-dependent search 11038 path <paramlink id="segment"/> will be searched as well. Only one segment may be specified in the 11039 <paramlink id="segment"/>. This function may be called multiple times to add multiple segments, the 11040 segments will be searched in the order that this function was called. 11041 <p/> 11042 In the <code>OnLoad</code> phase the function may be used to specify any platform-dependent 11043 search path segment to be searched after the system class loader unsuccessfully searches 11044 for a class. The segment is typically a directory or JAR file. 11045 <p/> 11046 In the live phase the <paramlink id="segment"/> is a platform-dependent path to a 11047 <externallink id="jar/jar.html">JAR file</externallink> to be 11048 searched after the system class loader unsuccessfully searches for a class. The agent should 11049 take care that the JAR file does not contain any classes or resources other than those to be 11050 defined by the system class loader for the purposes of instrumentation. 11051 <p/> 11052 In the live phase the system class loader supports adding a JAR file to be searched if 11053 the system class loader implements a method name <code>appendToClassPathForInstrumentation</code> 11054 which takes a single parameter of type <code>java.lang.String</code>. The method is not required 11055 to have <code>public</code> access. 11056 <p/> 11057 <vmspec/> specifies that a subsequent attempt to resolve a symbolic 11058 reference that the Java virtual machine has previously unsuccessfully attempted 11059 to resolve always fails with the same error that was thrown as a result of the 11060 initial resolution attempt. Consequently, if the JAR file contains an entry 11061 that corresponds to a class for which the Java virtual machine has 11062 unsuccessfully attempted to resolve a reference, then subsequent attempts to 11063 resolve that reference will fail with the same error as the initial attempt. 11064 </description> 11065 <origin>new</origin> 11066 <capabilities> 11067 </capabilities> 11068 <parameters> 11069 <param id="segment"> 11070 <inbuf><char/></inbuf> 11071 <description> 11072 The platform-dependent search path segment, encoded as a 11073 <internallink id="mUTF">modified UTF-8</internallink> string. 11074 </description> 11075 </param> 11076 </parameters> 11077 <errors> 11078 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 11079 <paramlink id="segment"/> is an invalid path. In the live phase, anything other than an 11080 existing JAR file is an invalid path. 11081 </error> 11082 <error id="JVMTI_ERROR_CLASS_LOADER_UNSUPPORTED"> 11083 Operation not supported by the system class loader. 11084 </error> 11085 </errors> 11086 </function> 11087 11088 </category> 11089 11090 11091 <category id="props" label="System Properties"> 11092 11093 <intro> 11094 These functions get and set system properties. 11095 </intro> 11096 11097 <function id="GetSystemProperties" phase="onload" num="130"> 11098 <synopsis>Get System Properties</synopsis> 11099 <description> 11100 The list of VM system property keys which may be used with 11101 <functionlink id="GetSystemProperty"/> is returned. 11102 It is strongly recommended that virtual machines provide the 11103 following property keys: 11104 <ul> 11105 <li><code>java.vm.vendor</code></li> 11106 <li><code>java.vm.version</code></li> 11107 <li><code>java.vm.name</code></li> 11108 <li><code>java.vm.info</code></li> 11109 <li><code>java.library.path</code></li> 11110 <li><code>java.class.path</code></li> 11111 </ul> 11112 Provides access to system properties defined by and used 11113 by the VM. 11114 Properties set on the command-line are included. 11115 This allows getting and setting of these properties 11116 before the VM even begins executing bytecodes. 11117 Since this is a VM view of system properties, the set of available 11118 properties will usually be different than that 11119 in <code>java.lang.System.getProperties</code>. 11120 JNI method invocation may be used to access 11121 <code>java.lang.System.getProperties</code>. 11122 <p/> 11123 The set of properties may grow during execution. 11124 </description> 11125 <origin>new</origin> 11126 <capabilities> 11127 </capabilities> 11128 <parameters> 11129 <param id="count_ptr"> 11130 <outptr><jint/></outptr> 11131 <description> 11132 On return, points to the number of property keys returned. 11133 </description> 11134 </param> 11135 <param id="property_ptr"> 11136 <allocallocbuf outcount="count_ptr"><char/></allocallocbuf> 11137 <description> 11138 On return, points to an array of property keys, encoded as 11139 <internallink id="mUTF">modified UTF-8</internallink> strings. 11140 </description> 11141 </param> 11142 </parameters> 11143 <errors> 11144 </errors> 11145 </function> 11146 11147 <function id="GetSystemProperty" phase="onload" num="131"> 11148 <synopsis>Get System Property</synopsis> 11149 <description> 11150 Return a VM system property value given the property key. 11151 <p/> 11152 The function <functionlink id="GetSystemProperties"/> 11153 returns the set of property keys which may be used. 11154 The properties which can be retrieved may grow during 11155 execution. 11156 <p/> 11157 Since this is a VM view of system properties, the values 11158 of properties may differ from that returned by 11159 <code>java.lang.System.getProperty(String)</code>. 11160 A typical VM might copy the values of the VM system 11161 properties into the <code>Properties</code> held by 11162 <code>java.lang.System</code> during the initialization 11163 of that class. Thereafter any changes to the VM system 11164 properties (with <functionlink id="SetSystemProperty"/>) 11165 or the <code>java.lang.System</code> system properties 11166 (with <code>java.lang.System.setProperty(String,String)</code>) 11167 would cause the values to diverge. 11168 JNI method invocation may be used to access 11169 <code>java.lang.System.getProperty(String)</code>. 11170 </description> 11171 <origin>new</origin> 11172 <capabilities> 11173 </capabilities> 11174 <parameters> 11175 <param id="property"> 11176 <inbuf><char/></inbuf> 11177 <description> 11178 The key of the property to retrieve, encoded as a 11179 <internallink id="mUTF">modified UTF-8</internallink> string. 11180 </description> 11181 </param> 11182 <param id="value_ptr"> 11183 <allocbuf><char/></allocbuf> 11184 <description> 11185 On return, points to the property value, encoded as a 11186 <internallink id="mUTF">modified UTF-8</internallink> string. 11187 </description> 11188 </param> 11189 </parameters> 11190 <errors> 11191 <error id="JVMTI_ERROR_NOT_AVAILABLE"> 11192 This property is not available. 11193 Use <functionlink id="GetSystemProperties"/> to find available properties. 11194 </error> 11195 </errors> 11196 </function> 11197 11198 <function id="SetSystemProperty" phase="onloadOnly" num="132"> 11199 <synopsis>Set System Property</synopsis> 11200 <description> 11201 Set a VM system property value. 11202 <p/> 11203 The function <functionlink id="GetSystemProperties"/> 11204 returns the set of property keys, some of these may be settable. 11205 See <functionlink id="GetSystemProperty"/>. 11206 </description> 11207 <origin>new</origin> 11208 <capabilities> 11209 </capabilities> 11210 <parameters> 11211 <param id="property"> 11212 <inbuf><char/></inbuf> 11213 <description> 11214 The key of the property, encoded as a 11215 <internallink id="mUTF">modified UTF-8</internallink> string. 11216 </description> 11217 </param> 11218 <param id="value_ptr"> 11219 <inbuf> 11220 <char/> 11221 <nullok> 11222 do not set the value, but return <errorlink id="JVMTI_ERROR_NOT_AVAILABLE"/> 11223 if the property is not writeable 11224 </nullok> 11225 </inbuf> 11226 <description> 11227 The property value to set, encoded as a 11228 <internallink id="mUTF">modified UTF-8</internallink> string. 11229 </description> 11230 </param> 11231 </parameters> 11232 <errors> 11233 <error id="JVMTI_ERROR_NOT_AVAILABLE"> 11234 This property is not available or is not writeable. 11235 </error> 11236 </errors> 11237 </function> 11238 11239 </category> 11240 11241 <category id="general" label="General"> 11242 11243 <intro> 11244 </intro> 11245 11246 <function id="GetPhase" jkernel="yes" phase="any" num="133"> 11247 <synopsis>Get Phase</synopsis> 11248 <description> 11249 Return the current phase of VM execution. 11250 The phases proceed in sequence: 11251 <constants id="jvmtiPhase" label="Phases of execution" kind="enum"> 11252 <constant id="JVMTI_PHASE_ONLOAD" num="1"> 11253 <code>OnLoad</code> phase: while in the 11254 <internallink id="onload"><code>Agent_OnLoad</code></internallink> 11255 or, for statically linked agents, the <internallink id="onload"> 11256 <code>Agent_OnLoad_<agent-lib-name> 11257 </code></internallink> function. 11258 </constant> 11259 <constant id="JVMTI_PHASE_PRIMORDIAL" num="2"> 11260 Primordial phase: between return from <code>Agent_OnLoad</code> 11261 or <code>Agent_OnLoad_<agent-lib-name></code> and the 11262 <code>VMStart</code> event. 11263 </constant> 11264 <constant id="JVMTI_PHASE_START" num="6"> 11265 Start phase: when the <eventlink id="VMStart"><code>VMStart</code></eventlink> event 11266 is sent and until the <code>VMInit</code> event is sent. 11267 </constant> 11268 <constant id="JVMTI_PHASE_LIVE" num="4"> 11269 Live phase: when the <eventlink id="VMInit"><code>VMInit</code></eventlink> event is sent 11270 and until the <eventlink id="VMDeath"></eventlink> event returns. 11271 </constant> 11272 <constant id="JVMTI_PHASE_DEAD" num="8"> 11273 Dead phase: after the <eventlink id="VMDeath"></eventlink> event returns or after 11274 start-up failure. 11275 </constant> 11276 </constants> 11277 In the case of start-up failure the VM will proceed directly to the dead 11278 phase skipping intermediate phases and neither a <code>VMInit</code> nor 11279 <code>VMDeath</code> event will be sent. 11280 <p/> 11281 Most <jvmti/> functions operate only in the live phase. 11282 The following functions operate in either the <code>OnLoad</code> or live phases: 11283 <functionphaselist phase="onload"/> 11284 The following functions operate in only the <code>OnLoad</code> phase: 11285 <functionphaselist phase="onloadOnly"/> 11286 The following functions operate in the start or live phases: 11287 <functionphaselist phase="start"/> 11288 The following functions operate in any phase: 11289 <functionphaselist phase="any"/> 11290 JNI functions (except the Invocation API) must only be used in the start or live phases. 11291 <p/> 11292 Most <jvmti/> events are sent only in the live phase. 11293 The following events operate in others phases: 11294 <eventphaselist phase="start"/> 11295 <eventphaselist phase="any"/> 11296 </description> 11297 <origin>new</origin> 11298 <capabilities> 11299 </capabilities> 11300 <parameters> 11301 <param id="phase_ptr"> 11302 <outptr><enum>jvmtiPhase</enum></outptr> 11303 <description> 11304 On return, points to the phase. 11305 </description> 11306 </param> 11307 </parameters> 11308 <errors> 11309 </errors> 11310 </function> 11311 11312 <function id="DisposeEnvironment" jkernel="yes" phase="any" num="127"> 11313 <synopsis>Dispose Environment</synopsis> 11314 <description> 11315 Shutdown a <jvmti/> connection created with JNI <code>GetEnv</code> 11316 (see <internallink id="environments"><jvmti/> Environments</internallink>). 11317 Dispose of any resources held by the environment. 11318 <issue> 11319 What resources are reclaimed? What is undone? 11320 Breakpoints,watchpoints removed? 11321 </issue> 11322 Threads suspended by this environment are not resumed by this call, 11323 this must be done explicitly by the agent. 11324 Memory allocated by this environment via calls to <jvmti/> functions 11325 is not released, this can be done explicitly by the agent 11326 by calling <functionlink id="Deallocate"/>. 11327 Raw monitors created by this environment are not destroyed, 11328 this can be done explicitly by the agent 11329 by calling <functionlink id="DestroyRawMonitor"/>. 11330 The state of threads waiting on raw monitors created by this environment 11331 are not affected. 11332 <p/> 11333 Any <functionlink id="SetNativeMethodPrefix">native method 11334 prefixes</functionlink> for this environment will be unset; 11335 the agent must remove any prefixed native methods before 11336 dispose is called. 11337 <p/> 11338 Any <internallink id="capability">capabilities</internallink> 11339 held by this environment are relinquished. 11340 <p/> 11341 Events enabled by this environment will no longer be sent, however 11342 event handlers currently running will continue to run. Caution must 11343 be exercised in the design of event handlers whose environment may 11344 be disposed and thus become invalid during their execution. 11345 <p/> 11346 This environment may not be used after this call. 11347 This call returns to the caller. 11348 </description> 11349 <origin>new</origin> 11350 <capabilities> 11351 </capabilities> 11352 <parameters> 11353 </parameters> 11354 <errors> 11355 </errors> 11356 </function> 11357 11358 <function id="SetEnvironmentLocalStorage" jkernel="yes" phase="any" callbacksafe="safe" impl="innative notrace" num="148"> 11359 <synopsis>Set Environment Local Storage</synopsis> 11360 <description> 11361 The VM stores a pointer value associated with each environment. 11362 This pointer value is called <i>environment-local storage</i>. 11363 This value is <code>NULL</code> unless set with this function. 11364 Agents can allocate memory in which they store environment specific 11365 information. By setting environment-local storage it can then be 11366 accessed with 11367 <functionlink id="GetEnvironmentLocalStorage"></functionlink>. 11368 <p/> 11369 Called by the agent to set the value of the <jvmti/> 11370 environment-local storage. <jvmti/> supplies to the agent a pointer-size 11371 environment-local storage that can be used to record per-environment 11372 information. 11373 </description> 11374 <origin>new</origin> 11375 <capabilities> 11376 </capabilities> 11377 <parameters> 11378 <param id="data"> 11379 <inbuf> 11380 <void/> 11381 <nullok>value is set to <code>NULL</code></nullok> 11382 </inbuf> 11383 <description> 11384 The value to be entered into the environment-local storage. 11385 </description> 11386 </param> 11387 </parameters> 11388 <errors> 11389 </errors> 11390 </function> 11391 11392 <function id="GetEnvironmentLocalStorage" jkernel="yes" phase="any" callbacksafe="safe" impl="innative notrace" num="147"> 11393 <synopsis>Get Environment Local Storage</synopsis> 11394 <description> 11395 Called by the agent to get the value of the <jvmti/> environment-local 11396 storage. 11397 </description> 11398 <origin>new</origin> 11399 <capabilities> 11400 </capabilities> 11401 <parameters> 11402 <param id="data_ptr"> 11403 <agentbuf><void/></agentbuf> 11404 <description> 11405 Pointer through which the value of the environment local 11406 storage is returned. 11407 If environment-local storage has not been set with 11408 <functionlink id="SetEnvironmentLocalStorage"></functionlink> returned 11409 pointer is <code>NULL</code>. 11410 </description> 11411 </param> 11412 </parameters> 11413 <errors> 11414 </errors> 11415 </function> 11416 11417 <function id="GetVersionNumber" jkernel="yes" phase="any" num="88"> 11418 <synopsis>Get Version Number</synopsis> 11419 <description> 11420 Return the <jvmti/> version via <code>version_ptr</code>. 11421 The return value is the version identifier. 11422 The version identifier includes major, minor and micro 11423 version as well as the interface type. 11424 <constants id="jvmtiVersionInterfaceTypes" label="Version Interface Types" kind="bits"> 11425 <constant id="JVMTI_VERSION_INTERFACE_JNI" num="0x00000000"> 11426 Value of <code>JVMTI_VERSION_MASK_INTERFACE_TYPE</code> for JNI. 11427 </constant> 11428 <constant id="JVMTI_VERSION_INTERFACE_JVMTI" num="0x30000000"> 11429 Value of <code>JVMTI_VERSION_MASK_INTERFACE_TYPE</code> for <jvmti/>. 11430 </constant> 11431 </constants> 11432 <constants id="jvmtiVersionMasks" label="Version Masks" kind="bits"> 11433 <constant id="JVMTI_VERSION_MASK_INTERFACE_TYPE" num="0x70000000"> 11434 Mask to extract interface type. 11435 The value of the version returned by this function masked with 11436 <code>JVMTI_VERSION_MASK_INTERFACE_TYPE</code> is always 11437 <code>JVMTI_VERSION_INTERFACE_JVMTI</code> 11438 since this is a <jvmti/> function. 11439 </constant> 11440 <constant id="JVMTI_VERSION_MASK_MAJOR" num="0x0FFF0000"> 11441 Mask to extract major version number. 11442 </constant> 11443 <constant id="JVMTI_VERSION_MASK_MINOR" num="0x0000FF00"> 11444 Mask to extract minor version number. 11445 </constant> 11446 <constant id="JVMTI_VERSION_MASK_MICRO" num="0x000000FF"> 11447 Mask to extract micro version number. 11448 </constant> 11449 </constants> 11450 <constants id="jvmtiVersionShifts" label="Version Shifts" kind="bits"> 11451 <constant id="JVMTI_VERSION_SHIFT_MAJOR" num="16"> 11452 Shift to extract major version number. 11453 </constant> 11454 <constant id="JVMTI_VERSION_SHIFT_MINOR" num="8"> 11455 Shift to extract minor version number. 11456 </constant> 11457 <constant id="JVMTI_VERSION_SHIFT_MICRO" num="0"> 11458 Shift to extract micro version number. 11459 </constant> 11460 </constants> 11461 </description> 11462 <origin>jvmdi</origin> 11463 <capabilities> 11464 </capabilities> 11465 <parameters> 11466 <param id="version_ptr"> 11467 <outptr><jint/></outptr> 11468 <description> 11469 On return, points to the <jvmti/> version. 11470 </description> 11471 </param> 11472 </parameters> 11473 <errors> 11474 </errors> 11475 </function> 11476 11477 11478 <function id="GetErrorName" phase="any" num="128"> 11479 <synopsis>Get Error Name</synopsis> 11480 <description> 11481 Return the symbolic name for an 11482 <internallink id="ErrorSection">error code</internallink>. 11483 <p/> 11484 For example 11485 <code>GetErrorName(env, JVMTI_ERROR_NONE, &err_name)</code> 11486 would return in <code>err_name</code> the string 11487 <code>"JVMTI_ERROR_NONE"</code>. 11488 </description> 11489 <origin>new</origin> 11490 <capabilities> 11491 </capabilities> 11492 <parameters> 11493 <param id="error"> 11494 <enum>jvmtiError</enum> 11495 <description> 11496 The error code. 11497 </description> 11498 </param> 11499 <param id="name_ptr"> 11500 <allocbuf><char/></allocbuf> 11501 <description> 11502 On return, points to the error name. 11503 The name is encoded as a 11504 <internallink id="mUTF">modified UTF-8</internallink> string, 11505 but is restricted to the ASCII subset. 11506 </description> 11507 </param> 11508 </parameters> 11509 <errors> 11510 </errors> 11511 </function> 11512 11513 <function id="SetVerboseFlag" phase="any" num="150"> 11514 <synopsis>Set Verbose Flag</synopsis> 11515 <description> 11516 <constants id="jvmtiVerboseFlag" label="Verbose Flag Enumeration" kind="enum"> 11517 <constant id="JVMTI_VERBOSE_OTHER" num="0"> 11518 Verbose output other than the below. 11519 </constant> 11520 <constant id="JVMTI_VERBOSE_GC" num="1"> 11521 Verbose garbage collector output, like that specified with <code>-verbose:gc</code>. 11522 </constant> 11523 <constant id="JVMTI_VERBOSE_CLASS" num="2"> 11524 Verbose class loading output, like that specified with <code>-verbose:class</code>. 11525 </constant> 11526 <constant id="JVMTI_VERBOSE_JNI" num="4"> 11527 Verbose JNI output, like that specified with <code>-verbose:jni</code>. 11528 </constant> 11529 </constants> 11530 Control verbose output. 11531 This is the output which typically is sent to <code>stderr</code>. 11532 </description> 11533 <origin>new</origin> 11534 <capabilities> 11535 </capabilities> 11536 <parameters> 11537 <param id="flag"> 11538 <enum>jvmtiVerboseFlag</enum> 11539 <description> 11540 Which verbose flag to set. 11541 </description> 11542 </param> 11543 <param id="value"> 11544 <jboolean/> 11545 <description> 11546 New value of the flag. 11547 </description> 11548 </param> 11549 </parameters> 11550 <errors> 11551 </errors> 11552 </function> 11553 11554 11555 <function id="GetJLocationFormat" phase="any" num="129"> 11556 <synopsis>Get JLocation Format</synopsis> 11557 <description> 11558 Although the greatest functionality is achieved with location information 11559 referencing the virtual machine bytecode index, the definition of 11560 <code>jlocation</code> has intentionally been left unconstrained to allow VM 11561 implementations that do not have this information. 11562 <p/> 11563 This function describes the representation of <code>jlocation</code> used in this VM. 11564 If the returned format is <datalink id="JVMTI_JLOCATION_JVMBCI"></datalink>, 11565 <code>jlocation</code>s can 11566 be used as in indices into the array returned by 11567 <functionlink id="GetBytecodes"></functionlink>. 11568 <constants id="jvmtiJlocationFormat" label="JLocation Format Enumeration" kind="enum"> 11569 <constant id="JVMTI_JLOCATION_JVMBCI" num="1"> 11570 <code>jlocation</code> values represent virtual machine 11571 bytecode indices--that is, offsets into the 11572 virtual machine code for a method. 11573 </constant> 11574 <constant id="JVMTI_JLOCATION_MACHINEPC" num="2"> 11575 <code>jlocation</code> values represent native machine 11576 program counter values. 11577 </constant> 11578 <constant id="JVMTI_JLOCATION_OTHER" num="0"> 11579 <code>jlocation</code> values have some other representation. 11580 </constant> 11581 </constants> 11582 </description> 11583 <origin>new</origin> 11584 <capabilities> 11585 </capabilities> 11586 <parameters> 11587 <param id="format_ptr"> 11588 <outptr><enum>jvmtiJlocationFormat</enum></outptr> 11589 <description> 11590 On return, points to the format identifier for <code>jlocation</code> values. 11591 </description> 11592 </param> 11593 </parameters> 11594 <errors> 11595 </errors> 11596 </function> 11597 11598 </category> 11599 11600 <category id="heap_monitoring" label="Heap Monitoring"> 11601 <function id="SetHeapSamplingInterval" phase="onload" num="156" since="11"> 11602 <synopsis>Set Heap Sampling Interval</synopsis> 11603 <description> 11604 Generate a <eventlink id="SampledObjectAlloc"/> event when objects are allocated. 11605 Each thread keeps a counter of bytes allocated. The event will only be generated 11606 when that counter exceeds an average of <paramlink id="sampling_interval"></paramlink> 11607 since the last sample. 11608 <p/> 11609 Setting <paramlink id="sampling_interval"></paramlink> to 0 will cause an event to be 11610 generated by each allocation supported by the system once the new interval is taken into account. 11611 <p/> 11612 Note that updating the new sampling interval might take various number of allocations 11613 to provoke internal data structure updates. Therefore it is important to 11614 consider the sampling interval as an average. This includes the interval 0, where events 11615 might not be generated straight away for each allocation. 11616 </description> 11617 <origin>new</origin> 11618 <capabilities> 11619 <required id="can_generate_sampled_object_alloc_events"></required> 11620 </capabilities> 11621 <parameters> 11622 <param id="sampling_interval"> 11623 <jint/> 11624 <description> 11625 The sampling interval in bytes. The sampler uses a statistical approach to 11626 generate an event, on average, once for every <paramlink id="sampling_interval"/> bytes of 11627 memory allocated by a given thread. 11628 <p/> 11629 Once the new sampling interval is taken into account, 0 as a sampling interval will generate 11630 a sample for every allocation. 11631 <p/> 11632 Note: The overhead of this feature is directly correlated with the sampling interval. 11633 A high sampling interval, such as 1024 bytes, will incur a high overhead. 11634 A lower interval, such as 1024KB, will have a much lower overhead. Sampling should only 11635 be used with an understanding that it may impact performance. 11636 </description> 11637 </param> 11638 </parameters> 11639 <errors> 11640 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 11641 <paramlink id="sampling_interval"></paramlink> is less than zero. 11642 </error> 11643 </errors> 11644 </function> 11645 </category> 11646 11647 </functionsection> 11648 11649 <errorsection label="Error Reference"> 11650 <intro> 11651 Every <jvmti/> function returns a <b><code>jvmtiError</code></b> error code. 11652 <p/> 11653 It is the responsibility of the agent to call <jvmti/> functions with 11654 valid parameters and in the proper context (calling thread is attached, 11655 phase is correct, etc.). 11656 Detecting some error conditions may be difficult, inefficient, or 11657 impossible for an implementation. 11658 The errors listed in 11659 <internallink id="reqerrors">Function Specific Required Errors</internallink> 11660 must be detected by the implementation. 11661 All other errors represent the recommended response to the error 11662 condition. 11663 </intro> 11664 11665 <errorcategory id="universal-error" label="Universal Errors"> 11666 <intro> 11667 The following errors may be returned by any function 11668 </intro> 11669 11670 <errorid id="JVMTI_ERROR_NONE" num="0"> 11671 No error has occurred. This is the error code that is returned 11672 on successful completion of the function. 11673 </errorid> 11674 <errorid id="JVMTI_ERROR_NULL_POINTER" num="100"> 11675 Pointer is unexpectedly <code>NULL</code>. 11676 </errorid> 11677 <errorid id="JVMTI_ERROR_OUT_OF_MEMORY" num="110"> 11678 The function attempted to allocate memory and no more memory was 11679 available for allocation. 11680 </errorid> 11681 <errorid id="JVMTI_ERROR_ACCESS_DENIED" num="111"> 11682 The desired functionality has not been enabled in this virtual machine. 11683 </errorid> 11684 <errorid id="JVMTI_ERROR_UNATTACHED_THREAD" num="115"> 11685 The thread being used to call this function is not attached 11686 to the virtual machine. Calls must be made from attached threads. 11687 See <code>AttachCurrentThread</code> in the JNI invocation API. 11688 </errorid> 11689 <errorid id="JVMTI_ERROR_INVALID_ENVIRONMENT" num="116"> 11690 The <jvmti/> environment provided is no longer connected or is 11691 not an environment. 11692 </errorid> 11693 <errorid id="JVMTI_ERROR_WRONG_PHASE" num="112"> 11694 The desired functionality is not available in the current 11695 <functionlink id="GetPhase">phase</functionlink>. 11696 Always returned if the virtual machine has completed running. 11697 </errorid> 11698 <errorid id="JVMTI_ERROR_INTERNAL" num="113"> 11699 An unexpected internal error has occurred. 11700 </errorid> 11701 </errorcategory> 11702 11703 <errorcategory id="reqerrors" label="Function Specific Required Errors"> 11704 <intro> 11705 The following errors are returned by some <jvmti/> functions and must 11706 be returned by the implementation when the condition occurs. 11707 </intro> 11708 11709 <errorid id="JVMTI_ERROR_INVALID_PRIORITY" num="12"> 11710 Invalid priority. 11711 </errorid> 11712 <errorid id="JVMTI_ERROR_THREAD_NOT_SUSPENDED" num="13"> 11713 Thread was not suspended. 11714 </errorid> 11715 <errorid id="JVMTI_ERROR_THREAD_SUSPENDED" num="14"> 11716 Thread already suspended. 11717 </errorid> 11718 <errorid id="JVMTI_ERROR_THREAD_NOT_ALIVE" num="15"> 11719 This operation requires the thread to be alive--that is, 11720 it must be started and not yet have died. 11721 </errorid> 11722 <errorid id="JVMTI_ERROR_CLASS_NOT_PREPARED" num="22"> 11723 The class has been loaded but not yet prepared. 11724 </errorid> 11725 <errorid id="JVMTI_ERROR_NO_MORE_FRAMES" num="31"> 11726 There are no Java programming language or JNI stack frames at the specified depth. 11727 </errorid> 11728 <errorid id="JVMTI_ERROR_OPAQUE_FRAME" num="32"> 11729 Information about the frame is not available (e.g. for native frames). 11730 </errorid> 11731 <errorid id="JVMTI_ERROR_DUPLICATE" num="40"> 11732 Item already set. 11733 </errorid> 11734 <errorid id="JVMTI_ERROR_NOT_FOUND" num="41"> 11735 Desired element (e.g. field or breakpoint) not found 11736 </errorid> 11737 <errorid id="JVMTI_ERROR_NOT_MONITOR_OWNER" num="51"> 11738 This thread doesn't own the raw monitor. 11739 </errorid> 11740 <errorid id="JVMTI_ERROR_INTERRUPT" num="52"> 11741 The call has been interrupted before completion. 11742 </errorid> 11743 <errorid id="JVMTI_ERROR_UNMODIFIABLE_CLASS" num="79"> 11744 The class cannot be modified. 11745 </errorid> 11746 <errorid id="JVMTI_ERROR_UNMODIFIABLE_MODULE" num="80"> 11747 The module cannot be modified. 11748 </errorid> 11749 <errorid id="JVMTI_ERROR_NOT_AVAILABLE" num="98"> 11750 The functionality is not available in this virtual machine. 11751 </errorid> 11752 <errorid id="JVMTI_ERROR_ABSENT_INFORMATION" num="101"> 11753 The requested information is not available. 11754 </errorid> 11755 <errorid id="JVMTI_ERROR_INVALID_EVENT_TYPE" num="102"> 11756 The specified event type ID is not recognized. 11757 </errorid> 11758 <errorid id="JVMTI_ERROR_NATIVE_METHOD" num="104"> 11759 The requested information is not available for native method. 11760 </errorid> 11761 <errorid id="JVMTI_ERROR_CLASS_LOADER_UNSUPPORTED" num="106"> 11762 The class loader does not support this operation. 11763 </errorid> 11764 </errorcategory> 11765 11766 <errorcategory id="function-specific-errors" label="Function Specific Agent Errors"> 11767 <intro> 11768 The following errors are returned by some <jvmti/> functions. 11769 They are returned in the event of invalid parameters passed by the 11770 agent or usage in an invalid context. 11771 An implementation is not required to detect these errors. 11772 </intro> 11773 11774 <errorid id="JVMTI_ERROR_INVALID_THREAD" num="10"> 11775 The passed thread is not a valid thread. 11776 </errorid> 11777 <errorid id="JVMTI_ERROR_INVALID_FIELDID" num="25"> 11778 Invalid field. 11779 </errorid> 11780 <errorid id="JVMTI_ERROR_INVALID_MODULE" num="26"> 11781 Invalid module. 11782 </errorid> 11783 <errorid id="JVMTI_ERROR_INVALID_METHODID" num="23"> 11784 Invalid method. 11785 </errorid> 11786 <errorid id="JVMTI_ERROR_INVALID_LOCATION" num="24"> 11787 Invalid location. 11788 </errorid> 11789 <errorid id="JVMTI_ERROR_INVALID_OBJECT" num="20"> 11790 Invalid object. 11791 </errorid> 11792 <errorid id="JVMTI_ERROR_INVALID_CLASS" num="21"> 11793 Invalid class. 11794 </errorid> 11795 <errorid id="JVMTI_ERROR_TYPE_MISMATCH" num="34"> 11796 The variable is not an appropriate type for the function used. 11797 </errorid> 11798 <errorid id="JVMTI_ERROR_INVALID_SLOT" num="35"> 11799 Invalid slot. 11800 </errorid> 11801 <errorid id="JVMTI_ERROR_MUST_POSSESS_CAPABILITY" num="99"> 11802 The capability being used is false in this environment. 11803 </errorid> 11804 <errorid id="JVMTI_ERROR_INVALID_THREAD_GROUP" num="11"> 11805 Thread group invalid. 11806 </errorid> 11807 <errorid id="JVMTI_ERROR_INVALID_MONITOR" num="50"> 11808 Invalid raw monitor. 11809 </errorid> 11810 <errorid id="JVMTI_ERROR_ILLEGAL_ARGUMENT" num="103"> 11811 Illegal argument. 11812 </errorid> 11813 <errorid id="JVMTI_ERROR_INVALID_TYPESTATE" num="65"> 11814 The state of the thread has been modified, and is now inconsistent. 11815 </errorid> 11816 <errorid id="JVMTI_ERROR_UNSUPPORTED_VERSION" num="68"> 11817 A new class file has a version number not supported by this VM. 11818 </errorid> 11819 <errorid id="JVMTI_ERROR_INVALID_CLASS_FORMAT" num="60"> 11820 A new class file is malformed (the VM would return a <code>ClassFormatError</code>). 11821 </errorid> 11822 <errorid id="JVMTI_ERROR_CIRCULAR_CLASS_DEFINITION" num="61"> 11823 The new class file definitions would lead to a circular 11824 definition (the VM would return a <code>ClassCircularityError</code>). 11825 </errorid> 11826 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_ADDED" num="63"> 11827 A new class file would require adding a method. 11828 </errorid> 11829 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED" num="64"> 11830 A new class version changes a field. 11831 </errorid> 11832 <errorid id="JVMTI_ERROR_FAILS_VERIFICATION" num="62"> 11833 The class bytes fail verification. 11834 </errorid> 11835 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED" num="66"> 11836 A direct superclass is different for the new class 11837 version, or the set of directly implemented 11838 interfaces is different. 11839 </errorid> 11840 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_DELETED" num="67"> 11841 A new class version does not declare a method 11842 declared in the old class version. 11843 </errorid> 11844 <errorid id="JVMTI_ERROR_NAMES_DONT_MATCH" num="69"> 11845 The class name defined in the new class file is 11846 different from the name in the old class object. 11847 </errorid> 11848 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED" num="70"> 11849 A new class version has different modifiers. 11850 </errorid> 11851 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED" num="71"> 11852 A method in the new class version has different modifiers 11853 than its counterpart in the old class version. 11854 </errorid> 11855 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_ATTRIBUTE_CHANGED" num="72"> 11856 A new class version has unsupported differences in class attributes. 11857 </errorid> 11858 </errorcategory> 11859 </errorsection> 11860 11861 <eventsection label="Events"> 11862 <intro label="Handling Events" id="eventIntro"> 11863 Agents can be informed of many events that occur in application 11864 programs. 11865 <p/> 11866 To handle events, designate a set of callback functions with 11867 <functionlink id="SetEventCallbacks"></functionlink>. 11868 For each event the corresponding callback function will be 11869 called. 11870 Arguments to the callback function provide additional 11871 information about the event. 11872 <p/> 11873 The callback function is usually called from within an application 11874 thread. The <jvmti/> implementation does not 11875 queue events in any way. This means 11876 that event callback functions must be written 11877 carefully. Here are some general guidelines. See 11878 the individual event descriptions for further 11879 suggestions. 11880 <p/> 11881 <ul> 11882 <li>Any exception thrown during the execution of an event callback can 11883 overwrite any current pending exception in the current application thread. 11884 Care must be taken to preserve a pending exception 11885 when an event callback makes a JNI call that might generate an exception. 11886 </li> 11887 <li>Event callback functions must be re-entrant. The <jvmti/> implementation does 11888 not queue events. If an agent needs to process events one at a time, it 11889 can use a raw monitor inside the 11890 event callback functions to serialize event processing. 11891 </li> 11892 <li>Event callback functions that execute JNI's FindClass function to load 11893 classes need to note that FindClass locates the class loader associated 11894 with the current native method. For the purposes of class loading, an 11895 event callback that includes a JNI environment as a parameter to the 11896 callback will treated as if it is a native call, where the native method 11897 is in the class of the event thread's current frame. 11898 </li> 11899 </ul> 11900 <p/> 11901 Some <jvmti/> events identify objects with JNI references. 11902 All references 11903 in <jvmti/> events are JNI local references and will become invalid 11904 after the event callback returns. 11905 Unless stated otherwise, memory referenced by pointers sent in event 11906 callbacks may not be referenced after the event callback returns. 11907 <p/> 11908 Except where stated otherwise, events are delivered on the thread 11909 that caused the event. 11910 Events are sent at the time they occur. 11911 The specification for each event includes the set of 11912 <functionlink id="GetPhase">phases</functionlink> in which it can be sent; 11913 if an event triggering activity occurs during another phase, no event 11914 is sent. 11915 <p/> 11916 A thread that generates an event does not change its execution status 11917 (for example, the event does not cause the thread to be suspended). 11918 If an agent wishes the event to result in suspension, then the agent 11919 is responsible for explicitly suspending the thread with 11920 <functionlink id="SuspendThread"></functionlink>. 11921 <p/> 11922 If an event is enabled in multiple environments, the event will be sent 11923 to each agent in the order that the environments were created. 11924 </intro> 11925 11926 <intro label="Enabling Events" id="enablingevents"> 11927 All events are initially disabled. In order to receive any 11928 event: 11929 <ul> 11930 <li> 11931 If the event requires a capability, that capability must 11932 be added with 11933 <functionlink id="AddCapabilities"></functionlink>. 11934 </li> 11935 <li> 11936 A callback for the event must be set with 11937 <functionlink id="SetEventCallbacks"></functionlink>. 11938 </li> 11939 <li> 11940 The event must be enabled with 11941 <functionlink id="SetEventNotificationMode"></functionlink>. 11942 </li> 11943 </ul> 11944 </intro> 11945 11946 <intro label="Multiple Co-located Events" id="eventorder"> 11947 In many situations it is possible for multiple events to occur 11948 at the same location in one thread. When this happens, all the events 11949 are reported through the event callbacks in the order specified in this section. 11950 <p/> 11951 If the current location is at the entry point of a method, the 11952 <eventlink id="MethodEntry"></eventlink> event is reported before 11953 any other event at the current location in the same thread. 11954 <p/> 11955 If an exception catch has been detected at the current location, 11956 either because it is the beginning of a catch clause or a native method 11957 that cleared a pending exception has returned, the 11958 <code>exceptionCatch</code> event is reported before 11959 any other event at the current location in the same thread. 11960 <p/> 11961 If a <code>singleStep</code> event or 11962 <code>breakpoint</code> event is triggered at the 11963 current location, the event is defined to occur 11964 immediately before the code at the current location is executed. 11965 These events are reported before any events which are triggered 11966 by the execution of code at the current location in the same 11967 thread (specifically: 11968 <code>exception</code>, 11969 <code>fieldAccess</code>, and 11970 <code>fieldModification</code>). 11971 If both a step and breakpoint event are triggered for the same thread and 11972 location, the step event is reported before the breakpoint event. 11973 <p/> 11974 If the current location is the exit point of a method (that is, the last 11975 location before returning to the caller), the 11976 <eventlink id="MethodExit"></eventlink> event and 11977 the <eventlink id="FramePop"></eventlink> event (if requested) 11978 are reported after all other events at the current location in the same 11979 thread. There is no specified ordering of these two events 11980 with respect to each other. 11981 <p/> 11982 Co-located events can be triggered during the processing of some other 11983 event by the agent at the same location in the same thread. 11984 If such an event, of type <i>y</i>, is triggered during the processing of 11985 an event of type <i>x</i>, and if <i>x</i> 11986 precedes <i>y</i> in the ordering specified above, the co-located event 11987 <i>y</i> is reported for the current thread and location. If <i>x</i> does not precede 11988 <i>y</i>, <i>y</i> is not reported for the current thread and location. 11989 For example, if a breakpoint is set at the current location 11990 during the processing of <eventlink id="SingleStep"></eventlink>, 11991 that breakpoint will be reported before the thread moves off the current 11992 location. 11993 <p/>The following events are never considered to be co-located with 11994 other events. 11995 <ul> 11996 <li><eventlink id="VMStart"></eventlink></li> 11997 <li><eventlink id="VMInit"></eventlink></li> 11998 <li><eventlink id="VMDeath"></eventlink></li> 11999 <li><eventlink id="ThreadStart"></eventlink></li> 12000 <li><eventlink id="ThreadEnd"></eventlink></li> 12001 <li><eventlink id="ClassLoad"></eventlink></li> 12002 <li><eventlink id="ClassPrepare"></eventlink></li> 12003 </ul> 12004 </intro> 12005 12006 <intro label="Event Callbacks" id="jvmtiEventCallbacks"> 12007 The event callback structure below is used to specify the handler function 12008 for events. It is set with the 12009 <functionlink id="SetEventCallbacks"></functionlink> function. 12010 </intro> 12011 12012 <event label="Single Step" 12013 id="SingleStep" const="JVMTI_EVENT_SINGLE_STEP" filtered="thread" num="60"> 12014 <description> 12015 Single step events allow the agent to trace thread execution 12016 at the finest granularity allowed by the VM. A single step event is 12017 generated whenever a thread reaches a new location. 12018 Typically, single step events represent the completion of one VM 12019 instruction as defined in <vmspec/>. However, some implementations 12020 may define locations differently. In any case the 12021 <code>method</code> and <code>location</code> 12022 parameters uniquely identify the current location and allow 12023 the mapping to source file and line number when that information is 12024 available. 12025 <p/> 12026 No single step events are generated from within native methods. 12027 </description> 12028 <origin>jvmdi</origin> 12029 <capabilities> 12030 <required id="can_generate_single_step_events"></required> 12031 </capabilities> 12032 <parameters> 12033 <param id="jni_env"> 12034 <outptr> 12035 <struct>JNIEnv</struct> 12036 </outptr> 12037 <description> 12038 The JNI environment of the event (current) thread 12039 </description> 12040 </param> 12041 <param id="thread"> 12042 <jthread/> 12043 <description> 12044 Thread about to execution a new instruction 12045 </description> 12046 </param> 12047 <param id="klass"> 12048 <jclass method="method"/> 12049 <description> 12050 Class of the method about to execute a new instruction 12051 </description> 12052 </param> 12053 <param id="method"> 12054 <jmethodID class="klass"/> 12055 <description> 12056 Method about to execute a new instruction 12057 </description> 12058 </param> 12059 <param id="location"> 12060 <jlocation/> 12061 <description> 12062 Location of the new instruction 12063 </description> 12064 </param> 12065 </parameters> 12066 </event> 12067 12068 <event label="Breakpoint" 12069 id="Breakpoint" const="JVMTI_EVENT_BREAKPOINT" filtered="thread" num="62"> 12070 <description> 12071 Breakpoint events are generated whenever a thread reaches a location 12072 designated as a breakpoint with <functionlink id="SetBreakpoint"></functionlink>. 12073 The <code>method</code> and <code>location</code> 12074 parameters uniquely identify the current location and allow 12075 the mapping to source file and line number when that information is 12076 available. 12077 </description> 12078 <origin>jvmdi</origin> 12079 <capabilities> 12080 <required id="can_generate_breakpoint_events"></required> 12081 </capabilities> 12082 <parameters> 12083 <param id="jni_env"> 12084 <outptr> 12085 <struct>JNIEnv</struct> 12086 </outptr> 12087 <description> 12088 The JNI environment of the event (current) thread. 12089 </description> 12090 </param> 12091 <param id="thread"> 12092 <jthread/> 12093 <description> 12094 Thread that hit the breakpoint 12095 </description> 12096 </param> 12097 <param id="klass"> 12098 <jclass method="method"/> 12099 <description> 12100 Class of the method that hit the breakpoint 12101 </description> 12102 </param> 12103 <param id="method"> 12104 <jmethodID class="klass"/> 12105 <description> 12106 Method that hit the breakpoint 12107 </description> 12108 </param> 12109 <param id="location"> 12110 <jlocation/> 12111 <description> 12112 location of the breakpoint 12113 </description> 12114 </param> 12115 </parameters> 12116 </event> 12117 12118 <event label="Field Access" 12119 id="FieldAccess" const="JVMTI_EVENT_FIELD_ACCESS" filtered="thread" num="63"> 12120 <description> 12121 Field access events are generated whenever a thread accesses 12122 a field that was designated as a watchpoint 12123 with <functionlink id="SetFieldAccessWatch"></functionlink>. 12124 The <code>method</code> and <code>location</code> 12125 parameters uniquely identify the current location and allow 12126 the mapping to source file and line number when that information is 12127 available. 12128 </description> 12129 <origin>jvmdi</origin> 12130 <capabilities> 12131 <required id="can_generate_field_access_events"></required> 12132 </capabilities> 12133 <parameters> 12134 <param id="jni_env"> 12135 <outptr> 12136 <struct>JNIEnv</struct> 12137 </outptr> 12138 <description> 12139 The JNI environment of the event (current) thread 12140 </description> 12141 </param> 12142 <param id="thread"> 12143 <jthread/> 12144 <description> 12145 Thread accessing the field 12146 </description> 12147 </param> 12148 <param id="klass"> 12149 <jclass method="method"/> 12150 <description> 12151 Class of the method where the access is occurring 12152 </description> 12153 </param> 12154 <param id="method"> 12155 <jmethodID class="klass"/> 12156 <description> 12157 Method where the access is occurring 12158 </description> 12159 </param> 12160 <param id="location"> 12161 <jlocation/> 12162 <description> 12163 Location where the access is occurring 12164 </description> 12165 </param> 12166 <param id="field_klass"> 12167 <jclass field="field"/> 12168 <description> 12169 Class of the field being accessed 12170 </description> 12171 </param> 12172 <param id="object"> 12173 <jobject/> 12174 <description> 12175 Object with the field being accessed if the field is an 12176 instance field; <code>NULL</code> otherwise 12177 </description> 12178 </param> 12179 <param id="field"> 12180 <jfieldID class="field_klass"/> 12181 <description> 12182 Field being accessed 12183 </description> 12184 </param> 12185 </parameters> 12186 </event> 12187 12188 <event label="Field Modification" 12189 id="FieldModification" const="JVMTI_EVENT_FIELD_MODIFICATION" filtered="thread" num="64"> 12190 <description> 12191 Field modification events are generated whenever a thread modifies 12192 a field that was designated as a watchpoint 12193 with <functionlink id="SetFieldModificationWatch"></functionlink>. 12194 The <code>method</code> and <code>location</code> 12195 parameters uniquely identify the current location and allow 12196 the mapping to source file and line number when that information is 12197 available. 12198 </description> 12199 <origin>jvmdi</origin> 12200 <capabilities> 12201 <required id="can_generate_field_modification_events"></required> 12202 </capabilities> 12203 <parameters> 12204 <param id="jni_env"> 12205 <outptr> 12206 <struct>JNIEnv</struct> 12207 </outptr> 12208 <description> 12209 The JNI environment of the event (current) thread 12210 </description> 12211 </param> 12212 <param id="thread"> 12213 <jthread/> 12214 <description> 12215 Thread modifying the field 12216 </description> 12217 </param> 12218 <param id="klass"> 12219 <jclass method="method"/> 12220 <description> 12221 Class of the method where the modification is occurring 12222 </description> 12223 </param> 12224 <param id="method"> 12225 <jmethodID class="klass"/> 12226 <description> 12227 Method where the modification is occurring 12228 </description> 12229 </param> 12230 <param id="location"> 12231 <jlocation/> 12232 <description> 12233 Location where the modification is occurring 12234 </description> 12235 </param> 12236 <param id="field_klass"> 12237 <jclass field="field"/> 12238 <description> 12239 Class of the field being modified 12240 </description> 12241 </param> 12242 <param id="object"> 12243 <jobject/> 12244 <description> 12245 Object with the field being modified if the field is an 12246 instance field; <code>NULL</code> otherwise 12247 </description> 12248 </param> 12249 <param id="field"> 12250 <jfieldID class="field_klass"/> 12251 <description> 12252 Field being modified 12253 </description> 12254 </param> 12255 <param id="signature_type"> 12256 <char/> 12257 <description> 12258 Signature type of the new value 12259 </description> 12260 </param> 12261 <param id="new_value"> 12262 <jvalue/> 12263 <description> 12264 The new value 12265 </description> 12266 </param> 12267 </parameters> 12268 </event> 12269 12270 <event label="Frame Pop" 12271 id="FramePop" const="JVMTI_EVENT_FRAME_POP" filtered="thread" num="61"> 12272 <description> 12273 Frame pop events are generated upon exit from a single method 12274 in a single frame as specified 12275 in a call to <functionlink id="NotifyFramePop"></functionlink>. 12276 This is true whether termination is caused by 12277 executing its return instruction 12278 or by throwing an exception to its caller 12279 (see <paramlink id="was_popped_by_exception"></paramlink>). 12280 However, frame pops caused by the <functionlink id="PopFrame"/> 12281 function are not reported. 12282 <p/> 12283 The location reported by <functionlink id="GetFrameLocation"></functionlink> 12284 identifies the executable location in the returning method, 12285 immediately prior to the return. 12286 </description> 12287 <origin>jvmdi</origin> 12288 <capabilities> 12289 <required id="can_generate_frame_pop_events"></required> 12290 </capabilities> 12291 <parameters> 12292 <param id="jni_env"> 12293 <outptr> 12294 <struct>JNIEnv</struct> 12295 </outptr> 12296 <description> 12297 The JNI environment of the event (current) thread 12298 </description> 12299 </param> 12300 <param id="thread"> 12301 <jthread/> 12302 <description> 12303 Thread that is popping the frame 12304 </description> 12305 </param> 12306 <param id="klass"> 12307 <jclass method="method"/> 12308 <description> 12309 Class of the method being popped 12310 </description> 12311 </param> 12312 <param id="method"> 12313 <jmethodID class="klass"/> 12314 <description> 12315 Method being popped 12316 </description> 12317 </param> 12318 <param id="was_popped_by_exception"> 12319 <jboolean/> 12320 <description> 12321 True if frame was popped by a thrown exception. 12322 False if method exited through its return instruction. 12323 </description> 12324 </param> 12325 </parameters> 12326 </event> 12327 12328 <event label="Method Entry" 12329 id="MethodEntry" const="JVMTI_EVENT_METHOD_ENTRY" filtered="thread" num="65"> 12330 <description> 12331 Method entry events are generated upon entry of Java 12332 programming language methods (including native methods). 12333 <p/> 12334 The location reported by <functionlink id="GetFrameLocation"></functionlink> 12335 identifies the initial executable location in 12336 the method. 12337 <p/> 12338 Enabling method 12339 entry or exit events will significantly degrade performance on many platforms and is thus 12340 not advised for performance critical usage (such as profiling). 12341 <internallink id="bci">Bytecode instrumentation</internallink> should be 12342 used in these cases. 12343 </description> 12344 <origin>jvmdi</origin> 12345 <capabilities> 12346 <required id="can_generate_method_entry_events"></required> 12347 </capabilities> 12348 <parameters> 12349 <param id="jni_env"> 12350 <outptr> 12351 <struct>JNIEnv</struct> 12352 </outptr> 12353 <description> 12354 The JNI environment of the event (current) thread 12355 </description> 12356 </param> 12357 <param id="thread"> 12358 <jthread/> 12359 <description> 12360 Thread entering the method 12361 </description> 12362 </param> 12363 <param id="klass"> 12364 <jclass method="method"/> 12365 <description> 12366 Class of the method being entered 12367 </description> 12368 </param> 12369 <param id="method"> 12370 <jmethodID class="klass"/> 12371 <description> 12372 Method being entered 12373 </description> 12374 </param> 12375 </parameters> 12376 </event> 12377 12378 <event label="Method Exit" 12379 id="MethodExit" const="JVMTI_EVENT_METHOD_EXIT" filtered="thread" num="66"> 12380 <description> 12381 Method exit events are generated upon exit from Java 12382 programming language methods (including native methods). 12383 This is true whether termination is caused by 12384 executing its return instruction 12385 or by throwing an exception to its caller 12386 (see <paramlink id="was_popped_by_exception"></paramlink>). 12387 <p/> 12388 The <code>method</code> field uniquely identifies the 12389 method being entered or exited. The <code>frame</code> field provides 12390 access to the stack frame for the method. 12391 <p/> 12392 The location reported by <functionlink id="GetFrameLocation"></functionlink> 12393 identifies the executable location in the returning method 12394 immediately prior to the return. 12395 <p/> 12396 Enabling method 12397 entry or exit events will significantly degrade performance on many platforms and is thus 12398 not advised for performance critical usage (such as profiling). 12399 <internallink id="bci">Bytecode instrumentation</internallink> should be 12400 used in these cases. 12401 </description> 12402 <origin>jvmdi</origin> 12403 <capabilities> 12404 <required id="can_generate_method_exit_events"></required> 12405 </capabilities> 12406 <parameters> 12407 <param id="jni_env"> 12408 <outptr> 12409 <struct>JNIEnv</struct> 12410 </outptr> 12411 <description> 12412 The JNI environment of the event (current) thread 12413 </description> 12414 </param> 12415 <param id="thread"> 12416 <jthread/> 12417 <description> 12418 Thread exiting the method 12419 </description> 12420 </param> 12421 <param id="klass"> 12422 <jclass method="method"/> 12423 <description> 12424 Class of the method being exited 12425 </description> 12426 </param> 12427 <param id="method"> 12428 <jmethodID class="klass"/> 12429 <description> 12430 Method being exited 12431 </description> 12432 </param> 12433 <param id="was_popped_by_exception"> 12434 <jboolean/> 12435 <description> 12436 True if frame was popped by a thrown exception. 12437 False if method exited through its return instruction. 12438 </description> 12439 </param> 12440 <param id="return_value"> 12441 <jvalue/> 12442 <description> 12443 The return value of the method being exited. 12444 Undefined and should not be used if 12445 <paramlink id="was_popped_by_exception"></paramlink> 12446 is true. 12447 </description> 12448 </param> 12449 </parameters> 12450 </event> 12451 12452 <event label="Native Method Bind" phase="any" 12453 id="NativeMethodBind" const="JVMTI_EVENT_NATIVE_METHOD_BIND" num="67"> 12454 <description> 12455 A Native Method Bind event is sent when a VM binds a 12456 Java programming language native method 12457 to the address of a function that implements the native method. 12458 This will occur when the native method is called for the first time 12459 and also occurs when the JNI function <code>RegisterNatives</code> is called. 12460 This event allows the bind to be redirected to an agent-specified 12461 proxy function. 12462 This event is not sent when the native method is unbound. 12463 Typically, this proxy function will need to be specific to a 12464 particular method or, to handle the general case, automatically 12465 generated assembly code, since after instrumentation code is 12466 executed the function at the original binding 12467 address will usually be invoked. 12468 The original binding can be restored or the redirection changed 12469 by use of the JNI function <code>RegisterNatives</code>. 12470 Some events may be sent during the primordial phase, JNI and 12471 most of <jvmti/> cannot be used at this time but the method and 12472 address can be saved for use later. 12473 </description> 12474 <origin>new</origin> 12475 <capabilities> 12476 <required id="can_generate_native_method_bind_events"></required> 12477 </capabilities> 12478 <parameters> 12479 <param id="jni_env"> 12480 <outptr> 12481 <struct>JNIEnv</struct> 12482 </outptr> 12483 <description> 12484 The JNI environment of the event (current) thread 12485 Will be <code>NULL</code> if sent during the primordial 12486 <functionlink id="GetPhase">phase</functionlink>. 12487 </description> 12488 </param> 12489 <param id="thread"> 12490 <jthread/> 12491 <description> 12492 Thread requesting the bind 12493 </description> 12494 </param> 12495 <param id="klass"> 12496 <jclass method="method"/> 12497 <description> 12498 Class of the method being bound 12499 </description> 12500 </param> 12501 <param id="method"> 12502 <jmethodID class="klass"/> 12503 <description> 12504 Native method being bound 12505 </description> 12506 </param> 12507 <param id="address"> 12508 <outptr><void/></outptr> 12509 <description> 12510 The address the VM is about to bind to--that is, the 12511 address of the implementation of the native method 12512 </description> 12513 </param> 12514 <param id="new_address_ptr"> 12515 <agentbuf><void/></agentbuf> 12516 <description> 12517 if the referenced address is changed (that is, if 12518 <code>*new_address_ptr</code> is set), the binding 12519 will instead be made to the supplied address. 12520 </description> 12521 </param> 12522 </parameters> 12523 </event> 12524 12525 <event label="Exception" 12526 id="Exception" const="JVMTI_EVENT_EXCEPTION" filtered="thread" num="58"> 12527 <description> 12528 Exception events are generated whenever an exception is first detected 12529 in a Java programming language method. 12530 Where "exception" means any <code>java.lang.Throwable</code>. 12531 The exception may have been thrown by a Java programming language or native 12532 method, but in the case of native methods, the event is not generated 12533 until the exception is first seen by a Java programming language method. If an exception is 12534 set and cleared in a native method (and thus is never visible to Java programming language code), 12535 no exception event is generated. 12536 <p/> 12537 The <code>method</code> and <code>location</code> 12538 parameters uniquely identify the current location 12539 (where the exception was detected) and allow 12540 the mapping to source file and line number when that information is 12541 available. The <code>exception</code> field identifies the thrown 12542 exception object. The <code>catch_method</code> 12543 and <code>catch_location</code> identify the location of the catch clause, 12544 if any, that handles the thrown exception. If there is no such catch clause, 12545 each field is set to 0. There is no guarantee that the thread will ever 12546 reach this catch clause. If there are native methods on the call stack 12547 between the throw location and the catch clause, the exception may 12548 be reset by one of those native methods. 12549 Similarly, exceptions that are reported as uncaught (<code>catch_klass</code> 12550 et al. set to 0) may in fact be caught by native code. 12551 Agents can check for these occurrences by monitoring 12552 <eventlink id="ExceptionCatch"></eventlink> events. 12553 Note that finally clauses are implemented as catch and re-throw. Therefore they 12554 will be reported in the catch location. 12555 </description> 12556 <origin>jvmdi</origin> 12557 <capabilities> 12558 <required id="can_generate_exception_events"></required> 12559 </capabilities> 12560 <parameters> 12561 <param id="jni_env"> 12562 <outptr> 12563 <struct>JNIEnv</struct> 12564 </outptr> 12565 <description> 12566 The JNI environment of the event (current) thread 12567 </description> 12568 </param> 12569 <param id="thread"> 12570 <jthread/> 12571 <description> 12572 Thread generating the exception 12573 </description> 12574 </param> 12575 <param id="klass"> 12576 <jclass method="method"/> 12577 <description> 12578 Class generating the exception 12579 </description> 12580 </param> 12581 <param id="method"> 12582 <jmethodID class="klass"/> 12583 <description> 12584 Method generating the exception 12585 </description> 12586 </param> 12587 <param id="location"> 12588 <jlocation/> 12589 <description> 12590 Location where exception occurred 12591 </description> 12592 </param> 12593 <param id="exception"> 12594 <jobject/> 12595 <description> 12596 The exception being thrown 12597 </description> 12598 </param> 12599 <param id="catch_klass"> 12600 <jclass method="catch_method"/> 12601 <description> 12602 Class that will catch the exception, or <code>NULL</code> if no known catch 12603 </description> 12604 </param> 12605 <param id="catch_method"> 12606 <jmethodID class="catch_klass"/> 12607 <description> 12608 Method that will catch the exception, or <code>NULL</code> if no known catch 12609 </description> 12610 </param> 12611 <param id="catch_location"> 12612 <jlocation/> 12613 <description> 12614 location which will catch the exception or zero if no known catch 12615 </description> 12616 </param> 12617 </parameters> 12618 </event> 12619 12620 <event label="Exception Catch" 12621 id="ExceptionCatch" const="JVMTI_EVENT_EXCEPTION_CATCH" filtered="thread" num="59"> 12622 <description> 12623 Exception catch events are generated whenever a thrown exception is caught. 12624 Where "exception" means any <code>java.lang.Throwable</code>. 12625 If the exception is caught in a Java programming language method, the event is generated 12626 when the catch clause is reached. If the exception is caught in a native 12627 method, the event is generated as soon as control is returned to a Java programming language 12628 method. Exception catch events are generated for any exception for which 12629 a throw was detected in a Java programming language method. 12630 Note that finally clauses are implemented as catch and re-throw. Therefore they 12631 will generate exception catch events. 12632 <p/> 12633 The <code>method</code> and <code>location</code> 12634 parameters uniquely identify the current location 12635 and allow the mapping to source file and line number when that information is 12636 available. For exceptions caught in a Java programming language method, the 12637 <code>exception</code> object identifies the exception object. Exceptions 12638 caught in native methods are not necessarily available by the time the 12639 exception catch is reported, so the <code>exception</code> field is set 12640 to <code>NULL</code>. 12641 </description> 12642 <origin>jvmdi</origin> 12643 <capabilities> 12644 <required id="can_generate_exception_events"></required> 12645 </capabilities> 12646 <parameters> 12647 <param id="jni_env"> 12648 <outptr> 12649 <struct>JNIEnv</struct> 12650 </outptr> 12651 <description> 12652 The JNI environment of the event (current) thread 12653 </description> 12654 </param> 12655 <param id="thread"> 12656 <jthread/> 12657 <description> 12658 Thread catching the exception 12659 </description> 12660 </param> 12661 <param id="klass"> 12662 <jclass method="method"/> 12663 <description> 12664 Class catching the exception 12665 </description> 12666 </param> 12667 <param id="method"> 12668 <jmethodID class="klass"/> 12669 <description> 12670 Method catching the exception 12671 </description> 12672 </param> 12673 <param id="location"> 12674 <jlocation/> 12675 <description> 12676 Location where exception is being caught 12677 </description> 12678 </param> 12679 <param id="exception"> 12680 <jobject/> 12681 <description> 12682 Exception being caught 12683 </description> 12684 </param> 12685 </parameters> 12686 </event> 12687 12688 <event label="Thread Start" 12689 id="ThreadStart" const="JVMTI_EVENT_THREAD_START" num="52" phase="start"> 12690 <description> 12691 Thread start events are generated by a new thread before its initial 12692 method executes. 12693 <p/> 12694 A thread may be listed in the array returned by 12695 <functionlink id="GetAllThreads"></functionlink> 12696 before its thread start event is generated. 12697 It is possible for other events to be generated 12698 on a thread before its thread start event. 12699 <p/> 12700 The event is sent on the newly started <paramlink id="thread"></paramlink>. 12701 </description> 12702 <origin>jvmdi</origin> 12703 <capabilities> 12704 </capabilities> 12705 <parameters> 12706 <param id="jni_env"> 12707 <outptr> 12708 <struct>JNIEnv</struct> 12709 </outptr> 12710 <description> 12711 The JNI environment of the event (current) thread. 12712 </description> 12713 </param> 12714 <param id="thread"> 12715 <jthread/> 12716 <description> 12717 Thread starting 12718 </description> 12719 </param> 12720 </parameters> 12721 </event> 12722 12723 <event label="Thread End" 12724 id="ThreadEnd" const="JVMTI_EVENT_THREAD_END" filtered="thread" num="53" phase="start"> 12725 <description> 12726 Thread end events are generated by a terminating thread 12727 after its initial method has finished execution. 12728 <p/> 12729 A thread may be listed in the array returned by 12730 <functionlink id="GetAllThreads"></functionlink> 12731 after its thread end event is generated. 12732 No events are generated on a thread 12733 after its thread end event. 12734 <p/> 12735 The event is sent on the dying <paramlink id="thread"></paramlink>. 12736 </description> 12737 <origin>jvmdi</origin> 12738 <capabilities> 12739 </capabilities> 12740 <parameters> 12741 <param id="jni_env"> 12742 <outptr> 12743 <struct>JNIEnv</struct> 12744 </outptr> 12745 <description> 12746 The JNI environment of the event (current) thread. 12747 </description> 12748 </param> 12749 <param id="thread"> 12750 <jthread/> 12751 <description> 12752 Thread ending 12753 </description> 12754 </param> 12755 </parameters> 12756 </event> 12757 12758 <event label="Class Load" 12759 id="ClassLoad" const="JVMTI_EVENT_CLASS_LOAD" filtered="thread" phase="start" num="55"> 12760 <description> 12761 A class load event is generated 12762 <functionlink id="GetLoadedClasses">when a class or interface is created.</functionlink>. 12763 <p/> 12764 Array class creation does not generate a class load event. 12765 The creation of a primitive class (for example, java.lang.Integer.TYPE) 12766 does not generate a class load event. 12767 <p/> 12768 The order of class load events generated by a particular thread is guaranteed 12769 to match the order of class loading within that thread. 12770 <p/> 12771 This event is sent at an early stage in loading the class. As 12772 a result the class should be used carefully. Note, for example, 12773 that methods and fields are not yet loaded, so queries for methods, 12774 fields, subclasses, and so on will not give correct results. 12775 See "Loading of Classes and Interfaces" in the <i>Java Language 12776 Specification</i>. For most 12777 purposes the <eventlink id="ClassPrepare"></eventlink> event will 12778 be more useful. 12779 </description> 12780 <origin>jvmdi</origin> 12781 <capabilities> 12782 </capabilities> 12783 <parameters> 12784 <param id="jni_env"> 12785 <outptr> 12786 <struct>JNIEnv</struct> 12787 </outptr> 12788 <description> 12789 The JNI environment of the event (current) thread 12790 </description> 12791 </param> 12792 <param id="thread"> 12793 <jthread/> 12794 <description> 12795 Thread loading the class 12796 </description> 12797 </param> 12798 <param id="klass"> 12799 <jclass/> 12800 <description> 12801 Class being loaded 12802 </description> 12803 </param> 12804 </parameters> 12805 </event> 12806 12807 <elide> 12808 <event label="Class Unload" 12809 id="ClassUnload" const="JVMTI_EVENT_CLASS_UNLOAD" num="57"> 12810 <description> 12811 A class unload event is generated when the class is about to be unloaded. 12812 Class unload events take place during garbage collection and must be 12813 handled extremely carefully. The garbage collector holds many locks 12814 and has suspended all other threads, so the event handler cannot depend 12815 on the ability to acquire any locks. The class unload event handler should 12816 do as little as possible, perhaps by queuing information to be processed 12817 later. In particular, the <code>jclass</code> should be used only in 12818 the JNI function <code>isSameObject</code> or in the following <jvmti/> functions: 12819 <ul> 12820 <li><functionlink id="GetClassSignature"></functionlink></li> 12821 <li><functionlink id="GetSourceFileName"></functionlink></li> 12822 <li><functionlink id="IsInterface"></functionlink></li> 12823 <li><functionlink id="IsArrayClass"></functionlink></li> 12824 </ul> 12825 </description> 12826 <origin>jvmdi</origin> 12827 <capabilities> 12828 </capabilities> 12829 <parameters> 12830 <param id="jni_env"> 12831 <outptr> 12832 <struct>JNIEnv</struct> 12833 </outptr> 12834 <description> 12835 The JNI environment of the event (current) thread 12836 </description> 12837 </param> 12838 <param id="thread"> 12839 <jthread/> 12840 <description> 12841 Thread generating the class unload 12842 </description> 12843 </param> 12844 <param id="klass"> 12845 <jclass/> 12846 <description> 12847 Class being unloaded 12848 </description> 12849 </param> 12850 </parameters> 12851 </event> 12852 </elide> 12853 12854 <event label="Class Prepare" 12855 id="ClassPrepare" const="JVMTI_EVENT_CLASS_PREPARE" filtered="thread" phase="start" num="56"> 12856 <description> 12857 A class prepare event is generated when class preparation is complete. 12858 At this point, class fields, methods, and implemented interfaces are 12859 available, and no code from the class has been executed. Since array 12860 classes never have fields or methods, class prepare events are not 12861 generated for them. Class prepare events are not generated for 12862 primitive classes (for example, <code>java.lang.Integer.TYPE</code>). 12863 </description> 12864 <origin>jvmdi</origin> 12865 <capabilities> 12866 </capabilities> 12867 <parameters> 12868 <param id="jni_env"> 12869 <outptr> 12870 <struct>JNIEnv</struct> 12871 </outptr> 12872 <description> 12873 The JNI environment of the event (current) thread 12874 </description> 12875 </param> 12876 <param id="thread"> 12877 <jthread/> 12878 <description> 12879 Thread generating the class prepare 12880 </description> 12881 </param> 12882 <param id="klass"> 12883 <jclass/> 12884 <description> 12885 Class being prepared 12886 </description> 12887 </param> 12888 </parameters> 12889 </event> 12890 12891 <event label="Class File Load Hook" phase="any" 12892 id="ClassFileLoadHook" const="JVMTI_EVENT_CLASS_FILE_LOAD_HOOK" num="54"> 12893 <description> 12894 This event is sent when the VM obtains class file data, 12895 but before it constructs 12896 the in-memory representation for that class. 12897 This event is also sent when the class is being modified by the 12898 <functionlink id="RetransformClasses"/> function or 12899 the <functionlink id="RedefineClasses"/> function, 12900 called in any <jvmti/> environment. 12901 The agent can instrument 12902 the existing class file data sent by the VM to include profiling/debugging hooks. 12903 See the description of 12904 <internallink id="bci">bytecode instrumentation</internallink> 12905 for usage information. 12906 <p/> 12907 When the capabilities 12908 <internallink id="jvmtiCapabilities.can_generate_early_class_hook_events"> 12909 <code>can_generate_early_class_hook_events</code></internallink> and 12910 <internallink id="jvmtiCapabilities.can_generate_all_class_hook_events"> 12911 <code>can_generate_all_class_hook_events</code></internallink> 12912 are enabled then this event may be sent in the primordial phase. 12913 Otherwise, this event may be sent before the VM is initialized (the start 12914 <functionlink id="GetPhase">phase</functionlink>). 12915 Some classes might not be compatible 12916 with the function (eg. ROMized classes or implementation defined classes) and this event will 12917 not be generated for these classes. 12918 <p/> 12919 The agent must allocate the space for the modified 12920 class file data buffer 12921 using the memory allocation function 12922 <functionlink id="Allocate"></functionlink> because the 12923 VM is responsible for freeing the new class file data buffer 12924 using <functionlink id="Deallocate"></functionlink>. 12925 <p/> 12926 If the agent wishes to modify the class file, it must set 12927 <code>new_class_data</code> to point 12928 to the newly instrumented class file data buffer and set 12929 <code>new_class_data_len</code> to the length of that 12930 buffer before returning 12931 from this call. If no modification is desired, the agent simply 12932 does not set <code>new_class_data</code>. If multiple agents 12933 have enabled this event the results are chained. That is, if 12934 <code>new_class_data</code> has been set, it becomes the 12935 <code>class_data</code> for the next agent. 12936 <p/> 12937 When handling a class load in the live phase, then the 12938 <functionlink id="GetNamedModule"></functionlink> 12939 function can be used to map class loader and a package name to a module. 12940 When a class is being redefined or retransformed then 12941 <code>class_being_redefined</code> is non <code>NULL</code> and so 12942 the JNI <code>GetModule</code> function can also be used 12943 to obtain the Module. 12944 <p/> 12945 The order that this event is sent to each environment differs 12946 from other events. 12947 This event is sent to environments in the following order: 12948 <ul> 12949 <li><fieldlink id="can_retransform_classes" 12950 struct="jvmtiCapabilities">retransformation 12951 incapable</fieldlink> 12952 environments, in the 12953 order in which they were created 12954 </li> 12955 <li><fieldlink id="can_retransform_classes" 12956 struct="jvmtiCapabilities">retransformation 12957 capable</fieldlink> 12958 environments, in the 12959 order in which they were created 12960 </li> 12961 </ul> 12962 When triggered by <functionlink id="RetransformClasses"/>, 12963 this event is sent only to <fieldlink id="can_retransform_classes" 12964 struct="jvmtiCapabilities">retransformation 12965 capable</fieldlink> 12966 environments. 12967 </description> 12968 <origin>jvmpi</origin> 12969 <capabilities> 12970 <capability id="can_generate_all_class_hook_events"></capability> 12971 <capability id="can_generate_early_class_hook_events"></capability> 12972 </capabilities> 12973 <parameters> 12974 <param id="jni_env"> 12975 <outptr> 12976 <struct>JNIEnv</struct> 12977 </outptr> 12978 <description> 12979 The JNI environment of the event (current) thread. 12980 </description> 12981 </param> 12982 <param id="class_being_redefined"> 12983 <jclass/> 12984 <description> 12985 The class being 12986 <functionlink id="RedefineClasses">redefined</functionlink> or 12987 <functionlink id="RetransformClasses">retransformed</functionlink>. 12988 <code>NULL</code> if sent by class load. 12989 </description> 12990 </param> 12991 <param id="loader"> 12992 <jobject/> 12993 <description> 12994 The class loader loading the class. 12995 <code>NULL</code> if the bootstrap class loader. 12996 </description> 12997 </param> 12998 <param id="name"> 12999 <vmbuf><char/></vmbuf> 13000 <description> 13001 Name of class being loaded as a VM internal qualified name 13002 (for example, "java/util/List"), encoded as a 13003 <internallink id="mUTF">modified UTF-8</internallink> string. 13004 Note: if the class is defined with a <code>NULL</code> name or 13005 without a name specified, <code>name</code> will be <code>NULL</code>. 13006 </description> 13007 </param> 13008 <param id="protection_domain"> 13009 <jobject/> 13010 <description> 13011 The <code>ProtectionDomain</code> of the class. 13012 </description> 13013 </param> 13014 <param id="class_data_len"> 13015 <jint/> 13016 <description> 13017 Length of current class file data buffer. 13018 </description> 13019 </param> 13020 <param id="class_data"> 13021 <vmbuf><uchar/></vmbuf> 13022 <description> 13023 Pointer to the current class file data buffer. 13024 </description> 13025 </param> 13026 <param id="new_class_data_len"> 13027 <outptr><jint/></outptr> 13028 <description> 13029 Pointer to the length of the new class file data buffer. 13030 </description> 13031 </param> 13032 <param id="new_class_data"> 13033 <agentbuf incount="new_class_data_len"><uchar/></agentbuf> 13034 <description> 13035 Pointer to the pointer to the instrumented class file data buffer. 13036 </description> 13037 </param> 13038 </parameters> 13039 </event> 13040 13041 <event label="VM Start Event" 13042 id="VMStart" const="JVMTI_EVENT_VM_START" num="57" phase="start"> 13043 <description> 13044 The VM start event signals the start of the VM. 13045 At this time JNI is live but the VM is not yet fully initialized. 13046 Once this event is generated, the agent is free to call any JNI function. 13047 This event signals the beginning of the start phase, 13048 <jvmti/> functions permitted in the start phase may be called. 13049 <p/> 13050 The timing of this event may depend on whether the agent has added the 13051 <internallink id="jvmtiCapabilities.can_generate_early_vmstart"> 13052 <code>can_generate_early_vmstart</code></internallink> capability or not. 13053 If the capability has been added then the VM posts the event as early 13054 as possible. The VM is capable of executing bytecode but it may not have 13055 initialized to the point where it can load classes in modules other than 13056 <code>java.base</code>, or even arbitrary classes in <code>java.base</code>. 13057 Agents that do load-time instrumentation in this 13058 phase must take great care when instrumenting code that potentially 13059 executes in this phase. Extreme care should also be taken with JNI 13060 <code>FindClass</code> as it may not be possible to load classes and attempts 13061 to do so may result in unpredictable behavior, maybe even stability issues 13062 on some VM implementations. 13063 If the capability has not been added then the VM delays posting this 13064 event until it is capable of loading classes in modules other than 13065 <code>java.base</code> or the VM has completed its initialization. 13066 Agents that create more than one JVM TI environment, where the 13067 capability is added to some but not all environments, may observe the 13068 start phase beginning earlier in the JVM TI environments that possess 13069 the capability. 13070 <p/> 13071 In the case of VM start-up failure, this event will not be sent. 13072 </description> 13073 <origin>jvmdi</origin> 13074 <capabilities> 13075 </capabilities> 13076 <parameters> 13077 <param id="jni_env"> 13078 <outptr> 13079 <struct>JNIEnv</struct> 13080 </outptr> 13081 <description> 13082 The JNI environment of the event (current) thread. 13083 </description> 13084 </param> 13085 </parameters> 13086 </event> 13087 13088 <event label="VM Initialization Event" 13089 id="VMInit" const="JVMTI_EVENT_VM_INIT" num="50"> 13090 <description> 13091 The VM initialization event signals the completion of VM initialization. Once 13092 this event is generated, the agent is free to call any JNI or <jvmti/> 13093 function. The VM initialization event can be preceded by or can be concurrent 13094 with other events, but 13095 the preceding events should be handled carefully, if at all, because the 13096 VM has not completed its initialization. The thread start event for the 13097 main application thread is guaranteed not to occur until after the 13098 handler for the VM initialization event returns. 13099 <p/> 13100 In the case of VM start-up failure, this event will not be sent. 13101 </description> 13102 <origin>jvmdi</origin> 13103 <capabilities> 13104 </capabilities> 13105 <parameters> 13106 <param id="jni_env"> 13107 <outptr> 13108 <struct>JNIEnv</struct> 13109 </outptr> 13110 <description> 13111 The JNI environment of the event (current) thread. 13112 </description> 13113 </param> 13114 <param id="thread"> 13115 <jthread/> 13116 <description> 13117 The initial thread 13118 </description> 13119 </param> 13120 </parameters> 13121 </event> 13122 13123 <event label="VM Death Event" 13124 id="VMDeath" const="JVMTI_EVENT_VM_DEATH" num="51"> 13125 <description> 13126 The VM death event notifies the agent of the termination of the VM. 13127 No events will occur after the VMDeath event. 13128 <p/> 13129 In the case of VM start-up failure, this event will not be sent. 13130 Note that <internallink id="onunload">Agent_OnUnload</internallink> 13131 will still be called in these cases. 13132 </description> 13133 <origin>jvmdi</origin> 13134 <capabilities> 13135 </capabilities> 13136 <parameters> 13137 <param id="jni_env"> 13138 <outptr> 13139 <struct>JNIEnv</struct> 13140 </outptr> 13141 <description> 13142 The JNI environment of the event (current) thread 13143 </description> 13144 </param> 13145 </parameters> 13146 </event> 13147 13148 <event label="Compiled Method Load" phase="start" 13149 id="CompiledMethodLoad" const="JVMTI_EVENT_COMPILED_METHOD_LOAD" num="68"> 13150 <description> 13151 Sent when a method is compiled and loaded into memory by the VM. 13152 If it is unloaded, the <eventlink id="CompiledMethodUnload"/> event is sent. 13153 If it is moved, the <eventlink id="CompiledMethodUnload"/> event is sent, 13154 followed by a new <code>CompiledMethodLoad</code> event. 13155 Note that a single method may have multiple compiled forms, and that 13156 this event will be sent for each form. 13157 Note also that several methods may be inlined into a single 13158 address range, and that this event will be sent for each method. 13159 <p/> 13160 These events can be sent after their initial occurrence with 13161 <functionlink id="GenerateEvents"></functionlink>. 13162 </description> 13163 <origin>jvmpi</origin> 13164 <typedef id="jvmtiAddrLocationMap" label="Native address to location entry"> 13165 <field id="start_address"> 13166 <vmbuf><void/></vmbuf> 13167 <description> 13168 Starting native address of code corresponding to a location 13169 </description> 13170 </field> 13171 <field id="location"> 13172 <jlocation/> 13173 <description> 13174 Corresponding location. See 13175 <functionlink id="GetJLocationFormat"></functionlink> 13176 for the meaning of location. 13177 </description> 13178 </field> 13179 </typedef> 13180 <capabilities> 13181 <required id="can_generate_compiled_method_load_events"></required> 13182 </capabilities> 13183 <parameters> 13184 <param id="klass"> 13185 <jclass method="method"/> 13186 <description> 13187 Class of the method being compiled and loaded 13188 </description> 13189 </param> 13190 <param id="method"> 13191 <jmethodID class="klass"/> 13192 <description> 13193 Method being compiled and loaded 13194 </description> 13195 </param> 13196 <param id="code_size"> 13197 <jint/> 13198 <description> 13199 Size of compiled code 13200 </description> 13201 </param> 13202 <param id="code_addr"> 13203 <vmbuf><void/></vmbuf> 13204 <description> 13205 Address where compiled method code is loaded 13206 </description> 13207 </param> 13208 <param id="map_length"> 13209 <jint/> 13210 <description> 13211 Number of <typelink id="jvmtiAddrLocationMap"></typelink> 13212 entries in the address map. 13213 Zero if mapping information cannot be supplied. 13214 </description> 13215 </param> 13216 <param id="map"> 13217 <vmbuf><struct>jvmtiAddrLocationMap</struct></vmbuf> 13218 <description> 13219 Map from native addresses to location. 13220 The native address range of each entry is from 13221 <fieldlink id="start_address" struct="jvmtiAddrLocationMap"></fieldlink> 13222 to <code>start_address-1</code> of the next entry. 13223 <code>NULL</code> if mapping information cannot be supplied. 13224 </description> 13225 </param> 13226 <param id="compile_info"> 13227 <vmbuf><void/></vmbuf> 13228 <description> 13229 VM-specific compilation information. 13230 The referenced compile information is managed by the VM 13231 and must not depend on the agent for collection. 13232 A VM implementation defines the content and lifetime 13233 of the information. 13234 </description> 13235 </param> 13236 </parameters> 13237 </event> 13238 13239 <event label="Compiled Method Unload" phase="start" 13240 id="CompiledMethodUnload" const="JVMTI_EVENT_COMPILED_METHOD_UNLOAD" num="69"> 13241 <description> 13242 Sent when a compiled method is unloaded from memory. 13243 This event might not be sent on the thread which performed the unload. 13244 This event may be sent sometime after the unload occurs, but 13245 will be sent before the memory is reused 13246 by a newly generated compiled method. This event may be sent after 13247 the class is unloaded. 13248 </description> 13249 <origin>jvmpi</origin> 13250 <capabilities> 13251 <required id="can_generate_compiled_method_load_events"></required> 13252 </capabilities> 13253 <parameters> 13254 <param id="klass"> 13255 <jclass method="method"/> 13256 <description> 13257 Class of the compiled method being unloaded. 13258 </description> 13259 </param> 13260 <param id="method"> 13261 <jmethodID class="klass"/> 13262 <description> 13263 Compiled method being unloaded. 13264 For identification of the compiled method only -- the class 13265 may be unloaded and therefore the method should not be used 13266 as an argument to further JNI or <jvmti/> functions. 13267 </description> 13268 </param> 13269 <param id="code_addr"> 13270 <vmbuf><void/></vmbuf> 13271 <description> 13272 Address where compiled method code was loaded. 13273 For identification of the compiled method only -- 13274 the space may have been reclaimed. 13275 </description> 13276 </param> 13277 </parameters> 13278 </event> 13279 13280 <event label="Dynamic Code Generated" phase="any" 13281 id="DynamicCodeGenerated" const="JVMTI_EVENT_DYNAMIC_CODE_GENERATED" num="70"> 13282 <description> 13283 Sent when a component of the virtual machine is generated dynamically. 13284 This does not correspond to Java programming language code that is 13285 compiled--see <eventlink id="CompiledMethodLoad"></eventlink>. 13286 This is for native code--for example, an interpreter that is generated 13287 differently depending on command-line options. 13288 <p/> 13289 Note that this event has no controlling capability. 13290 If a VM cannot generate these events, it simply does not send any. 13291 <p/> 13292 These events can be sent after their initial occurrence with 13293 <functionlink id="GenerateEvents"></functionlink>. 13294 </description> 13295 <origin>jvmpi</origin> 13296 <capabilities> 13297 </capabilities> 13298 <parameters> 13299 <param id="name"> 13300 <vmbuf><char/></vmbuf> 13301 <description> 13302 Name of the code, encoded as a 13303 <internallink id="mUTF">modified UTF-8</internallink> string. 13304 Intended for display to an end-user. 13305 The name might not be unique. 13306 </description> 13307 </param> 13308 <param id="address"> 13309 <vmbuf><void/></vmbuf> 13310 <description> 13311 Native address of the code 13312 </description> 13313 </param> 13314 <param id="length"> 13315 <jint/> 13316 <description> 13317 Length in bytes of the code 13318 </description> 13319 </param> 13320 </parameters> 13321 </event> 13322 13323 <event label="Data Dump Request" 13324 id="DataDumpRequest" const="JVMTI_EVENT_DATA_DUMP_REQUEST" num="71"> 13325 <description> 13326 Sent by the VM to request the agent to dump its data. This 13327 is just a hint and the agent need not react to this event. 13328 This is useful for processing command-line signals from users. For 13329 example, in the Java 2 SDK a CTRL-Break on Win32 and a CTRL-\ on Linux 13330 causes the VM to send this event to the agent. 13331 </description> 13332 <origin>jvmpi</origin> 13333 <capabilities> 13334 </capabilities> 13335 <parameters> 13336 </parameters> 13337 </event> 13338 13339 <event label="Monitor Contended Enter" 13340 id="MonitorContendedEnter" const="JVMTI_EVENT_MONITOR_CONTENDED_ENTER" filtered="thread" num="75"> 13341 <description> 13342 Sent when a thread is attempting to enter a Java programming language 13343 monitor already acquired by another thread. 13344 </description> 13345 <origin>jvmpi</origin> 13346 <capabilities> 13347 <required id="can_generate_monitor_events"></required> 13348 </capabilities> 13349 <parameters> 13350 <param id="jni_env"> 13351 <outptr> 13352 <struct>JNIEnv</struct> 13353 </outptr> 13354 <description> 13355 The JNI environment of the event (current) thread 13356 </description> 13357 </param> 13358 <param id="thread"> 13359 <jthread/> 13360 <description> 13361 JNI local reference to the thread 13362 attempting to enter the monitor 13363 </description> 13364 </param> 13365 <param id="object"> 13366 <jobject/> 13367 <description> 13368 JNI local reference to the monitor 13369 </description> 13370 </param> 13371 </parameters> 13372 </event> 13373 13374 <event label="Monitor Contended Entered" 13375 id="MonitorContendedEntered" const="JVMTI_EVENT_MONITOR_CONTENDED_ENTERED" filtered="thread" num="76"> 13376 <description> 13377 Sent when a thread enters a Java programming language 13378 monitor after waiting for it to be released by another thread. 13379 </description> 13380 <origin>jvmpi</origin> 13381 <capabilities> 13382 <required id="can_generate_monitor_events"></required> 13383 </capabilities> 13384 <parameters> 13385 <param id="jni_env"> 13386 <outptr> 13387 <struct>JNIEnv</struct> 13388 </outptr> 13389 <description> 13390 The JNI environment of the event (current) thread 13391 </description> 13392 </param> 13393 <param id="thread"> 13394 <jthread/> 13395 <description> 13396 JNI local reference to the thread entering 13397 the monitor 13398 </description> 13399 </param> 13400 <param id="object"> 13401 <jobject/> 13402 <description> 13403 JNI local reference to the monitor 13404 </description> 13405 </param> 13406 </parameters> 13407 </event> 13408 13409 <event label="Monitor Wait" 13410 id="MonitorWait" const="JVMTI_EVENT_MONITOR_WAIT" filtered="thread" num="73"> 13411 <description> 13412 Sent when a thread is about to wait on an object. 13413 </description> 13414 <origin>jvmpi</origin> 13415 <capabilities> 13416 <required id="can_generate_monitor_events"></required> 13417 </capabilities> 13418 <parameters> 13419 <param id="jni_env"> 13420 <outptr> 13421 <struct>JNIEnv</struct> 13422 </outptr> 13423 <description> 13424 The JNI environment of the event (current) thread 13425 </description> 13426 </param> 13427 <param id="thread"> 13428 <jthread/> 13429 <description> 13430 JNI local reference to the thread about to wait 13431 </description> 13432 </param> 13433 <param id="object"> 13434 <jobject/> 13435 <description> 13436 JNI local reference to the monitor 13437 </description> 13438 </param> 13439 <param id="timeout"> 13440 <jlong/> 13441 <description> 13442 The number of milliseconds the thread will wait 13443 </description> 13444 </param> 13445 </parameters> 13446 </event> 13447 13448 <event label="Monitor Waited" 13449 id="MonitorWaited" const="JVMTI_EVENT_MONITOR_WAITED" filtered="thread" num="74"> 13450 <description> 13451 Sent when a thread finishes waiting on an object. 13452 </description> 13453 <origin>jvmpi</origin> 13454 <capabilities> 13455 <required id="can_generate_monitor_events"></required> 13456 </capabilities> 13457 <parameters> 13458 <param id="jni_env"> 13459 <outptr> 13460 <struct>JNIEnv</struct> 13461 </outptr> 13462 <description> 13463 The JNI environment of the event (current) thread 13464 </description> 13465 </param> 13466 <param id="thread"> 13467 <jthread/> 13468 <description> 13469 JNI local reference to the thread that was finished waiting 13470 </description> 13471 </param> 13472 <param id="object"> 13473 <jobject/> 13474 <description> 13475 JNI local reference to the monitor. 13476 </description> 13477 </param> 13478 <param id="timed_out"> 13479 <jboolean/> 13480 <description> 13481 True if the monitor timed out 13482 </description> 13483 </param> 13484 </parameters> 13485 </event> 13486 13487 <event label="Resource Exhausted" 13488 id="ResourceExhausted" const="JVMTI_EVENT_RESOURCE_EXHAUSTED" num="80" 13489 since="1.1"> 13490 <description> 13491 Sent when a VM resource needed by a running application has been exhausted. 13492 Except as required by the optional capabilities, the set of resources 13493 which report exhaustion is implementation dependent. 13494 <p/> 13495 The following bit flags define the properties of the resource exhaustion: 13496 <constants id="jvmtiResourceExhaustionFlags" 13497 label="Resource Exhaustion Flags" 13498 kind="bits" 13499 since="1.1"> 13500 <constant id="JVMTI_RESOURCE_EXHAUSTED_OOM_ERROR" num="0x0001"> 13501 After this event returns, the VM will throw a 13502 <code>java.lang.OutOfMemoryError</code>. 13503 </constant> 13504 <constant id="JVMTI_RESOURCE_EXHAUSTED_JAVA_HEAP" num="0x0002"> 13505 The VM was unable to allocate memory from the <tm>Java</tm> 13506 platform <i>heap</i>. 13507 The <i>heap</i> is the runtime 13508 data area from which memory for all class instances and 13509 arrays are allocated. 13510 </constant> 13511 <constant id="JVMTI_RESOURCE_EXHAUSTED_THREADS" num="0x0004"> 13512 The VM was unable to create a thread. 13513 </constant> 13514 </constants> 13515 </description> 13516 <origin>new</origin> 13517 <capabilities> 13518 <capability id="can_generate_resource_exhaustion_heap_events"> 13519 Can generate events when the VM is unable to allocate memory from the 13520 <internallink id="JVMTI_RESOURCE_EXHAUSTED_JAVA_HEAP">heap</internallink>. 13521 </capability> 13522 <capability id="can_generate_resource_exhaustion_threads_events"> 13523 Can generate events when the VM is unable to 13524 <internallink id="JVMTI_RESOURCE_EXHAUSTED_THREADS">create 13525 a thread</internallink>. 13526 </capability> 13527 </capabilities> 13528 <parameters> 13529 <param id="jni_env"> 13530 <outptr> 13531 <struct>JNIEnv</struct> 13532 </outptr> 13533 <description> 13534 The JNI environment of the event (current) thread 13535 </description> 13536 </param> 13537 <param id="flags"> 13538 <jint/> 13539 <description> 13540 Flags defining the properties of the of resource exhaustion 13541 as specified by the 13542 <internallink id="jvmtiResourceExhaustionFlags">Resource 13543 Exhaustion Flags</internallink>. 13544 </description> 13545 </param> 13546 <param id="reserved"> 13547 <vmbuf><void/></vmbuf> 13548 <description> 13549 Reserved. 13550 </description> 13551 </param> 13552 <param id="description"> 13553 <vmbuf><char/></vmbuf> 13554 <description> 13555 Description of the resource exhaustion, encoded as a 13556 <internallink id="mUTF">modified UTF-8</internallink> string. 13557 </description> 13558 </param> 13559 </parameters> 13560 </event> 13561 13562 <event label="VM Object Allocation" 13563 id="VMObjectAlloc" const="JVMTI_EVENT_VM_OBJECT_ALLOC" num="84"> 13564 <description> 13565 Sent when a method causes the virtual machine to directly allocate an 13566 Object visible to Java programming language code. 13567 Generally object allocation should be detected by instrumenting 13568 the bytecodes of allocating methods. 13569 Object allocation generated in native code by JNI function 13570 calls should be detected using 13571 <internallink id="jniIntercept">JNI function interception</internallink>. 13572 Some methods might not have associated bytecodes and are not 13573 native methods, they instead are executed directly by the 13574 VM. These methods should send this event. 13575 Virtual machines which are incapable of bytecode instrumentation 13576 for some or all of their methods can send this event. 13577 13578 Note that the <internallink 13579 id="SampledObjectAlloc">SampledObjectAlloc</internallink> 13580 event is triggered on all Java object allocations, including those 13581 caused by bytecode method execution, JNI method execution, and 13582 directly by VM methods. 13583 <p/> 13584 Typical examples where this event might be sent: 13585 <ul> 13586 <li>Reflection -- for example, <code>java.lang.Class.newInstance()</code></li> 13587 <li>Methods not represented by bytecodes -- for example, VM intrinsics and 13588 J2ME preloaded classes</li> 13589 </ul> 13590 Cases where this event would not be generated: 13591 <ul> 13592 <li>Allocation due to bytecodes -- for example, the <code>new</code> 13593 and <code>newarray</code> VM instructions</li> 13594 <li>Allocation due to JNI function calls -- for example, 13595 <code>AllocObject</code></li> 13596 <li>Allocations during VM initialization</li> 13597 <li>VM internal objects</li> 13598 </ul> 13599 </description> 13600 <origin>new</origin> 13601 <capabilities> 13602 <required id="can_generate_vm_object_alloc_events"></required> 13603 </capabilities> 13604 <parameters> 13605 <param id="jni_env"> 13606 <outptr> 13607 <struct>JNIEnv</struct> 13608 </outptr> 13609 <description> 13610 The JNI environment of the event (current) thread 13611 </description> 13612 </param> 13613 <param id="thread"> 13614 <jthread/> 13615 <description> 13616 Thread allocating the object. 13617 </description> 13618 </param> 13619 <param id="object"> 13620 <jobject/> 13621 <description> 13622 JNI local reference to the object that was allocated. 13623 </description> 13624 </param> 13625 <param id="object_klass"> 13626 <jclass/> 13627 <description> 13628 JNI local reference to the class of the object. 13629 </description> 13630 </param> 13631 <param id="size"> 13632 <jlong/> 13633 <description> 13634 Size of the object (in bytes). See <functionlink id="GetObjectSize"/>. 13635 </description> 13636 </param> 13637 </parameters> 13638 </event> 13639 13640 <event label="Sampled Object Allocation" 13641 id="SampledObjectAlloc" const="JVMTI_EVENT_SAMPLED_OBJECT_ALLOC" filtered="thread" num="86" since="11"> 13642 <description> 13643 Sent when an allocated object is sampled. 13644 By default, the sampling interval is set to 512KB. The sampling is semi-random to avoid 13645 pattern-based bias and provides an approximate overall average interval over long periods of 13646 sampling. 13647 <p/> 13648 Each thread tracks how many bytes it has allocated since it sent the last event. 13649 When the number of bytes exceeds the sampling interval, it will send another event. 13650 This implies that, on average, one object will be sampled every time a thread has 13651 allocated 512KB bytes since the last sample. 13652 <p/> 13653 Note that the sampler is pseudo-random: it will not sample every 512KB precisely. 13654 The goal of this is to ensure high quality sampling even if allocation is 13655 happening in a fixed pattern (i.e., the same set of objects are being allocated 13656 every 512KB). 13657 <p/> 13658 If another sampling interval is required, the user can call 13659 <functionlink id="SetHeapSamplingInterval"></functionlink> with a strictly positive integer value, 13660 representing the new sampling interval. 13661 <p/> 13662 This event is sent once the sampled allocation has been performed. It provides the object, stack trace 13663 of the allocation, the thread allocating, the size of allocation, and the object's class. 13664 <p/> 13665 A typical use case of this system is to determine where heap allocations originate. 13666 In conjunction with weak references and the function 13667 <functionlink id="GetStackTrace"></functionlink>, a user can track which objects were allocated from which 13668 stack trace, and which are still live during the execution of the program. 13669 </description> 13670 <origin>new</origin> 13671 <capabilities> 13672 <required id="can_generate_sampled_object_alloc_events"></required> 13673 </capabilities> 13674 <parameters> 13675 <param id="jni_env"> 13676 <outptr> 13677 <struct>JNIEnv</struct> 13678 </outptr> 13679 <description> 13680 The JNI environment of the event (current) thread. 13681 </description> 13682 </param> 13683 <param id="thread"> 13684 <jthread/> 13685 <description> 13686 Thread allocating the object. 13687 </description> 13688 </param> 13689 <param id="object"> 13690 <jobject/> 13691 <description> 13692 JNI local reference to the object that was allocated. 13693 </description> 13694 </param> 13695 <param id="object_klass"> 13696 <jclass/> 13697 <description> 13698 JNI local reference to the class of the object 13699 </description> 13700 </param> 13701 <param id="size"> 13702 <jlong/> 13703 <description> 13704 Size of the object (in bytes). See <functionlink id="GetObjectSize"/>. 13705 </description> 13706 </param> 13707 </parameters> 13708 </event> 13709 13710 <event label="Object Free" 13711 id="ObjectFree" const="JVMTI_EVENT_OBJECT_FREE" num="83"> 13712 <description> 13713 An Object Free event is sent when the garbage collector frees an object. 13714 Events are only sent for tagged objects--see 13715 <internallink id="Heap">heap functions</internallink>. 13716 <p/> 13717 The event handler must not use JNI functions and 13718 must not use <jvmti/> functions except those which 13719 specifically allow such use (see the raw monitor, memory management, 13720 and environment local storage functions). 13721 </description> 13722 <origin>new</origin> 13723 <capabilities> 13724 <required id="can_generate_object_free_events"></required> 13725 </capabilities> 13726 <parameters> 13727 <param id="tag"> 13728 <jlong/> 13729 <description> 13730 The freed object's tag 13731 </description> 13732 </param> 13733 </parameters> 13734 </event> 13735 13736 <event label="Garbage Collection Start" 13737 id="GarbageCollectionStart" const="JVMTI_EVENT_GARBAGE_COLLECTION_START" num="81"> 13738 <description> 13739 A Garbage Collection Start event is sent when a 13740 garbage collection pause begins. 13741 Only stop-the-world collections are reported--that is, collections during 13742 which all threads cease to modify the state of the Java virtual machine. 13743 This means that some collectors will never generate these events. 13744 This event is sent while the VM is still stopped, thus 13745 the event handler must not use JNI functions and 13746 must not use <jvmti/> functions except those which 13747 specifically allow such use (see the raw monitor, memory management, 13748 and environment local storage functions). 13749 <p/> 13750 This event is always sent as a matched pair with 13751 <eventlink id="GarbageCollectionFinish"/> 13752 (assuming both events are enabled) and no garbage collection 13753 events will occur between them. 13754 </description> 13755 <origin>new</origin> 13756 <capabilities> 13757 <required id="can_generate_garbage_collection_events"></required> 13758 </capabilities> 13759 <parameters> 13760 </parameters> 13761 </event> 13762 13763 <event label="Garbage Collection Finish" 13764 id="GarbageCollectionFinish" const="JVMTI_EVENT_GARBAGE_COLLECTION_FINISH" num="82"> 13765 <description> 13766 A Garbage Collection Finish event is sent when a 13767 garbage collection pause ends. 13768 This event is sent while the VM is still stopped, thus 13769 the event handler must not use JNI functions and 13770 must not use <jvmti/> functions except those which 13771 specifically allow such use (see the raw monitor, memory management, 13772 and environment local storage functions). 13773 <p/> 13774 Some agents may need to do post garbage collection operations that 13775 require the use of the disallowed <jvmti/> or JNI functions. For these 13776 cases an agent thread can be created which waits on a raw monitor, 13777 and the handler for the Garbage Collection Finish event simply 13778 notifies the raw monitor 13779 <p/> 13780 This event is always sent as a matched pair with 13781 <eventlink id="GarbageCollectionStart"/> (assuming both events are enabled). 13782 <issue> 13783 The most important use of this event is to provide timing information, 13784 and thus additional information is not required. However, 13785 information about the collection which is "free" should be included - 13786 what that information is needs to be determined. 13787 </issue> 13788 </description> 13789 <origin>new</origin> 13790 <capabilities> 13791 <required id="can_generate_garbage_collection_events"></required> 13792 </capabilities> 13793 <parameters> 13794 </parameters> 13795 </event> 13796 13797 <elide> 13798 <event label="Verbose Output" phase="any" 13799 id="VerboseOutput" const="JVMTI_EVENT_VERBOSE_OUTPUT" num="85"> 13800 <description> 13801 Send verbose messages as strings. 13802 <issue> 13803 This format is extremely fragile, as it can change with each 13804 platform, collector and version. Alternatives include: 13805 <ul> 13806 <li>building off Java programming language M and M APIs</li> 13807 <li>XML</li> 13808 <li>key/value pairs</li> 13809 <li>removing it</li> 13810 </ul> 13811 </issue> 13812 <issue> 13813 Though this seemed trivial to implement. 13814 In the RI it appears this will be quite complex. 13815 </issue> 13816 </description> 13817 <origin>new</origin> 13818 <capabilities> 13819 </capabilities> 13820 <parameters> 13821 <param id="flag"> 13822 <enum>jvmtiVerboseFlag</enum> 13823 <description> 13824 Which verbose output is being sent. 13825 </description> 13826 </param> 13827 <param id="message"> 13828 <vmbuf><char/></vmbuf> 13829 <description> 13830 Message text, encoded as a 13831 <internallink id="mUTF">modified UTF-8</internallink> string. 13832 </description> 13833 </param> 13834 </parameters> 13835 </event> 13836 </elide> 13837 13838 </eventsection> 13839 13840 <datasection> 13841 <intro> 13842 <jvmti/> extends the data types defined by JNI. 13843 </intro> 13844 <basetypes id="jniTypes" label="JNI Types Used in the JVM Tool Interface"> 13845 <basetype id="jboolean"> 13846 <description> 13847 Holds a Java programming language <code>boolean</code>. 13848 Unsigned 8 bits. 13849 </description> 13850 </basetype> 13851 <basetype id="jchar"> 13852 <description> 13853 Holds a Java programming language <code>char</code>. 13854 Unsigned 16 bits. 13855 </description> 13856 </basetype> 13857 <basetype id="jint"> 13858 <description> 13859 Holds a Java programming language <code>int</code>. 13860 Signed 32 bits. 13861 </description> 13862 </basetype> 13863 <basetype id="jlong"> 13864 <description> 13865 Holds a Java programming language <code>long</code>. 13866 Signed 64 bits. 13867 </description> 13868 </basetype> 13869 <basetype id="jfloat"> 13870 <description> 13871 Holds a Java programming language <code>float</code>. 13872 32 bits. 13873 </description> 13874 </basetype> 13875 <basetype id="jdouble"> 13876 <description> 13877 Holds a Java programming language <code>double</code>. 13878 64 bits. 13879 </description> 13880 </basetype> 13881 <basetype id="jobject"> 13882 <description> 13883 Holds a Java programming language object. 13884 </description> 13885 </basetype> 13886 <basetype id="jclass"> 13887 <description> 13888 Holds a Java programming language class. 13889 </description> 13890 </basetype> 13891 <basetype id="jvalue"> 13892 <description> 13893 Is a union of all primitive types and <code>jobject</code>. Thus, holds any Java 13894 programming language value. 13895 </description> 13896 </basetype> 13897 <basetype id="jfieldID"> 13898 <description> 13899 Identifies a Java programming language field. 13900 <code>jfieldID</code>s returned by <jvmti/> functions and events may be 13901 safely stored. 13902 </description> 13903 </basetype> 13904 <basetype id="jmethodID"> 13905 <description> 13906 Identifies a Java programming language method, initializer, or constructor. 13907 <code>jmethodID</code>s returned by <jvmti/> functions and events may be 13908 safely stored. However, if the class is unloaded, they become invalid 13909 and must not be used. 13910 </description> 13911 </basetype> 13912 <basetype id="JNIEnv"> 13913 <description> 13914 Pointer to the JNI function table. Pointer to this (<code>JNIEnv *</code>) 13915 is a JNI environment. 13916 </description> 13917 </basetype> 13918 </basetypes> 13919 13920 <basetypes id="jvmtiTypes" label="JVM Tool Interface Base Types"> 13921 <basetype id="jvmtiEnv"> 13922 <description> 13923 The <jvmti/> <internallink id="environments">environment</internallink> pointer. 13924 See the <internallink id="FunctionSection">Function Section</internallink>. 13925 <code>jvmtiEnv</code> points to the 13926 <internallink id="FunctionTable">function table</internallink> pointer. 13927 </description> 13928 </basetype> 13929 <basetype id="jthread"> 13930 <definition>typedef jobject jthread;</definition> 13931 <description> 13932 Subtype of <datalink id="jobject"></datalink> that holds a thread. 13933 </description> 13934 </basetype> 13935 <basetype id="jthreadGroup"> 13936 <definition>typedef jobject jthreadGroup;</definition> 13937 <description> 13938 Subtype of <datalink id="jobject"></datalink> that holds a thread group. 13939 </description> 13940 </basetype> 13941 <basetype id="jlocation"> 13942 <definition>typedef jlong jlocation;</definition> 13943 <description> 13944 A 64 bit value, representing a monotonically increasing 13945 executable position within a method. 13946 <code>-1</code> indicates a native method. 13947 See <functionlink id="GetJLocationFormat"></functionlink> for the format on a 13948 given VM. 13949 </description> 13950 </basetype> 13951 <basetype id="jrawMonitorID"> 13952 <definition>struct _jrawMonitorID; 13953 typedef struct _jrawMonitorID *jrawMonitorID;</definition> 13954 <description> 13955 A raw monitor. 13956 </description> 13957 </basetype> 13958 <basetype id="jvmtiError"> 13959 <description> 13960 Holds an error return code. 13961 See the <internallink id="ErrorSection">Error section</internallink> for possible values. 13962 <example> 13963 typedef enum { 13964 JVMTI_ERROR_NONE = 0, 13965 JVMTI_ERROR_INVALID_THREAD = 10, 13966 ... 13967 } jvmtiError; 13968 </example> 13969 </description> 13970 </basetype> 13971 <basetype id="jvmtiEvent"> 13972 <description> 13973 An identifier for an event type. 13974 See the <internallink id="EventSection">Event section</internallink> for possible values. 13975 It is guaranteed that future versions of this specification will 13976 never assign zero as an event type identifier. 13977 <example> 13978 typedef enum { 13979 JVMTI_EVENT_SINGLE_STEP = 1, 13980 JVMTI_EVENT_BREAKPOINT = 2, 13981 ... 13982 } jvmtiEvent; 13983 </example> 13984 </description> 13985 </basetype> 13986 <basetype id="jvmtiEventCallbacks" name="eventCallbacks"> 13987 <description> 13988 The callbacks used for events. 13989 <example> 13990 typedef struct { 13991 jvmtiEventVMInit VMInit; 13992 jvmtiEventVMDeath VMDeath; 13993 ... 13994 } jvmtiEventCallbacks; 13995 </example> 13996 See <internallink id="jvmtiEventCallbacks">event callbacks</internallink> 13997 for the complete structure. 13998 <p/> 13999 Where, for example, the VM initialization callback is defined: 14000 <example> 14001 typedef void (JNICALL *jvmtiEventVMInit) 14002 (jvmtiEnv *jvmti_env, 14003 JNIEnv* jni_env, 14004 jthread thread); 14005 </example> 14006 See the individual events for the callback function definition. 14007 </description> 14008 </basetype> 14009 <basetype id="jniNativeInterface"> 14010 <definition>typedef struct JNINativeInterface_ jniNativeInterface;</definition> 14011 <description> 14012 Typedef for the JNI function table <code>JNINativeInterface</code> 14013 defined in the 14014 <externallink id="jni/functions.html#interface-function-table"> 14015 JNI Specification</externallink>. 14016 The JNI reference implementation defines this with an underscore. 14017 </description> 14018 </basetype> 14019 </basetypes> 14020 14021 </datasection> 14022 14023 <issuessection label="Issues"> 14024 <intro id="suspendRequired" label="Resolved Issue: Suspend - Required or Automatic"> 14025 JVMDI requires that the agent suspend threads before calling 14026 certain sensitive functions. JVMPI requires garbage collection to be 14027 disabled before calling certain sensitive functions. 14028 It was suggested that rather than have this requirement, that 14029 VM place itself in a suitable state before performing an 14030 operation. This makes considerable sense since each VM 14031 knows its requirements and can most easily arrange a 14032 safe state. 14033 <p/> 14034 The ability to externally suspend/resume threads will, of 14035 course, remain. The ability to enable/disable garbage collection will not. 14036 <p/> 14037 This issue is resolved--suspend will not 14038 be required. The spec has been updated to reflect this. 14039 </intro> 14040 14041 <intro id="stackSampling" label="Resolved Issue: Call Stack Sampling"> 14042 There are a variety of approaches to sampling call stacks. 14043 The biggest bifurcation is between VM controlled and agent 14044 controlled. 14045 <p/> 14046 This issue is resolved--agent controlled 14047 sampling will be the approach. 14048 </intro> 14049 14050 <intro id="threadRepresentation" label="Resolved Issue: Thread Representation"> 14051 JVMDI represents threads as jthread. JVMPI primarily 14052 uses JNIEnv* to represent threads. 14053 <p/> 14054 The Expert Group has chosen jthread as the representation 14055 for threads in <jvmti/>. 14056 JNIEnv* is sent by 14057 events since it is needed to JNI functions. JNIEnv, per the 14058 JNI spec, are not supposed to be used outside their thread. 14059 </intro> 14060 14061 <intro id="design" label="Resolved Issue: Method Representation"> 14062 The JNI spec allows an implementation to depend on jclass/jmethodID 14063 pairs, rather than simply a jmethodID, to reference a method. 14064 JVMDI, for consistency, choose the same representation. 14065 JVMPI, however, specifies that a jmethodID alone maps to a 14066 method. Both of the Sun <tm>J2SE</tm> virtual machines (Classic and <tm>HotSpot</tm>) store 14067 pointers in jmethodIDs, and as a result, a jmethodID is sufficient. 14068 In fact, any JVM implementation that supports JVMPI must have 14069 such a representation. 14070 <jvmti/> will use jmethodID as a unique representation of a method 14071 (no jclass is used). 14072 There should be efficiency gains, particularly in 14073 functionality like stack dumping, to this representation. 14074 <p/> 14075 Note that fields were not used in JVMPI and that the access profile 14076 of fields differs from methods--for implementation efficiency 14077 reasons, a jclass/jfieldID pair will still be needed for field 14078 reference. 14079 </intro> 14080 14081 <intro id="localReferenceIssue" label="Resolved Issue: Local References"> 14082 Functions return local references. 14083 </intro> 14084 14085 <intro id="frameRep" label="Resolved Issue: Representation of frames"> 14086 In JVMDI, a frame ID is used to represent a frame. Problem with this 14087 is that a VM must track when a frame becomes invalid, a far better 14088 approach, and the one used in <jvmti/>, is to reference frames by depth. 14089 </intro> 14090 14091 <intro id="requiredCapabilities" label="Issue: Required Capabilities"> 14092 Currently, having a required capabilities means that the functionality 14093 is optional. Capabilities are useful even for required functionality 14094 since they can inform the VM is needed set-up. Thus, there should be 14095 a set of capabilities that a conformant implementation must provide 14096 (if requested during Agent_OnLoad). 14097 </intro> 14098 14099 <intro id="taghint" label="Proposal: add tag hint function"> 14100 A hint of the percentage of objects that will be tagged would 14101 help the VM pick a good implementation. 14102 </intro> 14103 14104 <intro id="moreMonitorQueries" label="Request: More Monitor Quires"> 14105 How difficult or easy would be to extend the monitor_info category to include 14106 <pre> 14107 - current number of monitors 14108 - enumeration of monitors 14109 - enumeration of threads waiting on a given monitor 14110 </pre> 14111 The reason for my question is the fact that current get_monitor_info support 14112 requires the agent to specify a given thread to get the info which is probably 14113 OK in the profiling/debugging space, while in the monitoring space the agent 14114 could be watching the monitor list and then decide which thread to ask for 14115 the info. You might ask why is this important for monitoring .... I think it 14116 can aid in the detection/prediction of application contention caused by hot-locks. 14117 </intro> 14118 </issuessection> 14119 14120 <changehistory id="ChangeHistory" update="09/05/07"> 14121 <intro> 14122 The <jvmti/> specification is an evolving document with major, minor, 14123 and micro version numbers. 14124 A released version of the specification is uniquely identified 14125 by its major and minor version. 14126 The functions, events, and capabilities in this specification 14127 indicate a "Since" value which is the major and minor version in 14128 which it was introduced. 14129 The version of the specification implemented by the VM can 14130 be retrieved at runtime with the <functionlink id="GetVersionNumber"/> 14131 function. 14132 </intro> 14133 <change date="14 Nov 2002"> 14134 Converted to XML document. 14135 </change> 14136 <change date="14 Nov 2002"> 14137 Elided heap dump functions (for now) since what was there 14138 was wrong. 14139 </change> 14140 <change date="18 Nov 2002"> 14141 Added detail throughout. 14142 </change> 14143 <change date="18 Nov 2002"> 14144 Changed JVMTI_THREAD_STATUS_RUNNING to JVMTI_THREAD_STATUS_RUNNABLE. 14145 </change> 14146 <change date="19 Nov 2002"> 14147 Added AsyncGetStackTrace. 14148 </change> 14149 <change date="19 Nov 2002"> 14150 Added jframeID return to GetStackTrace. 14151 </change> 14152 <change date="19 Nov 2002"> 14153 Elided GetCurrentFrame and GetCallingFrame functions (for now) since what was there 14154 since they are redundant with GetStackTrace. 14155 </change> 14156 <change date="19 Nov 2002"> 14157 Elided ClearAllBreakpoints since it has always been redundant. 14158 </change> 14159 <change date="19 Nov 2002"> 14160 Added GetSystemProperties. 14161 </change> 14162 <change date="19 Nov 2002"> 14163 Changed the thread local storage functions to use jthread. 14164 </change> 14165 <change date="20 Nov 2002"> 14166 Added GetJLocationFormat. 14167 </change> 14168 <change date="22 Nov 2002"> 14169 Added events and introductory text. 14170 </change> 14171 <change date="22 Nov 2002"> 14172 Cross reference type and constant definitions. 14173 </change> 14174 <change date="24 Nov 2002"> 14175 Added DTD. 14176 </change> 14177 <change date="24 Nov 2002"> 14178 Added capabilities function section. 14179 </change> 14180 <change date="29 Nov 2002"> 14181 Assign capabilities to each function and event. 14182 </change> 14183 <change date="29 Nov 2002"> 14184 Add <internallink id="jniIntercept">JNI interception functions</internallink>. 14185 </change> 14186 <change date="30 Nov 2002"> 14187 Auto generate SetEventNotificationMode capabilities. 14188 </change> 14189 <change date="30 Nov 2002"> 14190 Add <eventlink id="VMObjectAlloc"></eventlink> event. 14191 </change> 14192 <change date="30 Nov 2002"> 14193 Add <eventlink id="DynamicCodeGenerated"></eventlink> event. 14194 </change> 14195 <change date="30 Nov 2002"> 14196 Add const to declarations. 14197 </change> 14198 <change date="30 Nov 2002"> 14199 Change method exit and frame pop to send on exception. 14200 </change> 14201 <change date="1 Dec 2002"> 14202 Add ForceGarbageCollection. 14203 </change> 14204 <change date="2 Dec 2002"> 14205 Redo Xrun section; clarify GetStackTrace and add example; 14206 Fix width problems; use "agent" consistently. 14207 </change> 14208 <change date="8 Dec 2002"> 14209 Remove previous start-up intro. 14210 Add <internallink id="environments"><jvmti/> Environments</internallink> 14211 section. 14212 </change> 14213 <change date="8 Dec 2002"> 14214 Add <functionlink id="DisposeEnvironment"></functionlink>. 14215 </change> 14216 <change date="9 Dec 2002"> 14217 Numerous minor updates. 14218 </change> 14219 <change date="15 Dec 2002"> 14220 Add heap profiling functions added: 14221 get/set annotation, iterate live objects/heap. 14222 Add heap profiling functions place holder added: 14223 heap roots. 14224 Heap profiling event added: object free. 14225 Heap profiling event redesigned: vm object allocation. 14226 Heap profiling event placeholders added: garbage collection start/finish. 14227 Native method bind event added. 14228 </change> 14229 <change date="19 Dec 2002"> 14230 Revamp suspend/resume functions. 14231 Add origin information with jvmdi tag. 14232 Misc fixes. 14233 </change> 14234 <change date="24 Dec 2002"> 14235 Add semantics to types. 14236 </change> 14237 <change date="27 Dec 2002"> 14238 Add local reference section. 14239 Autogenerate parameter descriptions from types. 14240 </change> 14241 <change date="28 Dec 2002"> 14242 Document that RunAgentThread sends threadStart. 14243 </change> 14244 <change date="29 Dec 2002"> 14245 Remove redundant local ref and dealloc warning. 14246 Convert GetRawMonitorName to allocated buffer. 14247 Add GenerateEvents. 14248 </change> 14249 <change date="30 Dec 2002"> 14250 Make raw monitors a type and rename to "jrawMonitorID". 14251 </change> 14252 <change date="1 Jan 2003"> 14253 Include origin information. 14254 Clean-up JVMDI issue references. 14255 Remove Deallocate warnings which are now automatically generated. 14256 </change> 14257 <change date="2 Jan 2003"> 14258 Fix representation issues for jthread. 14259 </change> 14260 <change date="3 Jan 2003"> 14261 Make capabilities buffered out to 64 bits - and do it automatically. 14262 </change> 14263 <change date="4 Jan 2003"> 14264 Make constants which are enumeration into enum types. 14265 Parameters now of enum type. 14266 Clean-up and index type section. 14267 Replace remaining datadef entities with callback. 14268 </change> 14269 <change date="7 Jan 2003"> 14270 Correct GenerateEvents description. 14271 More internal semantics work. 14272 </change> 14273 <change date="9 Jan 2003"> 14274 Replace previous GetSystemProperties with two functions 14275 which use allocated information instead fixed. 14276 Add SetSystemProperty. 14277 More internal semantics work. 14278 </change> 14279 <change date="12 Jan 2003"> 14280 Add varargs to end of SetEventNotificationMode. 14281 </change> 14282 <change date="20 Jan 2003"> 14283 Finish fixing spec to reflect that alloc sizes are jlong. 14284 </change> 14285 <change date="22 Jan 2003"> 14286 Allow NULL as RunAgentThread arg. 14287 </change> 14288 <change date="22 Jan 2003"> 14289 Fixed names to standardized naming convention 14290 Removed AsyncGetStackTrace. 14291 </change> 14292 <change date="29 Jan 2003"> 14293 Since we are using jthread, removed GetThread. 14294 </change> 14295 <change date="31 Jan 2003"> 14296 Change GetFieldName to allow NULLs like GetMethodName. 14297 </change> 14298 <change date="29 Feb 2003" version="v40"> 14299 Rewrite the introductory text, adding sections on 14300 start-up, environments and bytecode instrumentation. 14301 Change the command line arguments per EG discussions. 14302 Add an introduction to the capabilities section. 14303 Add the extension mechanism category and functions. 14304 Mark for deletion, but clarified anyhow, SuspendAllThreads. 14305 Rename IterateOverLiveObjects to IterateOverReachableObjects and 14306 change the text accordingly. 14307 Clarify IterateOverHeap. 14308 Clarify CompiledMethodLoad. 14309 Discuss prerequisite state for Calling Functions. 14310 Clarify SetAllocationHooks. 14311 Added issues ("To be resolved:") through-out. 14312 And so on... 14313 </change> 14314 <change date="6 Mar 2003" version="v41"> 14315 Remove struct from the call to GetOwnedMonitorInfo. 14316 Automatically generate most error documentation, remove 14317 (rather broken) hand written error doc. 14318 Better describe capability use (empty initial set). 14319 Add min value to jint params. 14320 Remove the capability can_access_thread_local_storage. 14321 Rename error JVMTI_ERROR_NOT_IMPLEMENTED to JVMTI_ERROR_MUST_POSSESS_CAPABILITY; 14322 same for *NOT_IMPLEMENTED. 14323 Description fixes. 14324 </change> 14325 <change date="8 Mar 2003" version="v42"> 14326 Rename GetClassSignature to GetClassName. 14327 Rename IterateOverClassObjects to IterateOverInstancesOfClass. 14328 Remove GetMaxStack (operand stack isn't used in <jvmti/>). 14329 Description fixes: define launch-time, remove native frame pop 14330 from PopFrame, and assorted clarifications. 14331 </change> 14332 <change date="8 Mar 2003" version="v43"> 14333 Fix minor editing problem. 14334 </change> 14335 <change date="10 Mar 2003" version="v44"> 14336 Add phase information. 14337 Remap (compact) event numbers. 14338 </change> 14339 <change date="11 Mar 2003" version="v45"> 14340 More phase information - allow "any". 14341 Elide raw monitor queries and events. 14342 Minor description fixes. 14343 </change> 14344 <change date="12 Mar 2003" version="v46"> 14345 Add GetPhase. 14346 Use "phase" through document. 14347 Elide GetRawMonitorName. 14348 Elide GetObjectMonitors. 14349 </change> 14350 <change date="12 Mar 2003" version="v47"> 14351 Fixes from link, XML, and spell checking. 14352 Auto-generate the callback structure. 14353 </change> 14354 <change date="13 Mar 2003" version="v48"> 14355 One character XML fix. 14356 </change> 14357 <change date="13 Mar 2003" version="v49"> 14358 Change function parameter names to be consistent with 14359 event parameters (fooBarBaz becomes foo_bar_baz). 14360 </change> 14361 <change date="14 Mar 2003" version="v50"> 14362 Fix broken link. Fix thread markers. 14363 </change> 14364 <change date="14 Mar 2003" version="v51"> 14365 Change constants so they are under 128 to workaround 14366 compiler problems. 14367 </change> 14368 <change date="23 Mar 2003" version="v52"> 14369 Overhaul capabilities. Separate GetStackTrace into 14370 GetStackTrace and GetStackFrames. 14371 </change> 14372 <change date="8 Apr 2003" version="v54"> 14373 Use depth instead of jframeID to reference frames. 14374 Remove the now irrelevant GetCurrentFrame, GetCallerFrame and GetStackFrames. 14375 Remove frame arg from events. 14376 </change> 14377 <change date="9 Apr 2003" version="v55"> 14378 Remove GetObjectWithAnnotation since tests show bufferred approach more efficient. 14379 Add missing annotation_count to GetObjectsWithAnnotations 14380 </change> 14381 <change date="10 Apr 2003" version="v56"> 14382 Remove confusing parenthetical statement in GetObjectsWithAnnotations 14383 </change> 14384 <change date="13 Apr 2003" version="v58"> 14385 Replace jclass/jmethodID representation of method with simply jmethodID; 14386 Pass JvmtiEnv* as first arg of every event; remove JNIEnv* where inappropriate. 14387 Replace can_access_frames with can_access_local_variables; remove from purely stack access. 14388 Use can_get_synthetic_attribute; fix description. 14389 Clarify that zero length arrays must be deallocated. 14390 Clarify RelinquishCapabilities. 14391 Generalize JVMTI_ERROR_VM_DEAD to JVMTI_ERROR_WRONG_PHASE. 14392 </change> 14393 <change date="27 Apr 2003" version="v59"> 14394 Remove lingering indirect references to OBSOLETE_METHOD_ID. 14395 </change> 14396 <change date="4 May 2003" version="v60"> 14397 Allow DestroyRawMonitor during OnLoad. 14398 </change> 14399 <change date="7 May 2003" version="v61"> 14400 Added not monitor owner error return to DestroyRawMonitor. 14401 </change> 14402 <change date="13 May 2003" version="v62"> 14403 Clarify semantics of raw monitors. 14404 Change flags on <code>GetThreadStatus</code>. 14405 <code>GetClassLoader</code> return NULL for the bootstrap class loader. 14406 Add <code>GetClassName</code> issue. 14407 Define local variable signature. 14408 Disallow zero in annotations array of <code>GetObjectsWithAnnotations</code>. 14409 Remove over specification in <code>GetObjectsWithAnnotations</code>. 14410 Elide <code>SetAllocationHooks</code>. 14411 Elide <code>SuspendAllThreads</code>. 14412 </change> 14413 <change date="14 May 2003" version="v63"> 14414 Define the data type <code>jvmtiEventCallbacks</code>. 14415 Zero length allocations return NULL. 14416 Keep SetAllocationHooks in JVMDI, but remove from <jvmti/>. 14417 Add JVMTI_THREAD_STATUS_FLAG_INTERRUPTED. 14418 </change> 14419 <change date="15 May 2003" version="v64"> 14420 Better wording, per review. 14421 </change> 14422 <change date="15 May 2003" version="v65"> 14423 First Alpha. 14424 Make jmethodID and jfieldID unique, jclass not used. 14425 </change> 14426 <change date="27 May 2003" version="v66"> 14427 Fix minor XSLT errors. 14428 </change> 14429 <change date="13 June 2003" version="v67"> 14430 Undo making jfieldID unique (jmethodID still is). 14431 </change> 14432 <change date="17 June 2003" version="v68"> 14433 Changes per June 11th Expert Group meeting -- 14434 Overhaul Heap functionality: single callback, 14435 remove GetHeapRoots, add reachable iterators, 14436 and rename "annotation" to "tag". 14437 NULL thread parameter on most functions is current 14438 thread. 14439 Add timers. 14440 Remove ForceExit. 14441 Add GetEnvironmentLocalStorage. 14442 Add verbose flag and event. 14443 Add AddToBootstrapClassLoaderSearch. 14444 Update ClassFileLoadHook. 14445 </change> 14446 <change date="18 June 2003" version="v69"> 14447 Clean up issues sections. 14448 Rename GetClassName back to GetClassSignature and 14449 fix description. 14450 Add generic signature to GetClassSignature, 14451 GetFieldSignature, GetMethodSignature, and 14452 GetLocalVariableTable. 14453 Elide EstimateCostOfCapabilities. 14454 Clarify that the system property functions operate 14455 on the VM view of system properties. 14456 Clarify Agent_OnLoad. 14457 Remove "const" from JNIEnv* in events. 14458 Add metadata accessors. 14459 </change> 14460 <change date="18 June 2003" version="v70"> 14461 Add start_depth to GetStackTrace. 14462 Move system properties to a new category. 14463 Add GetObjectSize. 14464 Remove "X" from command line flags. 14465 XML, HTML, and spell check corrections. 14466 </change> 14467 <change date="19 June 2003" version="v71"> 14468 Fix JVMTI_HEAP_ROOT_THREAD to be 6. 14469 Make each synopsis match the function name. 14470 Fix unclear wording. 14471 </change> 14472 <change date="26 June 2003" version="v72"> 14473 SetThreadLocalStorage and SetEnvironmentLocalStorage should allow value 14474 to be set to NULL. 14475 NotifyFramePop, GetFrameLocationm and all the local variable operations 14476 needed to have their wording about frames fixed. 14477 Grammar and clarity need to be fixed throughout. 14478 Capitalization and puntuation need to be consistent. 14479 Need micro version number and masks for accessing major, minor, and micro. 14480 The error code lists should indicate which must be returned by 14481 an implementation. 14482 The command line properties should be visible in the properties functions. 14483 Disallow popping from the current thread. 14484 Allow implementations to return opaque frame error when they cannot pop. 14485 The NativeMethodBind event should be sent during any phase. 14486 The DynamicCodeGenerated event should be sent during any phase. 14487 The following functions should be allowed to operate before VMInit: 14488 Set/GetEnvironmentLocalStorage 14489 GetMethodDeclaringClass 14490 GetClassSignature 14491 GetClassModifiers 14492 IsInterface 14493 IsArrayClass 14494 GetMethodName 14495 GetMethodModifiers 14496 GetMaxLocals 14497 GetArgumentsSize 14498 GetLineNumberTable 14499 GetMethodLocation 14500 IsMethodNative 14501 IsMethodSynthetic. 14502 Other changes (to XSL): 14503 Argument description should show asterisk after not before pointers. 14504 NotifyFramePop, GetFrameLocationm and all the local variable operations 14505 should hsve the NO_MORE_FRAMES error added. 14506 Not alive threads should have a different error return than invalid thread. 14507 </change> 14508 <change date="7 July 2003" version="v73"> 14509 VerboseOutput event was missing message parameter. 14510 Minor fix-ups. 14511 </change> 14512 <change date="14 July 2003" version="v74"> 14513 Technical Publications Department corrections. 14514 Allow thread and environment local storage to be set to NULL. 14515 </change> 14516 <change date="23 July 2003" version="v75"> 14517 Use new Agent_OnLoad rather than overloaded JVM_OnLoad. 14518 Add JNICALL to callbacks (XSL). 14519 Document JNICALL requirement for both events and callbacks (XSL). 14520 Restrict RedefineClasses to methods and attributes. 14521 Elide the VerboseOutput event. 14522 VMObjectAlloc: restrict when event is sent and remove method parameter. 14523 Finish loose ends from Tech Pubs edit. 14524 </change> 14525 <change date="24 July 2003" version="v76"> 14526 Change ClassFileLoadHook event to send the class instead of a boolean of redefine. 14527 </change> 14528 <change date="24 July 2003" version="v77"> 14529 XML fixes. 14530 Minor text clarifications and corrections. 14531 </change> 14532 <change date="24 July 2003" version="v78"> 14533 Remove GetExceptionHandlerTable and GetThrownExceptions from <jvmti/>. 14534 Clarify that stack frames are JVM Spec frames. 14535 Split can_get_source_info into can_get_source_file_name, can_get_line_numbers, 14536 and can_get_source_debug_extension. 14537 PopFrame cannot have a native calling method. 14538 Removed incorrect statement in GetClassloaderClasses 14539 (see <vmspec chapter="4.4"/>). 14540 </change> 14541 <change date="24 July 2003" version="v79"> 14542 XML and text fixes. 14543 Move stack frame description into Stack Frame category. 14544 </change> 14545 <change date="26 July 2003" version="v80"> 14546 Allow NULL (means bootstrap loader) for GetClassloaderClasses. 14547 Add new heap reference kinds for references from classes. 14548 Add timer information struct and query functions. 14549 Add AvailableProcessors. 14550 Rename GetOtherThreadCpuTime to GetThreadCpuTime. 14551 Explicitly add JVMTI_ERROR_INVALID_THREAD and JVMTI_ERROR_THREAD_NOT_ALIVE 14552 to SetEventNotification mode. 14553 Add initial thread to the VM_INIT event. 14554 Remove platform assumptions from AddToBootstrapClassLoaderSearch. 14555 </change> 14556 <change date="26 July 2003" version="v81"> 14557 Grammar and clarity changes per review. 14558 </change> 14559 <change date="27 July 2003" version="v82"> 14560 More grammar and clarity changes per review. 14561 Add Agent_OnUnload. 14562 </change> 14563 <change date="28 July 2003" version="v83"> 14564 Change return type of Agent_OnUnload to void. 14565 </change> 14566 <change date="28 July 2003" version="v84"> 14567 Rename JVMTI_REFERENCE_ARRAY to JVMTI_REFERENCE_ARRAY_ELEMENT. 14568 </change> 14569 <change date="28 July 2003" version="v85"> 14570 Steal java.lang.Runtime.availableProcessors() wording for 14571 AvailableProcessors(). 14572 Guarantee that zero will never be an event ID. 14573 Remove some issues which are no longer issues. 14574 Per review, rename and more completely document the timer 14575 information functions. 14576 </change> 14577 <change date="29 July 2003" version="v86"> 14578 Non-spec visible change to XML controlled implementation: 14579 SetThreadLocalStorage must run in VM mode. 14580 </change> 14581 <change date="5 August 2003" version="0.1.87"> 14582 Add GetErrorName. 14583 Add varargs warning to jvmtiExtensionEvent. 14584 Remove "const" on the jvmtiEnv* of jvmtiExtensionEvent. 14585 Remove unused can_get_exception_info capability. 14586 Pass jvmtiEnv* and JNIEnv* to the jvmtiStartFunction. 14587 Fix jvmtiExtensionFunctionInfo.func declared type. 14588 Extension function returns error code. 14589 Use new version numbering. 14590 </change> 14591 <change date="5 August 2003" version="0.2.88"> 14592 Remove the ClassUnload event. 14593 </change> 14594 <change date="8 August 2003" version="0.2.89"> 14595 Heap reference iterator callbacks return an enum that 14596 allows outgoing object references to be ignored. 14597 Allow JNIEnv as a param type to extension events/functions. 14598 </change> 14599 <change date="15 August 2003" version="0.2.90"> 14600 Fix a typo. 14601 </change> 14602 <change date="2 September 2003" version="0.2.91"> 14603 Remove all metadata functions: GetClassMetadata, 14604 GetFieldMetadata, and GetMethodMetadata. 14605 </change> 14606 <change date="1 October 2003" version="0.2.92"> 14607 Mark the functions Allocate. Deallocate, RawMonitor*, 14608 SetEnvironmentLocalStorage, and GetEnvironmentLocalStorage 14609 as safe for use in heap callbacks and GC events. 14610 </change> 14611 <change date="24 November 2003" version="0.2.93"> 14612 Add pass through opaque user data pointer to heap iterate 14613 functions and callbacks. 14614 In the CompiledMethodUnload event, send the code address. 14615 Add GarbageCollectionOccurred event. 14616 Add constant pool reference kind. 14617 Mark the functions CreateRawMonitor and DestroyRawMonitor 14618 as safe for use in heap callbacks and GC events. 14619 Clarify: VMDeath, GetCurrentThreadCpuTimerInfo, 14620 GetThreadCpuTimerInfo, IterateOverReachableObjects, 14621 IterateOverObjectsReachableFromObject, GetTime and 14622 JVMTI_ERROR_NULL_POINTER. 14623 Add missing errors to: GenerateEvents and 14624 AddToBootstrapClassLoaderSearch. 14625 Fix description of ClassFileLoadHook name parameter. 14626 In heap callbacks and GC/ObjectFree events, specify 14627 that only explicitly allowed functions can be called. 14628 Allow GetCurrentThreadCpuTimerInfo, GetCurrentThreadCpuTime, 14629 GetTimerInfo, and GetTime during callback. 14630 Allow calling SetTag/GetTag during the onload phase. 14631 SetEventNotificationMode, add: error attempted inappropriate 14632 thread level control. 14633 Remove jvmtiExceptionHandlerEntry. 14634 Fix handling of native methods on the stack -- 14635 location_ptr param of GetFrameLocation, remove 14636 JVMTI_ERROR_OPAQUE_FRAME from GetFrameLocation, 14637 jvmtiFrameInfo.location, and jlocation. 14638 Remove typo (from JVMPI) implying that the MonitorWaited 14639 event is sent on sleep. 14640 </change> 14641 <change date="25 November 2003" version="0.2.94"> 14642 Clarifications and typos. 14643 </change> 14644 <change date="3 December 2003" version="0.2.95"> 14645 Allow NULL user_data in heap iterators. 14646 </change> 14647 <change date="28 January 2004" version="0.2.97"> 14648 Add GetThreadState, deprecate GetThreadStatus. 14649 </change> 14650 <change date="29 January 2004" version="0.2.98"> 14651 INVALID_SLOT and TYPE_MISMATCH errors should be optional. 14652 </change> 14653 <change date="12 February 2004" version="0.2.102"> 14654 Remove MonitorContendedExit. 14655 Added JNIEnv parameter to VMObjectAlloc. 14656 Clarified definition of class_tag and referrer_index 14657 parameters to heap callbacks. 14658 </change> 14659 <change date="16 Febuary 2004" version="0.2.103"> 14660 Document JAVA_TOOL_OPTIONS. 14661 </change> 14662 <change date="17 Febuary 2004" version="0.2.105"> 14663 Divide start phase into primordial and start. 14664 Add VMStart event 14665 Change phase associations of functions and events. 14666 </change> 14667 <change date="18 Febuary 2004" version="0.3.6"> 14668 Elide deprecated GetThreadStatus. 14669 Bump minor version, subtract 100 from micro version 14670 </change> 14671 <change date="18 Febuary 2004" version="0.3.7"> 14672 Document that timer nanosecond values are unsigned. 14673 Clarify text having to do with native methods. 14674 </change> 14675 <change date="19 Febuary 2004" version="0.3.8"> 14676 Fix typos. 14677 Remove elided deprecated GetThreadStatus. 14678 </change> 14679 <change date="23 Febuary 2004" version="0.3.9"> 14680 Require NotifyFramePop to act on suspended threads. 14681 </change> 14682 <change date="24 Febuary 2004" version="0.3.10"> 14683 Add capabilities 14684 (<internallink id="jvmtiCapabilities.can_redefine_any_class" 14685 ><code>can_redefine_any_class</code></internallink> 14686 and 14687 <internallink id="jvmtiCapabilities.can_generate_all_class_hook_events" 14688 ><code>can_generate_all_class_hook_events</code></internallink>) 14689 and an error (<errorlink id="JVMTI_ERROR_UNMODIFIABLE_CLASS"></errorlink>) 14690 which allow some classes to be unmodifiable. 14691 </change> 14692 <change date="28 Febuary 2004" version="0.3.11"> 14693 Add JVMTI_ERROR_MUST_POSSESS_CAPABILITY to SetEventNotificationMode. 14694 </change> 14695 <change date="8 March 2004" version="0.3.12"> 14696 Clarified CompiledMethodUnload so that it is clear the event 14697 may be posted after the class has been unloaded. 14698 </change> 14699 <change date="5 March 2004" version="0.3.13"> 14700 Change the size parameter of VMObjectAlloc to jlong to match GetObjectSize. 14701 </change> 14702 <change date="13 March 2004" version="0.3.14"> 14703 Added guideline for the use of the JNI FindClass function in event 14704 callback functions. 14705 </change> 14706 <change date="15 March 2004" version="0.3.15"> 14707 Add GetAllStackTraces and GetThreadListStackTraces. 14708 </change> 14709 <change date="19 March 2004" version="0.3.16"> 14710 ClassLoad and ClassPrepare events can be posted during start phase. 14711 </change> 14712 <change date="25 March 2004" version="0.3.17"> 14713 Add JVMTI_ERROR_NATIVE_METHOD to GetLineNumberTable, GetLocalVariableTable, 14714 GetMaxLocals, GetArgumentsSize, GetMethodLocation, GetBytecodes. 14715 </change> 14716 <change date="29 March 2004" version="0.3.18"> 14717 Return the timer kind in the timer information structure. 14718 </change> 14719 <change date="31 March 2004" version="0.3.19"> 14720 Spec clarifications: 14721 JVMTI_THREAD_STATE_IN_NATIVE might not include JNI or <jvmti/>. 14722 ForceGarbageCollection does not run finalizers. 14723 The context of the specification is the Java platform. 14724 Warn about early instrumentation. 14725 </change> 14726 <change date="1 April 2004" version="0.3.20"> 14727 Refinements to the above clarifications and 14728 Clarify that an error returned by Agent_OnLoad terminates the VM. 14729 </change> 14730 <change date="1 April 2004" version="0.3.21"> 14731 Array class creation does not generate a class load event. 14732 </change> 14733 <change date="7 April 2004" version="0.3.22"> 14734 Align thread state hierarchy more closely with java.lang.Thread.State. 14735 </change> 14736 <change date="12 April 2004" version="0.3.23"> 14737 Clarify the documentation of thread state. 14738 </change> 14739 <change date="19 April 2004" version="0.3.24"> 14740 Remove GarbageCollectionOccurred event -- can be done by agent. 14741 </change> 14742 <change date="22 April 2004" version="0.3.25"> 14743 Define "command-line option". 14744 </change> 14745 <change date="29 April 2004" version="0.3.26"> 14746 Describe the intended use of bytecode instrumentation. 14747 Fix description of extension event first parameter. 14748 </change> 14749 <change date="30 April 2004" version="0.3.27"> 14750 Clarification and typos. 14751 </change> 14752 <change date="18 May 2004" version="0.3.28"> 14753 Remove DataDumpRequest event. 14754 </change> 14755 <change date="18 May 2004" version="0.3.29"> 14756 Clarify RawMonitorWait with zero timeout. 14757 Clarify thread state after RunAgentThread. 14758 </change> 14759 <change date="24 May 2004" version="0.3.30"> 14760 Clean-up: fix bad/old links, etc. 14761 </change> 14762 <change date="30 May 2004" version="0.3.31"> 14763 Clarifications including: 14764 All character strings are modified UTF-8. 14765 Agent thread visibiity. 14766 Meaning of obsolete method version. 14767 Thread invoking heap callbacks, 14768 </change> 14769 <change date="1 June 2004" version="1.0.32"> 14770 Bump major.minor version numbers to "1.0". 14771 </change> 14772 <change date="2 June 2004" version="1.0.33"> 14773 Clarify interaction between ForceGarbageCollection 14774 and ObjectFree. 14775 </change> 14776 <change date="6 June 2004" version="1.0.34"> 14777 Restrict AddToBootstrapClassLoaderSearch and 14778 SetSystemProperty to the OnLoad phase only. 14779 </change> 14780 <change date="11 June 2004" version="1.0.35"> 14781 Fix typo in SetTag. 14782 </change> 14783 <change date="18 June 2004" version="1.0.36"> 14784 Fix trademarks. 14785 Add missing parameter in example GetThreadState usage. 14786 </change> 14787 <change date="4 August 2004" version="1.0.37"> 14788 Copyright updates. 14789 </change> 14790 <change date="5 November 2004" version="1.0.38"> 14791 Add missing function table layout. 14792 Add missing description of C++ member function format of functions. 14793 Clarify that name in CFLH can be NULL. 14794 Released as part of <tm>J2SE</tm> 5.0. 14795 </change> 14796 <change date="24 April 2005" version="1.1.47"> 14797 Bump major.minor version numbers to "1.1". 14798 Add ForceEarlyReturn* functions. 14799 Add GetOwnedMonitorStackDepthInfo function. 14800 Add GetCurrentThread function. 14801 Add "since" version marker. 14802 Add AddToSystemClassLoaderSearch. 14803 Allow AddToBootstrapClassLoaderSearch be used in live phase. 14804 Fix historic rubbish in the descriptions of the heap_object_callback 14805 parameter of IterateOverHeap and IterateOverInstancesOfClass functions; 14806 disallow NULL for this parameter. 14807 Clarify, correct and make consistent: wording about current thread, 14808 opaque frames and insufficient number of frames in PopFrame. 14809 Consistently use "current frame" rather than "topmost". 14810 Clarify the JVMTI_ERROR_TYPE_MISMATCH errors in GetLocal* and SetLocal* 14811 by making them compatible with those in ForceEarlyReturn*. 14812 Many other clarifications and wording clean ups. 14813 </change> 14814 <change date="25 April 2005" version="1.1.48"> 14815 Add GetConstantPool. 14816 Switch references to the first edition of the VM Spec, to the seconds edition. 14817 </change> 14818 <change date="26 April 2005" version="1.1.49"> 14819 Clarify minor/major version order in GetConstantPool. 14820 </change> 14821 <change date="26 April 2005" version="1.1.50"> 14822 Add SetNativeMethodPrefix and SetNativeMethodPrefixes. 14823 Reassign GetOwnedMonitorStackDepthInfo to position 153. 14824 Break out Class Loader Search in its own documentation category. 14825 Deal with overly long lines in XML source. 14826 </change> 14827 <change date="29 April 2005" version="1.1.51"> 14828 Allow agents be started in the live phase. 14829 Added paragraph about deploying agents. 14830 </change> 14831 <change date="30 April 2005" version="1.1.52"> 14832 Add specification description to SetNativeMethodPrefix(es). 14833 Better define the conditions on GetConstantPool. 14834 </change> 14835 <change date="30 April 2005" version="1.1.53"> 14836 Break out the GetClassVersionNumber function from GetConstantPool. 14837 Clean-up the references to the VM Spec. 14838 </change> 14839 <change date="1 May 2005" version="1.1.54"> 14840 Allow SetNativeMethodPrefix(es) in any phase. 14841 Add clarifications about the impact of redefinition on GetConstantPool. 14842 </change> 14843 <change date="2 May 2005" version="1.1.56"> 14844 Various clarifications to SetNativeMethodPrefix(es). 14845 </change> 14846 <change date="2 May 2005" version="1.1.57"> 14847 Add missing performance warning to the method entry event. 14848 </change> 14849 <change date="5 May 2005" version="1.1.58"> 14850 Remove internal JVMDI support. 14851 </change> 14852 <change date="8 May 2005" version="1.1.59"> 14853 Add <functionlink id="RetransformClasses"/>. 14854 Revamp the bytecode instrumentation documentation. 14855 Change <functionlink id="IsMethodObsolete"/> to no longer 14856 require the can_redefine_classes capability. 14857 </change> 14858 <change date="11 May 2005" version="1.1.63"> 14859 Clarifications for retransformation. 14860 </change> 14861 <change date="11 May 2005" version="1.1.64"> 14862 Clarifications for retransformation, per review. 14863 Lock "retransformation (in)capable" at class load enable time. 14864 </change> 14865 <change date="4 June 2005" version="1.1.67"> 14866 Add new heap functionity which supports reporting primitive values, 14867 allows setting the referrer tag, and has more powerful filtering: 14868 FollowReferences, IterateThroughHeap, and their associated 14869 callbacks, structs, enums, and constants. 14870 </change> 14871 <change date="4 June 2005" version="1.1.68"> 14872 Clarification. 14873 </change> 14874 <change date="6 June 2005" version="1.1.69"> 14875 FollowReferences, IterateThroughHeap: Put callbacks in a struct; 14876 Add missing error codes; reduce bits in the visit control flags. 14877 </change> 14878 <change date="14 June 2005" version="1.1.70"> 14879 More on new heap functionity: spec clean-up per review. 14880 </change> 14881 <change date="15 June 2005" version="1.1.71"> 14882 More on new heap functionity: Rename old heap section to Heap (1.0). 14883 </change> 14884 <change date="21 June 2005" version="1.1.72"> 14885 Fix typos. 14886 </change> 14887 <change date="27 June 2005" version="1.1.73"> 14888 Make referrer info structure a union. 14889 </change> 14890 <change date="9 September 2005" version="1.1.74"> 14891 In new heap functions: 14892 Add missing superclass reference kind. 14893 Use a single scheme for computing field indexes. 14894 Remove outdated references to struct based referrer info. 14895 </change> 14896 <change date="12 September 2005" version="1.1.75"> 14897 Don't callback during FollowReferences on frivolous java.lang.Object superclass. 14898 </change> 14899 <change date="13 September 2005" version="1.1.76"> 14900 In string primitive callback, length now Unicode length. 14901 In array and string primitive callbacks, value now "const". 14902 Note possible compiler impacts on setting JNI function table. 14903 </change> 14904 <change date="13 September 2005" version="1.1.77"> 14905 GetClassVersionNumbers() and GetConstantPool() should return 14906 error on array or primitive class. 14907 </change> 14908 <change date="14 September 2005" version="1.1.78"> 14909 Grammar fixes. 14910 </change> 14911 <change date="26 September 2005" version="1.1.79"> 14912 Add IsModifiableClass query. 14913 </change> 14914 <change date="9 February 2006" version="1.1.81"> 14915 Add referrer_class_tag parameter to jvmtiHeapReferenceCallback. 14916 </change> 14917 <change date="13 February 2006" version="1.1.82"> 14918 Doc fixes: update can_redefine_any_class to include retransform. 14919 Clarify that exception events cover all Throwables. 14920 In GetStackTrace, no test is done for start_depth too big if start_depth is zero, 14921 Clarify fields reported in Primitive Field Callback -- static vs instance. 14922 Repair confusing names of heap types, including callback names. 14923 Require consistent usage of stack depth in the face of thread launch methods. 14924 Note incompatibility of <jvmti/> memory management with other systems. 14925 </change> 14926 <change date="14 February 2006" version="1.1.85"> 14927 Fix typos and missing renames. 14928 </change> 14929 <change date="13 March 2006" version="1.1.86"> 14930 Clarify that jmethodIDs and jfieldIDs can be saved. 14931 Clarify that Iterate Over Instances Of Class includes subclasses. 14932 </change> 14933 <change date="14 March 2006" version="1.1.87"> 14934 Better phrasing. 14935 </change> 14936 <change date="16 March 2006" version="1.1.88"> 14937 Match the referrer_index for static fields in Object Reference Callback 14938 with the Reference Implementation (and all other known implementations); 14939 that is, make it match the definition for instance fields. 14940 In GetThreadListStackTraces, add JVMTI_ERROR_INVALID_THREAD to cover 14941 an invalid thread in the list; and specify that not started threads 14942 return empty stacks. 14943 </change> 14944 <change date="17 March 2006" version="1.1.89"> 14945 Typo. 14946 </change> 14947 <change date="25 March 2006" version="1.1.90"> 14948 Typo. 14949 </change> 14950 <change date="6 April 2006" version="1.1.91"> 14951 Remove restrictions on AddToBootstrapClassLoaderSearch and 14952 AddToSystemClassLoaderSearch. 14953 </change> 14954 <change date="1 May 2006" version="1.1.93"> 14955 Changed spec to return -1 for monitor stack depth for the 14956 implementation which can not determine stack depth. 14957 </change> 14958 <change date="3 May 2006" version="1.1.94"> 14959 Corrections for readability and accuracy courtesy of Alan Pratt of IBM. 14960 List the object relationships reported in FollowReferences. 14961 </change> 14962 <change date="5 May 2006" version="1.1.95"> 14963 Clarify the object relationships reported in FollowReferences. 14964 </change> 14965 <change date="28 June 2006" version="1.1.98"> 14966 Clarify DisposeEnvironment; add warning. 14967 Fix typos in SetLocalXXX "retrieve" => "set". 14968 Clarify that native method prefixes must remain set while used. 14969 Clarify that exactly one Agent_OnXXX is called per agent. 14970 Clarify that library loading is independent from start-up. 14971 Remove ambiguous reference to Agent_OnLoad in the Agent_OnUnload spec. 14972 </change> 14973 <change date="31 July 2006" version="1.1.99"> 14974 Clarify the interaction between functions and exceptions. 14975 Clarify and give examples of field indices. 14976 Remove confusing "That is" sentence from MonitorWait and MonitorWaited events. 14977 Update links to point to Java 6. 14978 </change> 14979 <change date="6 August 2006" version="1.1.102"> 14980 Add ResourceExhaustedEvent. 14981 </change> 14982 <change date="11 October 2012" version="1.2.2"> 14983 Fixed the "HTTP" and "Missing Anchor" errors reported by the LinkCheck tool. 14984 </change> 14985 <change date="19 June 2013" version="1.2.3"> 14986 Added support for statically linked agents. 14987 </change> 14988 <change date="13 October 2016" version="9.0.0"> 14989 Support for modules: 14990 - The majorversion is 9 now 14991 - The ClassFileLoadHook events are not sent during the primordial phase anymore. 14992 - Allow CompiledMethodLoad events at start phase 14993 - Add new capabilities: 14994 - can_generate_early_vmstart 14995 - can_generate_early_class_hook_events 14996 - Add new functions: 14997 - GetAllModules 14998 - AddModuleReads, AddModuleExports, AddModuleOpens, AddModuleUses, AddModuleProvides 14999 - IsModifiableModule 15000 Clarified can_redefine_any_classes, can_retransform_any_classes and IsModifiableClass API to 15001 disallow some implementation defined classes. 15002 </change> 15003 <change date="12 February 2017" version="9.0.0"> 15004 Minor update for GetCurrentThread function: 15005 - The function may return NULL in the start phase if the 15006 can_generate_early_vmstart capability is enabled. 15007 </change> 15008 <change date="7 February 2018" version="11.0.0"> 15009 Minor update for new class file NestHost and NestMembers attributes: 15010 - Specify that RedefineClasses and RetransformClasses are not allowed 15011 to change the class file NestHost and NestMembers attributes. 15012 - Add new error JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_ATTRIBUTE_CHANGED 15013 that can be returned by RedefineClasses and RetransformClasses. 15014 </change> 15015 <change date="20 May 2019" version="13.0.0"> 15016 Minor spec update for the capability "can_redefine_any_class". 15017 It now says: 15018 "RedefineClasses can be called on any modifiable class. See IsModifiableClass. 15019 (can_redefine_classes must also be set)" 15020 </change> 15021 <change date="5 June 2019" version="13.0.0"> 15022 Minor PopFrame spec update: 15023 - The specified thread must be suspended or must be the current thread. 15024 (It was not allowed to be the current thread before.) 15025 </change> 15026 <change date="10 October 2019" version="14.0.0"> 15027 Minor update for new class file Record attribute: 15028 - Specify that RedefineClasses and RetransformClasses are not allowed 15029 to change the class file Record attribute. 15030 </change> 15031 </changehistory> 15032 15033 </specification> 15034 <!-- Keep this comment at the end of the file 15035 Local variables: 15036 mode: sgml 15037 sgml-omittag:t 15038 sgml-shorttag:t 15039 sgml-namecase-general:t 15040 sgml-general-insert-case:lower 15041 sgml-minimize-attributes:nil 15042 sgml-always-quote-attributes:t 15043 sgml-indent-step:2 15044 sgml-indent-data:t 15045 sgml-parent-document:nil 15046 sgml-exposed-tags:nil 15047 sgml-local-catalogs:nil 15048 sgml-local-ecat-files:nil 15049 End: 15050 -->