1<?xml version="1.0" encoding="ISO-8859-1"?> 2<?xml-stylesheet type="text/xsl" href="jvmti.xsl"?> 3<!-- 4 Copyright (c) 2002, 2019, Oracle and/or its affiliates. All rights reserved. 5 DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 7 This code is free software; you can redistribute it and/or modify it 8 under the terms of the GNU General Public License version 2 only, as 9 published by the Free Software Foundation. 10 11 This code is distributed in the hope that it will be useful, but WITHOUT 12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 version 2 for more details (a copy is included in the LICENSE file that 15 accompanied this code). 16 17 You should have received a copy of the GNU General Public License version 18 2 along with this work; if not, write to the Free Software Foundation, 19 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 21 Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 or visit www.oracle.com if you need additional information or have any 23 questions. 24--> 25 26<!DOCTYPE specification [ 27 <!ELEMENT specification (title, intro*, functionsection, errorsection, 28 eventsection, datasection, issuessection, changehistory)> 29 <!ATTLIST specification label CDATA #REQUIRED> 30 31 <!ELEMENT title (#PCDATA|jvmti|tm)*> 32 <!ATTLIST title subtitle CDATA #REQUIRED> 33 34 <!ELEMENT intro ANY> 35 <!ATTLIST intro id CDATA #IMPLIED 36 label CDATA ""> 37 38 <!ELEMENT functionsection (intro*, category*)> 39 <!ATTLIST functionsection label CDATA #REQUIRED> 40 41 <!ELEMENT category ((intro|typedef|uniontypedef|capabilitiestypedef)*, 42 (function|callback|elide)*)> 43 <!ATTLIST category id CDATA #REQUIRED 44 label CDATA #REQUIRED> 45 46 <!ELEMENT function (synopsis, typedef*, description?, origin, 47 (capabilities|eventcapabilities), 48 parameters, errors)> 49 <!ATTLIST function id CDATA #REQUIRED 50 num CDATA #REQUIRED 51 phase (onload|onloadOnly|start|live|any) #IMPLIED 52 callbacksafe (safe|unsafe) #IMPLIED 53 impl CDATA #IMPLIED 54 hide CDATA #IMPLIED 55 jkernel (yes|no) #IMPLIED 56 since CDATA "1.0"> 57 58 <!ELEMENT callback ((jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread|jthreadGroup|jobject| 59 jvalue|enum|jint|jlong|jfloat|jdouble|jlocation|jboolean|char|uchar|size_t|void), 60 synopsis, description?, parameters)> 61 <!ATTLIST callback id CDATA #REQUIRED 62 since CDATA "1.0"> 63 64 <!ELEMENT synopsis (#PCDATA|jvmti)*> 65 66 <!ELEMENT typedef (description?, field*)> 67 <!ATTLIST typedef id CDATA #REQUIRED 68 label CDATA #REQUIRED 69 since CDATA "1.0"> 70 71 <!ELEMENT uniontypedef (description?, field*)> 72 <!ATTLIST uniontypedef id CDATA #REQUIRED 73 label CDATA #REQUIRED 74 since CDATA "1.0"> 75 76 <!ELEMENT field ((jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread|jthreadGroup|jobject| 77 jvalue|enum|jint|jlong|jfloat|jdouble|jlocation|jboolean|char|uchar|size_t|void|allocfieldbuf|inptr|inbuf|outbuf|vmbuf|ptrtype|struct), 78 description)> 79 <!ATTLIST field id CDATA #REQUIRED> 80 81 <!ELEMENT capabilitiestypedef (description?, capabilityfield*)> 82 <!ATTLIST capabilitiestypedef id CDATA #REQUIRED 83 label CDATA #REQUIRED> 84 85 <!ELEMENT capabilityfield (description)> 86 <!ATTLIST capabilityfield id CDATA #REQUIRED 87 disp1 CDATA "" 88 disp2 CDATA "" 89 since CDATA "1.0"> 90 91 <!ELEMENT description ANY> 92 93 <!ELEMENT capabilities (required*, capability*)> 94 95 <!ELEMENT eventcapabilities EMPTY> 96 97 <!ELEMENT required ANY> 98 <!ATTLIST required id CDATA #REQUIRED> 99 100 <!ELEMENT capability ANY> 101 <!ATTLIST capability id CDATA #REQUIRED> 102 103 <!ELEMENT parameters (param*)> 104 105 <!ELEMENT param ((jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread|jthreadGroup|jobject| 106 jvalue|enum|jint|jlong|jfloat|jdouble|jlocation|jboolean|char|uchar|size_t|void|varargs|struct|ptrtype| 107 outptr|allocbuf|allocallocbuf|inptr|inbuf|outbuf|vmbuf|agentbuf), 108 description)> 109 <!ATTLIST param id CDATA #REQUIRED> 110 111 <!ELEMENT jmethodID EMPTY> 112 <!ATTLIST jmethodID class CDATA #IMPLIED 113 native CDATA #IMPLIED> 114 115 <!ELEMENT jfieldID EMPTY> 116 <!ATTLIST jfieldID class CDATA #IMPLIED> 117 118 <!ELEMENT jclass EMPTY> 119 <!ATTLIST jclass method CDATA #IMPLIED 120 field CDATA #IMPLIED> 121 122 <!ELEMENT jframeID EMPTY> 123 <!ATTLIST jframeID thread CDATA #IMPLIED> 124 125 <!ELEMENT jrawMonitorID EMPTY> 126 127 <!ELEMENT jthread EMPTY> 128 <!ATTLIST jthread started CDATA #IMPLIED 129 null CDATA #IMPLIED 130 frame CDATA #IMPLIED 131 impl CDATA #IMPLIED> 132 133 <!ELEMENT varargs EMPTY> 134 135 <!ELEMENT jthreadGroup EMPTY> 136 <!ELEMENT jobject EMPTY> 137 <!ELEMENT jvalue EMPTY> 138 <!ELEMENT jchar EMPTY> 139 <!ELEMENT jint EMPTY> 140 <!ATTLIST jint min CDATA #IMPLIED> 141 <!ELEMENT jlong EMPTY> 142 <!ELEMENT jfloat EMPTY> 143 <!ELEMENT jdouble EMPTY> 144 <!ELEMENT jlocation EMPTY> 145 <!ELEMENT jboolean EMPTY> 146 <!ELEMENT char EMPTY> 147 <!ELEMENT uchar EMPTY> 148 <!ELEMENT size_t EMPTY> 149 <!ELEMENT void EMPTY> 150 <!ELEMENT enum (#PCDATA)*> 151 <!ELEMENT struct (#PCDATA)*> 152 153 <!ELEMENT nullok ANY> 154 155 <!ELEMENT ptrtype ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread| 156 jthreadGroup|jobject|jvalue), nullok?)> 157 158 <!ELEMENT outptr ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread| 159 jthreadGroup|jobject|jvalue|enum|jchar|jint|jlong|jfloat|jdouble| 160 jlocation|jboolean|char|uchar|size_t|void), nullok?)> 161 162 <!ELEMENT allocbuf ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread| 163 jthreadGroup|jobject|jvalue|enum|jint|jlong|jfloat|jdouble| 164 jlocation|jboolean|char|uchar|size_t|void), nullok?)> 165 <!ATTLIST allocbuf incount CDATA #IMPLIED 166 outcount CDATA #IMPLIED> 167 168 <!ELEMENT allocallocbuf ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread| 169 jthreadGroup|jobject|jvalue|enum|jint|jlong|jfloat|jdouble| 170 jlocation|jboolean|char|uchar|size_t|void), nullok?)> 171 <!ATTLIST allocallocbuf incount CDATA #IMPLIED 172 outcount CDATA #IMPLIED> 173 174 <!ELEMENT inptr (struct, nullok?)> 175 176 <!ELEMENT inbuf ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread| 177 jthreadGroup|jobject|jvalue|enum|jint|jlong|jfloat|jdouble| 178 jlocation|jboolean|char|uchar|size_t|void), nullok?)> 179 <!ATTLIST inbuf incount CDATA #IMPLIED> 180 181 <!ELEMENT outbuf ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread| 182 jthreadGroup|jobject|jvalue|enum|jint|jlong|jfloat|jdouble| 183 jlocation|jboolean|char|uchar|size_t|void|outbuf), nullok?)> 184 <!ATTLIST outbuf incount CDATA #IMPLIED 185 outcount CDATA #IMPLIED> 186 187 <!ELEMENT vmbuf ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread| 188 jthreadGroup|jobject|jvalue|enum|jchar|jint|jlong|jfloat|jdouble| 189 jlocation|jboolean|char|uchar|size_t|void), nullok?)> 190 <!ATTLIST vmbuf incount CDATA #IMPLIED 191 outcount CDATA #IMPLIED> 192 193 <!ELEMENT agentbuf ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread| 194 jthreadGroup|jobject|jvalue|enum|jint|jlong|jfloat|jdouble| 195 jlocation|jboolean|char|uchar|size_t|void), nullok?)> 196 <!ATTLIST agentbuf incount CDATA #IMPLIED 197 outcount CDATA #IMPLIED> 198 199 <!ELEMENT allocfieldbuf ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread| 200 jthreadGroup|jobject|jvalue|enum|jint|jlong|jfloat|jdouble| 201 jlocation|jboolean|char|uchar|size_t|void))> 202 <!ATTLIST allocfieldbuf outcount CDATA #IMPLIED> 203 204 <!ELEMENT errors (error*)> 205 206 <!ELEMENT error ANY> 207 <!ATTLIST error id CDATA #REQUIRED> 208 209 <!ELEMENT errorsection (intro*, errorcategory*)> 210 <!ATTLIST errorsection label CDATA #REQUIRED> 211 212 <!ELEMENT errorcategory (intro*, errorid*)> 213 <!ATTLIST errorcategory id CDATA #REQUIRED 214 label CDATA #REQUIRED> 215 216 <!ELEMENT errorid ANY> 217 <!ATTLIST errorid id CDATA #REQUIRED 218 num CDATA #REQUIRED> 219 220 <!ELEMENT datasection (intro*, basetypes*)> 221 222 <!ELEMENT basetypes (intro*, basetype*)> 223 <!ATTLIST basetypes id CDATA #REQUIRED 224 label CDATA #REQUIRED> 225 226 <!ELEMENT basetype (definition?,description)> 227 <!ATTLIST basetype id CDATA #REQUIRED 228 name CDATA #IMPLIED> 229 230 <!ELEMENT definition (#PCDATA|jvmti)*> 231 232 <!ELEMENT eventsection (intro*, (event|elide)*)> 233 <!ATTLIST eventsection label CDATA #REQUIRED> 234 235 <!ELEMENT event (description, origin, typedef*, capabilities, parameters)> 236 <!ATTLIST event id CDATA #REQUIRED 237 label CDATA #REQUIRED 238 const CDATA #REQUIRED 239 num CDATA #REQUIRED 240 phase (onload|start|live|any) #IMPLIED 241 filtered (thread|global) #IMPLIED 242 since CDATA "1.0"> 243 244 <!ELEMENT issuessection (intro*)> 245 <!ATTLIST issuessection label CDATA #REQUIRED> 246 247 <!ELEMENT changehistory (intro*, change*)> 248 <!ATTLIST changehistory update CDATA #REQUIRED 249 id CDATA #REQUIRED> 250 251 <!ELEMENT change ANY> 252 <!ATTLIST change date CDATA #REQUIRED 253 version CDATA #IMPLIED> 254 255 <!ELEMENT functionlink (#PCDATA|jvmti|code|i|b)*> 256 <!ATTLIST functionlink id CDATA #REQUIRED> 257 258 <!ELEMENT datalink (#PCDATA|jvmti|code|i|b)*> 259 <!ATTLIST datalink id CDATA #REQUIRED> 260 261 <!ELEMENT typelink (#PCDATA|jvmti|code|i|b)*> 262 <!ATTLIST typelink id CDATA #REQUIRED> 263 264 <!ELEMENT fieldlink (#PCDATA|jvmti|code|i|b)*> 265 <!ATTLIST fieldlink id CDATA #REQUIRED 266 struct CDATA #REQUIRED> 267 268 <!ELEMENT paramlink (#PCDATA|jvmti|code|i|b)*> 269 <!ATTLIST paramlink id CDATA #REQUIRED> 270 271 <!ELEMENT eventlink (#PCDATA|jvmti|code|i|b)*> 272 <!ATTLIST eventlink id CDATA #REQUIRED> 273 274 <!ELEMENT errorlink (#PCDATA|jvmti|code|i|b|tm)*> 275 <!ATTLIST errorlink id CDATA #REQUIRED> 276 277 <!ELEMENT externallink (#PCDATA|jvmti|code|i|b|tm)*> 278 <!ATTLIST externallink id CDATA #REQUIRED> 279 280 <!ELEMENT vmspec EMPTY> 281 <!ATTLIST vmspec chapter CDATA #IMPLIED> 282 283 <!ELEMENT internallink (#PCDATA|jvmti|code|i|b)*> 284 <!ATTLIST internallink id CDATA #REQUIRED> 285 286 <!ELEMENT functionphaselist EMPTY> 287 <!ATTLIST functionphaselist phase (onload|onloadOnly|start|live|any) #REQUIRED> 288 289 <!ELEMENT eventphaselist EMPTY> 290 <!ATTLIST eventphaselist phase (onload|start|live|any) #REQUIRED> 291 292 <!ELEMENT issue ANY> 293 294 <!ELEMENT rationale ANY> 295 296 <!ELEMENT todo ANY> 297 298 <!ELEMENT origin (#PCDATA)*> 299 300 <!ELEMENT elide (intro|function|callback|event)*> 301 <!ATTLIST elide why CDATA #IMPLIED> 302 303 <!ELEMENT constants (constant*)> 304 <!ATTLIST constants id CDATA #REQUIRED 305 label CDATA #REQUIRED 306 kind (enum|bits|const) #REQUIRED 307 since CDATA "1.0"> 308 309 <!ELEMENT constant ANY> 310 <!ATTLIST constant id CDATA #REQUIRED 311 num CDATA #REQUIRED> 312 313 <!ELEMENT tm (#PCDATA)> 314 315 <!ELEMENT i (#PCDATA|jvmti|tm)*> 316 317 <!ELEMENT b (#PCDATA|jvmti|code)*> 318 319 <!ELEMENT code (#PCDATA|space)*> 320 321 <!ELEMENT pre ANY> 322 323 <!ELEMENT space EMPTY> 324 325 <!ELEMENT jvmti EMPTY> 326 327 <!ELEMENT example (#PCDATA|i)*> 328 329 <!ELEMENT br EMPTY> 330 331 <!ELEMENT p EMPTY> 332 333 <!ELEMENT blockquote ANY> 334 335 <!ELEMENT dl (dt|dd)+> 336 337 <!ELEMENT dd ANY> 338 339 <!ELEMENT dt (#PCDATA|jvmti|code|i|b)*> 340 341 <!ELEMENT table (tr)+> 342 343 <!ELEMENT tr (td|th)*> 344 <!ATTLIST tr class CDATA #IMPLIED> 345 346 <!ELEMENT td ANY> 347 <!ATTLIST td class CDATA #IMPLIED> 348 349 <!ELEMENT th ANY> 350 <!ATTLIST th class CDATA #IMPLIED 351 scope (col|row) #IMPLIED> 352 353 <!ELEMENT ul (li)+> 354 <!ATTLIST ul type (disc|circle|square) "disc"> 355 356 <!ELEMENT li ANY> 357 ]> 358 359<specification label="JVM(TM) Tool Interface"> 360 <title subtitle="Version"> 361 <tm>JVM</tm> Tool Interface 362 </title> 363 364 <intro id="whatIs" label="What is the JVM Tool Interface?"> 365 The <tm>JVM</tm> Tool Interface (<jvmti/>) 366 is a programming interface used by development and monitoring tools. 367 It provides both a way to inspect the state and 368 to control the execution of applications running in the 369 <tm>Java</tm> virtual machine (VM). 370 <p/> 371 <jvmti/> is intended to provide a VM interface for the full breadth of tools 372 that need access to VM state, including but not limited to: profiling, 373 debugging, monitoring, thread analysis, and coverage analysis tools. 374 <p/> 375 <jvmti/> may not be available in all implementations of the <tm>Java</tm> virtual 376 machine. 377 <p/> 378 <jvmti/> is a two-way interface. 379 A client of <jvmti/>, hereafter called an <i>agent</i>, 380 can be notified of 381 interesting occurrences through <internallink id="EventSection">events</internallink>. 382 <jvmti/> 383 can query and control the application through many 384 <internallink id="FunctionSection">functions</internallink>, 385 either in response to events or 386 independent of them. 387 <p/> 388 Agents run in the same process with and communicate directly with 389 the virtual machine executing 390 the application being examined. This communication is 391 through a native interface (<jvmti/>). The native in-process interface allows 392 maximal control with minimal intrusion on the part of a tool. 393 Typically, agents are relatively compact. They can be controlled 394 by a separate process which implements the bulk of a tool's 395 function without interfering with the target application's normal execution. 396 </intro> 397 398 <intro id="architecture" label="Architecture"> 399 Tools can be written directly to <jvmti/> or indirectly 400 through higher level interfaces. 401 The Java Platform Debugger Architecture includes <jvmti/>, but also 402 contains higher-level, out-of-process debugger interfaces. The higher-level 403 interfaces are more appropriate than <jvmti/> for many tools. 404 For more information on the Java Platform Debugger Architecture, 405 see the 406 <externallink id="jpda/architecture.html">Java 407 Platform Debugger Architecture website</externallink>. 408 </intro> 409 410 <intro id="writingAgents" label="Writing Agents"> 411 Agents can be written in any native language that supports C 412 language calling conventions and C or C++ 413 definitions. 414 <p/> 415 The function, event, data type, and constant definitions needed for 416 using <jvmti/> are defined in the include file <code>jvmti.h</code>. 417 To use these definitions add the <tm>J2SE</tm> include directory 418 to your include path and add 419 <example> 420#include <jvmti.h> 421 </example> 422 to your source code. 423 </intro> 424 425 <intro id="deployingAgents" label="Deploying Agents"> 426 An agent is deployed in a platform specific manner but is typically the 427 platform equivalent of a dynamic library. On the <tm>Windows</tm> operating 428 system, for example, an agent library is a "Dynamic Linked Library" (DLL). 429 On the <tm>Solaris</tm> Operating Environment, an agent library is a shared 430 object (<code>.so</code> file). 431 <p/> 432 433 An agent may be started at VM startup by specifying the agent library 434 name using a <internallink id="starting">command line option</internallink>. 435 Some implementations may support a mechanism to <internallink id="onattach"> 436 start agents</internallink> in the live <functionlink id="GetPhase">phase</functionlink>. 437 The details of how this is initiated are implementation specific. 438 </intro> 439 440 <intro id="entryPoint" label="Statically Linked Agents (since version 1.2.3)"> 441 442 A native JVMTI Agent may be <i>statically linked</i> with the VM. 443 The manner in which the library and VM image are combined is 444 implementation-dependent. 445 An agent L whose image has been combined with the VM is defined as 446 <i>statically linked</i> if and only if the agent exports a function 447 called Agent_OnLoad_L. 448<p/> 449 If a <i>statically linked</i> agent L exports a function called 450 Agent_OnLoad_L and a function called Agent_OnLoad, the Agent_OnLoad 451 function will be ignored. 452 If an agent L is <i>statically linked</i>, an Agent_OnLoad_L 453 function will be invoked with the same arguments and expected return 454 value as specified for the Agent_OnLoad function. 455 An agent L that is <i>statically linked</i> will prohibit an agent of 456 the same name from being loaded dynamically. 457<p/> 458 The VM will invoke the Agent_OnUnload_L function of the agent, if such 459 a function is exported, at the same point during VM execution as it would 460 have called the dynamic entry point Agent_OnUnLoad. A statically loaded 461 agent cannot be unloaded. The Agent_OnUnload_L function will still be 462 called to do any other agent shutdown related tasks. 463 If a <i>statically linked</i> agent L exports a function called 464 Agent_OnUnLoad_L and a function called Agent_OnUnLoad, the Agent_OnUnLoad 465 function will be ignored. 466<p/> 467 If an agent L is <i>statically linked</i>, an Agent_OnAttach_L function 468 will be invoked with the same arguments and expected return value as 469 specified for the Agent_OnAttach function. 470 If a <i>statically linked</i> agent L exports a function called 471 Agent_OnAttach_L and a function called Agent_OnAttach, the Agent_OnAttach 472 function will be ignored. 473</intro> 474 475 <intro id="starting" label="Agent Command Line Options"> 476 The term "command-line option" is used below to 477 mean options supplied in the <code>JavaVMInitArgs</code> argument 478 to the <code>JNI_CreateJavaVM</code> function of the JNI 479 Invocation API. 480 <p/> 481 One of the two following 482 command-line options is used on VM startup to 483 properly load and run agents. 484 These arguments identify the library containing 485 the agent as well as an options 486 string to be passed in at startup. 487 <dl> 488 <dt><code>-agentlib:</code><i><agent-lib-name></i><code>=</code><i><options></i></dt> 489 <dd> 490 The name following <code>-agentlib:</code> is the name of the 491 library to load. Lookup of the library, both its full name and location, 492 proceeds in a platform-specific manner. 493 Typically, the <i><agent-lib-name></i> is expanded to an 494 operating system specific file name. 495 The <i><options></i> will be passed to the agent on start-up. 496 For example, if the option 497 <code>-agentlib:foo=opt1,opt2</code> is specified, the VM will attempt to 498 load the shared library <code>foo.dll</code> from the system <code>PATH</code> 499 under <tm>Windows</tm> or <code>libfoo.so</code> from the 500 <code>LD_LIBRARY_PATH</code> under the <tm>Solaris</tm> operating 501 environment. 502 If the agent library is statically linked into the executable 503 then no actual loading takes place. 504 <p/> 505 </dd> 506 <dt><code>-agentpath:</code><i><path-to-agent></i><code>=</code><i><options></i></dt> 507 <dd> 508 The path following <code>-agentpath:</code> is the absolute path from which 509 to load the library. 510 No library name expansion will occur. 511 The <i><options></i> will be passed to the agent on start-up. 512 For example, if the option 513 <code>-agentpath:c:\myLibs\foo.dll=opt1,opt2</code> is specified, the VM will attempt to 514 load the shared library <code>c:\myLibs\foo.dll</code>. If the agent 515 library is statically linked into the executable 516 then no actual loading takes place. 517 <p/> 518 </dd> 519 </dl> 520 For a dynamic shared library agent, the start-up routine 521 <internallink id="onload"><code>Agent_OnLoad</code></internallink> 522 in the library will be invoked. If the agent library is statically linked 523 into the executable then the system will attempt to invoke the 524 <code>Agent_OnLoad_<agent-lib-name></code> entry point where 525 <agent-lib-name> is the basename of the 526 agent. In the above example <code>-agentpath:c:\myLibs\foo.dll=opt1,opt2</code>, 527 the system will attempt to find and call the <code>Agent_OnLoad_foo</code> start-up routine. 528 <p/> 529 Libraries loaded with <code>-agentlib:</code> or <code>-agentpath:</code> 530 will be searched for JNI native method implementations to facilitate the 531 use of Java programming language code in tools, as is needed for 532 <internallink id="bci">bytecode instrumentation</internallink>. 533 <p/> 534 The agent libraries will be searched after all other libraries have been 535 searched (agents wishing to override or intercept the native method 536 implementations of non-agent methods can use the 537 <eventlink id="NativeMethodBind">NativeMethodBind event</eventlink>). 538 <p/> 539 These switches do the above and nothing more - they do not change the 540 state of the VM or <jvmti/>. No command line options are needed 541 to enable <jvmti/> 542 or aspects of <jvmti/>, this is handled programmatically 543 by the use of 544 <internallink id="capability">capabilities</internallink>. 545 </intro> 546 547 <intro id="startup" label="Agent Start-Up"> 548 The VM starts each agent by invoking a start-up function. 549 If the agent is started in the <code>OnLoad</code> 550 <functionlink id="GetPhase">phase</functionlink> the function 551 <internallink id="onload"><code>Agent_OnLoad</code></internallink> 552 or <internallink id="onload"><code>Agent_OnLoad_L</code></internallink> 553 for statically linked agents will be invoked. 554 If the agent is started in the live 555 <functionlink id="GetPhase">phase</functionlink> the function 556 <internallink id="onattach"><code>Agent_OnAttach</code></internallink> 557 or <internallink id="onattach"><code>Agent_OnAttach_L</code></internallink> 558 for statically linked agents will be invoked. 559 Exactly one call to a start-up function is made per agent. 560 </intro> 561 562 <intro id="onload" label="Agent Start-Up (OnLoad phase)"> 563 If an agent is started during the <code>OnLoad</code> phase then its 564 agent library must export a start-up function with the following prototype: 565 <example> 566JNIEXPORT jint JNICALL 567Agent_OnLoad(JavaVM *vm, char *options, void *reserved)</example> 568 Or for a statically linked agent named 'L': 569 <example> 570JNIEXPORT jint JNICALL 571Agent_OnLoad_L(JavaVM *vm, char *options, void *reserved)</example> 572 573 The VM will start the agent by calling this function. 574 It will be called early enough in VM initialization that: 575 <ul> 576 <li><functionlink id="SetSystemProperty">system properties</functionlink> 577 may be set before they have been used in the start-up of the VM</li> 578 <li>the full set of 579 <internallink id="capability">capabilities</internallink> 580 is still available (note that capabilities that configure the VM 581 may only be available at this time--see the 582 <internallink id="capability">Capability function section</internallink>)</li> 583 <li>no bytecodes have executed</li> 584 <li>no classes have been loaded</li> 585 <li>no objects have been created</li> 586 </ul> 587 <p/> 588 The VM will call the <code>Agent_OnLoad</code> or 589 <code>Agent_OnLoad_<agent-lib-name></code> function with 590 <i><options></i> as the second argument - 591 that is, using the command-line option examples, 592 <code>"opt1,opt2"</code> will be passed to the <code>char *options</code> 593 argument of <code>Agent_OnLoad</code>. 594 The <code>options</code> argument is encoded as a 595 <internallink id="mUTF">modified UTF-8</internallink> string. 596 If <i>=<options></i> is not specified, 597 a zero length string is passed to <code>options</code>. 598 The lifespan of the <code>options</code> string is the 599 <code>Agent_OnLoad</code> or <code>Agent_OnLoad_<agent-lib-name></code> 600 call. If needed beyond this time the string or parts of the string must 601 be copied. 602 The period between when <code>Agent_OnLoad</code> is called and when it 603 returns is called the <i>OnLoad phase</i>. 604 Since the VM is not initialized during the OnLoad 605 <functionlink id="GetPhase">phase</functionlink>, 606 the set of allowed operations 607 inside <code>Agent_OnLoad</code> is restricted (see the function descriptions for the 608 functionality available at this time). 609 The agent can safely process the options and set 610 event callbacks with <functionlink id="SetEventCallbacks"></functionlink>. Once 611 the VM initialization event is received 612 (that is, the <eventlink id="VMInit">VMInit</eventlink> 613 callback is invoked), the agent 614 can complete its initialization. 615 <rationale> 616 Early startup is required so that agents can set the desired capabilities, 617 many of which must be set before the VM is initialized. 618 In JVMDI, the -Xdebug command-line option provided 619 very coarse-grain control of capabilities. 620 JVMPI implementations use various tricks to provide a single "JVMPI on" switch. 621 No reasonable command-line 622 option could provide the fine-grain of control required to balance needed capabilities vs 623 performance impact. 624 Early startup is also needed so that agents can control the execution 625 environment - modifying the file system and system properties to install 626 their functionality. 627 </rationale> 628 <p/> 629 The return value from <code>Agent_OnLoad</code> or 630 <code>Agent_OnLoad_<agent-lib-name></code> is used to indicate an error. 631 Any value other than zero indicates an error and causes termination of the VM. 632 </intro> 633 634 <intro id="onattach" label="Agent Start-Up (Live phase)"> 635 A VM may support a mechanism that allows agents to be started in the VM during the live 636 <functionlink id="GetPhase">phase</functionlink>. The details of how this is supported, 637 are implementation specific. For example, a tool may use some platform specific mechanism, 638 or implementation specific API, to attach to the running VM, and request it start a given 639 agent. 640 <p/> 641 If an agent is started during the live phase then its agent library 642 must export a start-up function 643 with the following prototype: 644 <example> 645JNIEXPORT jint JNICALL 646Agent_OnAttach(JavaVM* vm, char *options, void *reserved)</example> 647Or for a statically linked agent named 'L': 648 <example> 649JNIEXPORT jint JNICALL 650Agent_OnAttach_L(JavaVM* vm, char *options, void *reserved)</example> 651 652 <p/> 653 The VM will start the agent by calling this function. 654 It will be called in the context of a thread 655 that is attached to the VM. The first argument <i><vm></i> is the Java VM. 656 The <i><options></i> argument is the startup options provided to the agent. 657 <i><options></i> is encoded as a <internallink id="mUTF">modified UTF-8 658 </internallink> string. 659 If startup options were not provided, a zero length string is passed to 660 <code>options</code>. The lifespan of the <code>options</code> string is the 661 <code>Agent_OnAttach</code> or <code>Agent_OnAttach_<agent-lib-name></code> call. 662 If needed beyond this time the string or parts of the string must be copied. 663 <p/> 664 Note that some <internallink id="capability">capabilities</internallink> 665 may not be available in the live phase. 666 <p/> 667 The <code>Agent_OnAttach</code> or <code>Agent_OnAttach_<agent-lib-name 668 ></code> function initializes the agent and returns a value 669 to the VM to indicate if an error occurred. Any value other than zero indicates an error. 670 An error does not cause the VM to terminate. Instead the VM ignores the error, or takes 671 some implementation specific action -- for example it might print an error to standard error, 672 or record the error in a system log. 673 </intro> 674 675 <intro id="onunload" label="Agent Shutdown"> 676 The library may optionally export a 677 shutdown function with the following prototype: 678 <example> 679JNIEXPORT void JNICALL 680Agent_OnUnload(JavaVM *vm)</example> 681 Or for a statically linked agent named 'L': 682 <example> 683JNIEXPORT void JNICALL 684Agent_OnUnload_L(JavaVM *vm)</example> 685 686 This function will be called by the VM when the library is about to be unloaded. 687 The library will be unloaded (unless it is statically linked into the 688 executable) and this function will be called if some platform specific 689 mechanism causes the unload (an unload mechanism is not specified in this document) 690 or the library is (in effect) unloaded by the termination of the VM whether through 691 normal termination or VM failure, including start-up failure. 692 Uncontrolled shutdown is, of course, an exception to this rule. 693 Note the distinction between this function and the 694 <eventlink id="VMDeath">VM Death event</eventlink>: for the VM Death event 695 to be sent, the VM must have run at least to the point of initialization and a valid 696 <jvmti/> environment must exist which has set a callback for VMDeath 697 and enabled the event. 698 None of these are required for <code>Agent_OnUnload</code> or 699 <code>Agent_OnUnload_<agent-lib-name></code> and this function 700 is also called if the library is unloaded for other reasons. 701 In the case that a VM Death event is sent, it will be sent before this 702 function is called (assuming this function is called due to VM termination). 703 This function can be used to clean-up resources allocated by the agent. 704 </intro> 705 706 <intro id="tooloptions" label="JAVA_TOOL_OPTIONS"> 707 Since the command-line cannot always be accessed or modified, for example in embedded VMs 708 or simply VMs launched deep within scripts, a <code>JAVA_TOOL_OPTIONS</code> variable is 709 provided so that agents may be launched in these cases. 710 <p/> 711 Platforms which support environment variables or other named strings, may support the 712 <code>JAVA_TOOL_OPTIONS</code> variable. This variable will be broken into options at white-space 713 boundaries. White-space characters include space, tab, carriage-return, new-line, 714 vertical-tab, and form-feed. Sequences of white-space characters are considered 715 equivalent to a single white-space character. No white-space is included in the options 716 unless quoted. Quoting is as follows: 717 <ul> 718 <li>All characters enclosed between a pair of single quote marks (''), except a single 719 quote, are quoted.</li> 720 <li>Double quote characters have no special meaning inside a pair of single quote marks.</li> 721 <li>All characters enclosed between a pair of double quote marks (""), except a double 722 quote, are quoted.</li> 723 <li>Single quote characters have no special meaning inside a pair of double quote marks.</li> 724 <li>A quoted part can start or end anywhere in the variable.</li> 725 <li>White-space characters have no special meaning when quoted -- they are included in 726 the option like any other character and do not mark white-space boundaries.</li> 727 <li>The pair of quote marks is not included in the option.</li> 728 </ul> 729 <code>JNI_CreateJavaVM</code> (in the JNI Invocation API) will prepend these options to the options supplied 730 in its <code>JavaVMInitArgs</code> argument. Platforms may disable this feature in cases where security is 731 a concern; for example, the Reference Implementation disables this feature on Unix systems when 732 the effective user or group ID differs from the real ID. 733 This feature is intended to support the initialization of tools -- specifically including the 734 launching of native or Java programming language agents. Multiple tools may wish to use this 735 feature, so the variable should not be overwritten, instead, options should be appended to 736 the variable. Note that since the variable is processed at the time of the JNI Invocation 737 API create VM call, options processed by a launcher (e.g., VM selection options) will not be handled. 738 </intro> 739 740 <intro id="environments" label="Environments"> 741 The <jvmti/> specification supports the use of multiple simultaneous 742 <jvmti/> agents. 743 Each agent has its own <jvmti/> environment. 744 That is, the <jvmti/> state is 745 separate for each agent - changes to one environment do not affect the 746 others. The state of a <jvmti/> 747 environment includes: 748 <ul> 749 <li><functionlink id="SetEventCallbacks">the event callbacks</functionlink></li> 750 <li><functionlink id="SetEventNotificationMode">the set of events which are enabled</functionlink></li> 751 <li><internallink id="capability">the capabilities</internallink></li> 752 <li><internallink id="memory">the memory allocation/deallocation hooks</internallink></li> 753 </ul> 754 Although their <jvmti/> state 755 is separate, agents inspect and modify the shared state 756 of the VM, they also share the native environment in which they execute. 757 As such, an agent can perturb the results of other agents or cause them 758 to fail. It is the responsibility of the agent writer to specify the level 759 of compatibility with other agents. <jvmti/> implementations are not capable 760 of preventing destructive interactions between agents. Techniques to reduce 761 the likelihood of these occurrences are beyond the scope of this document. 762 <p/> 763 An agent creates a <jvmti/> environment 764 by passing a <jvmti/> version 765 as the interface ID to the JNI Invocation API function 766 <externallink id="jni/invocation.html#getenv"> 767 <code>GetEnv</code></externallink>. 768 See <internallink id="jvmtiEnvAccess">Accessing <jvmti/> Functions</internallink> 769 for more details on the creation and use of 770 <jvmti/> environments. 771 Typically, <jvmti/> environments are created by calling <code>GetEnv</code> from 772 <internallink id="onload"><code>Agent_OnLoad</code></internallink>. 773 </intro> 774 775 <intro id="bci" label="Bytecode Instrumentation"> 776 This interface does not include some events that one might expect in an interface with 777 profiling support. Some examples include full speed 778 method enter and exit events. The interface instead provides support for 779 <i>bytecode instrumentation</i>, the ability to alter the Java virtual machine 780 bytecode instructions which comprise the target program. Typically, these alterations 781 are to add "events" to the code of a method - for example, to add, at the beginning of a method, 782 a call to <code>MyProfiler.methodEntered()</code>. 783 Since the changes are purely additive, they do not modify application 784 state or behavior. 785 Because the inserted agent code is standard bytecodes, the VM can run at full speed, 786 optimizing not only the target program but also the instrumentation. If the 787 instrumentation does not involve switching from bytecode execution, no expensive 788 state transitions are needed. The result is high performance events. 789 This approach also provides complete control to the agent: instrumentation can be 790 restricted to "interesting" portions of the code (e.g., the end user's code) and 791 can be conditional. Instrumentation can run entirely in Java programming language 792 code or can call into the native agent. Instrumentation can simply maintain 793 counters or can statistically sample events. 794 <p/> 795 Instrumentation can be inserted in one of three ways: 796 <ul> 797 <li> 798 Static Instrumentation: The class file is instrumented before it 799 is loaded into the VM - for example, by creating a duplicate directory of 800 <code>*.class</code> files which have been modified to add the instrumentation. 801 This method is extremely awkward and, in general, an agent cannot know 802 the origin of the class files which will be loaded. 803 </li> 804 <li> 805 Load-Time Instrumentation: When a class file is loaded by the VM, the raw 806 bytes of the class file are sent for instrumentation to the agent. 807 The <eventlink id="ClassFileLoadHook"/> 808 event, triggered by the class load, 809 provides this functionality. This mechanism provides efficient 810 and complete access to one-time instrumentation. 811 </li> 812 <li> 813 Dynamic Instrumentation: A class which is already loaded (and possibly 814 even running) is modified. This optional feature is provided by the 815 <eventlink id="ClassFileLoadHook"/> event, triggered by calling the 816 <functionlink id="RetransformClasses"/> function. 817 Classes can be modified multiple times and can be returned to their 818 original state. 819 The mechanism allows instrumentation which changes during the 820 course of execution. 821 </li> 822 </ul> 823 <p/> 824 The class modification functionality provided in this interface 825 is intended to provide a mechanism for instrumentation 826 (the <eventlink id="ClassFileLoadHook"/> event 827 and the <functionlink id="RetransformClasses"/> function) 828 and, during development, for fix-and-continue debugging 829 (the <functionlink id="RedefineClasses"/> function). 830 <p/> 831 Care must be taken to avoid perturbing dependencies, especially when 832 instrumenting core classes. For example, an approach to getting notification 833 of every object allocation is to instrument the constructor on 834 <code>Object</code>. Assuming that the constructor is initially 835 empty, the constructor could be changed to: 836 <example> 837 public Object() { 838 MyProfiler.allocationTracker(this); 839 } 840 </example> 841 However, if this change was made using the 842 <eventlink id="ClassFileLoadHook"/> 843 event then this might impact a typical VM as follows: 844 the first created object will call the constructor causing a class load of 845 <code>MyProfiler</code>; which will then cause 846 object creation, and since <code>MyProfiler</code> isn't loaded yet, 847 infinite recursion; resulting in a stack overflow. A refinement of this 848 would be to delay invoking the tracking method until a safe time. For 849 example, <code>trackAllocations</code> could be set in the 850 handler for the <code>VMInit</code> event. 851 <example> 852 static boolean trackAllocations = false; 853 854 public Object() { 855 if (trackAllocations) { 856 MyProfiler.allocationTracker(this); 857 } 858 } 859 </example> 860 <p/> 861 The <functionlink id="SetNativeMethodPrefix"/> allows native methods 862 to be instrumented by the use of wrapper methods. 863 </intro> 864 865<intro id="bcimodules" label="Bytecode Instrumentation of code in modules"> 866 Agents can use the functions <functionlink id="AddModuleReads"/>, 867 <functionlink id="AddModuleExports"/>, <functionlink id="AddModuleOpens"/>, 868 <functionlink id="AddModuleUses"/> and <functionlink id="AddModuleProvides"/> 869 to update a module to expand the set of modules that it reads, the set of 870 packages that it exports or opens to other modules, or the services that it 871 uses and provides. 872 <p/> 873 As an aid to agents that deploy supporting classes on the search path of 874 the bootstrap class loader, or the search path of the class loader that 875 loads the main class, the Java virtual machine arranges for the module 876 of classes transformed by the <eventlink id="ClassFileLoadHook"/> event to 877 read the unnamed module of both class loaders. 878</intro> 879 880 <intro id="mUTF" label="Modified UTF-8 String Encoding"> 881 <jvmti/> uses modified UTF-8 to encode character strings. 882 This is the same encoding used by JNI. 883 Modified UTF-8 differs 884 from standard UTF-8 in the representation of supplementary characters 885 and of the null character. See the 886 <externallink id="jni/types.html#modified-utf-8-strings"> 887 Modified UTF-8 Strings</externallink> 888 section of the JNI specification for details. 889 </intro> 890 891 <intro id="context" label="Specification Context"> 892 Since this interface provides access to the state of applications running in the 893 Java virtual machine; 894 terminology refers to the Java platform and not the native 895 platform (unless stated otherwise). For example: 896 <ul> 897 <li>"thread" means Java programming language thread.</li> 898 <li>"stack frame" means Java virtual machine stack frame.</li> 899 <li>"class" means Java programming language class.</li> 900 <li>"heap" means Java virtual machine heap.</li> 901 <li>"monitor" means Java programming language object monitor.</li> 902 </ul> 903 <p/> 904 Sun, Sun Microsystems, the Sun logo, Java, and JVM 905 are trademarks or registered trademarks of Oracle 906 and/or its affiliates, in the U.S. and other countries. 907 </intro> 908 909 910<functionsection label="Functions"> 911 <intro id="jvmtiEnvAccess" label="Accessing Functions"> 912 Native code accesses <jvmti/> features 913 by calling <jvmti/> functions. 914 Access to <jvmti/> functions is by use of an interface pointer 915 in the same manner as 916 <externallink id="jni/design.html">Java 917 Native Interface (JNI) functions</externallink> are accessed. 918 The <jvmti/> interface pointer is called the 919 <i>environment pointer</i>. 920 <p/> 921 An environment pointer is a pointer to an environment and has 922 the type <code>jvmtiEnv*</code>. 923 An environment has information about its <jvmti/> connection. 924 The first value in the environment is a pointer to the function table. 925 The function table is an array of pointers to <jvmti/> functions. 926 Every function pointer is at a predefined offset inside the 927 array. 928 <p/> 929 When used from the C language: 930 double indirection is used to access the functions; 931 the environment pointer provides context and is the first 932 parameter of each function call; for example: 933 <example> 934jvmtiEnv *jvmti; 935... 936jvmtiError err = (*jvmti)->GetLoadedClasses(jvmti, &class_count, &classes); 937 </example> 938 <p/> 939 When used from the C++ language: 940 functions are accessed as member functions of <code>jvmtiEnv</code>; 941 the environment pointer is not passed to the function call; for example: 942 <example> 943jvmtiEnv *jvmti; 944... 945jvmtiError err = jvmti->GetLoadedClasses(&class_count, &classes); 946 </example> 947 Unless otherwise stated, all examples and declarations in this 948 specification use the C language. 949 <p/> 950 A <jvmti/> environment can be obtained through the JNI Invocation API 951 <code>GetEnv</code> function: 952 <example> 953jvmtiEnv *jvmti; 954... 955(*jvm)->GetEnv(jvm, &jvmti, JVMTI_VERSION_1_0); 956 </example> 957 Each call to <code>GetEnv</code> 958 creates a new <jvmti/> connection and thus 959 a new <jvmti/> environment. 960 The <code>version</code> argument of <code>GetEnv</code> must be 961 a <jvmti/> version. 962 The returned environment may have a different version than the 963 requested version but the returned environment must be compatible. 964 <code>GetEnv</code> will return <code>JNI_EVERSION</code> if a 965 compatible version is not available, if <jvmti/> is not supported or 966 <jvmti/> is not supported in the current VM configuration. 967 Other interfaces may be added for creating <jvmti/> environments 968 in specific contexts. 969 Each environment has its own state (for example, 970 <functionlink id="SetEventNotificationMode">desired events</functionlink>, 971 <functionlink id="SetEventCallbacks">event handling functions</functionlink>, and 972 <functionlink id="AddCapabilities">capabilities</functionlink>). 973 An environment is released with 974 <functionlink id="DisposeEnvironment"></functionlink>. 975 Thus, unlike JNI which has one environment per thread, <jvmti/> environments work 976 across threads and are created dynamically. 977 </intro> 978 979 <intro id="functionReturn" label="Function Return Values"> 980 <jvmti/> functions always return an 981 <internallink id="ErrorSection">error code</internallink> via the 982 <datalink id="jvmtiError"/> function return value. 983 Some functions can return additional 984 values through pointers provided by the calling function. 985 In some cases, <jvmti/> functions allocate memory that your program must 986 explicitly deallocate. This is indicated in the individual <jvmti/> 987 function descriptions. Empty lists, arrays, sequences, etc are 988 returned as <code>NULL</code>. 989 <p/> 990 In the event that the <jvmti/> function encounters 991 an error (any return value other than <code>JVMTI_ERROR_NONE</code>) the values 992 of memory referenced by argument pointers is undefined, but no memory 993 will have been allocated and no global references will have been allocated. 994 If the error occurs because of invalid input, no action will have occurred. 995 </intro> 996 997<intro id="refs" label="Managing JNI Object References"> 998 <jvmti/> functions identify objects with JNI references 999 (<datalink id="jobject"/> and <datalink id="jclass"/>) 1000 and their derivatives 1001 (<datalink id="jthread"/> and <datalink id="jthreadGroup"/>). 1002 References passed to 1003 <jvmti/> functions can be either global or local, but they must be 1004 strong references. All references returned by <jvmti/> functions are 1005 local references--these local references are created 1006 during the <jvmti/> call. 1007 Local references are a resource that must be managed (see the 1008 <externallink id="jni/functions.html#local-references"> 1009 JNI Documentation</externallink>). 1010 When threads return from native code all local references 1011 are freed. Note that some threads, including typical 1012 agent threads, will never return from native code. 1013 A thread is ensured the ability to create sixteen local 1014 references without the need for any explicit management. 1015 For threads executing a limited number of <jvmti/> calls before 1016 returning from native code 1017 (for example, threads processing events), 1018 it may be determined that no explicit management 1019 is needed. 1020 However, long running agent threads will need explicit 1021 local reference management--usually with the JNI functions 1022 <code>PushLocalFrame</code> and <code>PopLocalFrame</code>. 1023 Conversely, to preserve references beyond the 1024 return from native code, they must be converted to global references. 1025 These rules do not apply to <datalink id="jmethodID"/> and <datalink id="jfieldID"/> 1026 as they are not <datalink id="jobject"/>s. 1027</intro> 1028 1029 <intro id="prereqState" label="Prerequisite State for Calling Functions"> 1030 Unless the function explicitly states that the agent must bring 1031 a thread or the VM to a particular state (for example, suspended), 1032 the <jvmti/> implementation is responsible for bringing the VM to a 1033 safe and consistent state for performing the function. 1034 </intro> 1035 1036 <intro id="functionsExceptions" label="Exceptions and Functions"> 1037 <jvmti/> functions never throw exceptions; error conditions are 1038 communicated via the 1039 <internallink id="functionReturn">function return value</internallink>. 1040 Any existing exception state is preserved across a call to a 1041 <jvmti/> function. 1042 See the 1043 <externallink 1044 id="jni/design.html#java-exceptions" 1045 >Java Exceptions</externallink> 1046 section of the JNI specification for information on handling exceptions. 1047 </intro> 1048 1049 <category id="memory" label="Memory Management"> 1050 <intro> 1051 These functions provide for the allocation and deallocation of 1052 memory used by <jvmti/> functionality and can be used to provide 1053 working memory for agents. 1054 Memory managed by <jvmti/> is not compatible with other memory 1055 allocation libraries and mechanisms. 1056 </intro> 1057 1058 <function id="Allocate" jkernel="yes" phase="any" callbacksafe="safe" impl="notrace" num="46"> 1059 <synopsis>Allocate</synopsis> 1060 <description> 1061 Allocate an area of memory through the <jvmti/> allocator. 1062 The allocated 1063 memory should be freed with <functionlink id="Deallocate"></functionlink>. 1064 </description> 1065 <origin>jvmdi</origin> 1066 <capabilities> 1067 </capabilities> 1068 <parameters> 1069 <param id="size"> 1070 <jlong/> 1071 <description> 1072 The number of bytes to allocate. 1073 <rationale> 1074 <code>jlong</code> is used for compatibility with JVMDI. 1075 </rationale> 1076 </description> 1077 </param> 1078 <param id="mem_ptr"> 1079 <allocbuf incount="size"><uchar/></allocbuf> 1080 <description> 1081 On return, a pointer to the beginning of the allocated memory. 1082 If <code>size</code> is zero, <code>NULL</code> is returned. 1083 </description> 1084 </param> 1085 </parameters> 1086 <errors> 1087 <error id="JVMTI_ERROR_OUT_OF_MEMORY"> 1088 Memory request cannot be honored. 1089 </error> 1090 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 1091 <paramlink id="size"></paramlink> is less than zero. 1092 </error> 1093 </errors> 1094 </function> 1095 1096 <function id="Deallocate" jkernel="yes" phase="any" callbacksafe="safe" impl="notrace" num="47"> 1097 <synopsis>Deallocate</synopsis> 1098 <description> 1099 Deallocate <code>mem</code> using the <jvmti/> allocator. 1100 This function should 1101 be used to deallocate any memory allocated and returned 1102 by a <jvmti/> function 1103 (including memory allocated with <functionlink id="Allocate"></functionlink>). 1104 All allocated memory must be deallocated 1105 or the memory cannot be reclaimed. 1106 </description> 1107 <origin>jvmdi</origin> 1108 <capabilities> 1109 </capabilities> 1110 <parameters> 1111 <param id="mem"> 1112 <outbuf> 1113 <uchar/> 1114 <nullok>the call is ignored</nullok> 1115 </outbuf> 1116 <description> 1117 A pointer to the beginning of the allocated memory. 1118 Please ignore "On return, the elements are set." 1119 <todo>keep it from generating "On return, the elements are set"</todo> 1120 </description> 1121 </param> 1122 </parameters> 1123 <errors> 1124 </errors> 1125 </function> 1126 </category> 1127 1128 <category id="threadCategory" label="Thread"> 1129 <intro> 1130 </intro> 1131 1132 <function id="GetThreadState" num="17"> 1133 <synopsis>Get Thread State</synopsis> 1134 <description> 1135 Get the state of a thread. The state of the thread is represented by the 1136 answers to the hierarchical set of questions below: 1137 <ul type="circle"> 1138 <li><i>Alive?</i> 1139 <ul> 1140 <li>Not alive. 1141 <ul type="circle"> 1142 <li><i>Why not alive?</i> 1143 <ul> 1144 <li>New.</li> 1145 <li>Terminated (<datalink 1146 id="JVMTI_THREAD_STATE_TERMINATED"><code>JVMTI_THREAD_STATE_TERMINATED</code></datalink>)</li> 1147 </ul> 1148 </li> 1149 </ul> 1150 </li> 1151 <li>Alive (<datalink 1152 id="JVMTI_THREAD_STATE_ALIVE"><code>JVMTI_THREAD_STATE_ALIVE</code></datalink>) 1153 <ul type="circle"> 1154 <li><i>Suspended?</i> 1155 <ul> 1156 <li>Suspended (<datalink 1157 id="JVMTI_THREAD_STATE_SUSPENDED"><code>JVMTI_THREAD_STATE_SUSPENDED</code></datalink>)</li> 1158 <li>Not suspended</li> 1159 </ul> 1160 </li> 1161 <li><i>Interrupted?</i> 1162 <ul> 1163 <li>Interrupted (<datalink 1164 id="JVMTI_THREAD_STATE_INTERRUPTED"><code>JVMTI_THREAD_STATE_INTERRUPTED</code></datalink>)</li> 1165 <li>Not interrupted.</li> 1166 </ul> 1167 </li> 1168 <li><i>In native?</i> 1169 <ul> 1170 <li>In native code (<datalink 1171 id="JVMTI_THREAD_STATE_IN_NATIVE"><code>JVMTI_THREAD_STATE_IN_NATIVE</code></datalink>)</li> 1172 <li>In Java programming language code</li> 1173 </ul> 1174 </li> 1175 <li><i>What alive state?</i> 1176 <ul> 1177 <li>Runnable (<datalink 1178 id="JVMTI_THREAD_STATE_RUNNABLE"><code>JVMTI_THREAD_STATE_RUNNABLE</code></datalink>)</li> 1179 <li>Blocked (<datalink 1180 id="JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER"><code>JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER</code></datalink>)</li> 1181 <li>Waiting (<datalink 1182 id="JVMTI_THREAD_STATE_WAITING"><code>JVMTI_THREAD_STATE_WAITING</code></datalink>) 1183 <ul type="circle"> 1184 <li><i>Timed wait?</i> 1185 <ul> 1186 <li>Indefinite (<datalink 1187 id="JVMTI_THREAD_STATE_WAITING_INDEFINITELY"><code>JVMTI_THREAD_STATE_WAITING_INDEFINITELY</code></datalink></li> 1188 <li>Timed (<datalink 1189 id="JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT"><code>JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT</code></datalink>)</li> 1190 </ul> 1191 </li> 1192 <li><i>Why waiting?</i> 1193 <ul> 1194 <li>Object.wait (<datalink 1195 id="JVMTI_THREAD_STATE_IN_OBJECT_WAIT"><code>JVMTI_THREAD_STATE_IN_OBJECT_WAIT</code></datalink>)</li> 1196 <li>LockSupport.park (<datalink 1197 id="JVMTI_THREAD_STATE_PARKED"><code>JVMTI_THREAD_STATE_PARKED</code></datalink>)</li> 1198 <li>Sleeping (<datalink 1199 id="JVMTI_THREAD_STATE_SLEEPING"><code>JVMTI_THREAD_STATE_SLEEPING</code></datalink>)</li> 1200 </ul> 1201 </li> 1202 </ul> 1203 </li> 1204 </ul> 1205 </li> 1206 </ul> 1207 </li> 1208 </ul> 1209 </li> 1210 </ul> 1211 <p/> 1212 The answers are represented by the following bit vector. 1213 <constants id="jvmtiThreadState" label="Thread State Flags" kind="bits"> 1214 <constant id="JVMTI_THREAD_STATE_ALIVE" num="0x0001"> 1215 Thread is alive. Zero if thread is new (not started) or terminated. 1216 </constant> 1217 <constant id="JVMTI_THREAD_STATE_TERMINATED" num="0x0002"> 1218 Thread has completed execution. 1219 </constant> 1220 <constant id="JVMTI_THREAD_STATE_RUNNABLE" num="0x0004"> 1221 Thread is runnable. 1222 </constant> 1223 <constant id="JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER" num="0x0400"> 1224 Thread is waiting to enter a synchronization block/method or, 1225 after an <code>Object.wait()</code>, waiting to re-enter a 1226 synchronization block/method. 1227 </constant> 1228 <constant id="JVMTI_THREAD_STATE_WAITING" num="0x0080"> 1229 Thread is waiting. 1230 </constant> 1231 <constant id="JVMTI_THREAD_STATE_WAITING_INDEFINITELY" num="0x0010"> 1232 Thread is waiting without a timeout. 1233 For example, <code>Object.wait()</code>. 1234 </constant> 1235 <constant id="JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT" num="0x0020"> 1236 Thread is waiting with a maximum time to wait specified. 1237 For example, <code>Object.wait(long)</code>. 1238 </constant> 1239 <constant id="JVMTI_THREAD_STATE_SLEEPING" num="0x0040"> 1240 Thread is sleeping -- <code>Thread.sleep(long)</code>. 1241 </constant> 1242 <constant id="JVMTI_THREAD_STATE_IN_OBJECT_WAIT" num="0x0100"> 1243 Thread is waiting on an object monitor -- <code>Object.wait</code>. 1244 </constant> 1245 <constant id="JVMTI_THREAD_STATE_PARKED" num="0x0200"> 1246 Thread is parked, for example: <code>LockSupport.park</code>, 1247 <code>LockSupport.parkUtil</code> and <code>LockSupport.parkNanos</code>. 1248 </constant> 1249 <constant id="JVMTI_THREAD_STATE_SUSPENDED" num="0x100000"> 1250 Thread suspended. 1251 <code>java.lang.Thread.suspend()</code> 1252 or a <jvmti/> suspend function 1253 (such as <functionlink id="SuspendThread"></functionlink>) 1254 has been called on the thread. If this bit 1255 is set, the other bits refer to the thread state before suspension. 1256 </constant> 1257 <constant id="JVMTI_THREAD_STATE_INTERRUPTED" num="0x200000"> 1258 Thread has been interrupted. 1259 </constant> 1260 <constant id="JVMTI_THREAD_STATE_IN_NATIVE" num="0x400000"> 1261 Thread is in native code--that is, a native method is running 1262 which has not called back into the VM or Java programming 1263 language code. 1264 <p/> 1265 This flag is not set when running VM compiled Java programming 1266 language code nor is it set when running VM code or 1267 VM support code. Native VM interface functions, such as JNI and 1268 <jvmti/> functions, may be implemented as VM code. 1269 </constant> 1270 <constant id="JVMTI_THREAD_STATE_VENDOR_1" num="0x10000000"> 1271 Defined by VM vendor. 1272 </constant> 1273 <constant id="JVMTI_THREAD_STATE_VENDOR_2" num="0x20000000"> 1274 Defined by VM vendor. 1275 </constant> 1276 <constant id="JVMTI_THREAD_STATE_VENDOR_3" num="0x40000000"> 1277 Defined by VM vendor. 1278 </constant> 1279 </constants> 1280 The following definitions are used to convert <jvmti/> thread state 1281 to <code>java.lang.Thread.State</code> style states. 1282 <constants id="jvmtiJavaLangThreadState" label="java.lang.Thread.State Conversion Masks" kind="bits"> 1283 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_MASK" 1284 num="JVMTI_THREAD_STATE_TERMINATED | JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_RUNNABLE | JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER | JVMTI_THREAD_STATE_WAITING | JVMTI_THREAD_STATE_WAITING_INDEFINITELY | JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT"> 1285 Mask the state with this before comparison 1286 </constant> 1287 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_NEW" 1288 num="0"> 1289 <code>java.lang.Thread.State.NEW</code> 1290 </constant> 1291 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_TERMINATED" 1292 num="JVMTI_THREAD_STATE_TERMINATED"> 1293 <code>java.lang.Thread.State.TERMINATED</code> 1294 </constant> 1295 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_RUNNABLE" 1296 num="JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_RUNNABLE"> 1297 <code>java.lang.Thread.State.RUNNABLE</code> 1298 </constant> 1299 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_BLOCKED" 1300 num="JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER"> 1301 <code>java.lang.Thread.State.BLOCKED</code> 1302 </constant> 1303 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_WAITING" 1304 num="JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_WAITING | JVMTI_THREAD_STATE_WAITING_INDEFINITELY"> 1305 <code>java.lang.Thread.State.WAITING</code> 1306 </constant> 1307 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_TIMED_WAITING" 1308 num="JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_WAITING | JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT"> 1309 <code>java.lang.Thread.State.TIMED_WAITING</code> 1310 </constant> 1311 </constants> 1312 <b>Rules</b> 1313 <p/> 1314 There can be no more than one answer to a question, although there can be no 1315 answer (because the answer is unknown, does not apply, or none of the answers is 1316 correct). An answer is set only when the enclosing answers match. 1317 That is, no more than one of 1318 <ul type="circle"> 1319 <li><code>JVMTI_THREAD_STATE_RUNNABLE</code></li> 1320 <li><code>JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER</code></li> 1321 <li><code>JVMTI_THREAD_STATE_WAITING</code></li> 1322 </ul> 1323 can be set (a <tm>J2SE</tm> compliant implementation will always set 1324 one of these if <code>JVMTI_THREAD_STATE_ALIVE</code> is set). 1325 And if any of these are set, the enclosing answer 1326 <code>JVMTI_THREAD_STATE_ALIVE</code> is set. 1327 No more than one of 1328 <ul type="circle"> 1329 <li><code>JVMTI_THREAD_STATE_WAITING_INDEFINITELY</code></li> 1330 <li><code>JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT</code></li> 1331 </ul> 1332 can be set (a <tm>J2SE</tm> compliant implementation will always set 1333 one of these if <code>JVMTI_THREAD_STATE_WAITING</code> is set). 1334 And if either is set, the enclosing answers 1335 <code>JVMTI_THREAD_STATE_ALIVE</code> and 1336 <code>JVMTI_THREAD_STATE_WAITING</code> are set. 1337 No more than one of 1338 <ul type="circle"> 1339 <li><code>JVMTI_THREAD_STATE_IN_OBJECT_WAIT</code></li> 1340 <li><code>JVMTI_THREAD_STATE_PARKED</code></li> 1341 <li><code>JVMTI_THREAD_STATE_SLEEPING</code></li> 1342 </ul> 1343 can be set. And if any of these is set, the enclosing answers 1344 <code>JVMTI_THREAD_STATE_ALIVE</code> and 1345 <code>JVMTI_THREAD_STATE_WAITING</code> are set. 1346 Also, if <code>JVMTI_THREAD_STATE_SLEEPING</code> is set, 1347 then <code>JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT</code> is set. 1348 If a state <i>A</i> is implemented using the mechanism of 1349 state <i>B</i> then it is state <i>A</i> which 1350 is returned by this function. 1351 For example, if <code>Thread.sleep(long)</code> 1352 is implemented using <code>Object.wait(long)</code> 1353 then it is still <code>JVMTI_THREAD_STATE_SLEEPING</code> 1354 which is returned. 1355 More than one of 1356 <ul type="circle"> 1357 <li><code>JVMTI_THREAD_STATE_SUSPENDED</code></li> 1358 <li><code>JVMTI_THREAD_STATE_INTERRUPTED</code></li> 1359 <li><code>JVMTI_THREAD_STATE_IN_NATIVE</code></li> 1360 </ul> 1361 can be set, but if any is set, 1362 <code>JVMTI_THREAD_STATE_ALIVE</code> is set. 1363 <p/> 1364 And finally, 1365 <code>JVMTI_THREAD_STATE_TERMINATED</code> cannot be set unless 1366 <code>JVMTI_THREAD_STATE_ALIVE</code> is not set. 1367 <p/> 1368 The thread state representation is designed for extension in future versions 1369 of the specification; thread state values should be used accordingly, that is 1370 they should not be used as ordinals. 1371 Most queries can be made by testing a single bit, if use in a switch statement is desired, 1372 the state bits should be masked with the interesting bits. 1373 All bits not defined above are reserved for future use. 1374 A VM, compliant to the current specification, must set reserved bits to zero. 1375 An agent should ignore reserved bits -- 1376 they should not be assumed to be zero and thus should not be included in comparisons. 1377 <p/> 1378 <b>Examples</b> 1379 <p/> 1380 Note that the values below exclude reserved and vendor bits. 1381 <p/> 1382 The state of a thread blocked at a <code>synchronized</code>-statement would be: 1383 <example> 1384 JVMTI_THREAD_STATE_ALIVE + JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER 1385 </example> 1386 The state of a thread which hasn't started yet would be: 1387 <example> 1388 0 1389 </example> 1390 The state of a thread at a <code>Object.wait(3000)</code> would be: 1391 <example> 1392 JVMTI_THREAD_STATE_ALIVE + JVMTI_THREAD_STATE_WAITING + 1393 JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT + 1394 JVMTI_THREAD_STATE_MONITOR_WAITING 1395 </example> 1396 The state of a thread suspended while runnable would be: 1397 <example> 1398 JVMTI_THREAD_STATE_ALIVE + JVMTI_THREAD_STATE_RUNNABLE + JVMTI_THREAD_STATE_SUSPENDED 1399 </example> 1400 <p/> 1401 <b>Testing the State</b> 1402 <p/> 1403 In most cases, the thread state can be determined by testing the one bit corresponding 1404 to that question. For example, the code to test if a thread is sleeping: 1405 <example> 1406 jint state; 1407 jvmtiError err; 1408 1409 err = (*jvmti)->GetThreadState(jvmti, thread, &state); 1410 if (err == JVMTI_ERROR_NONE) { 1411 if (state & JVMTI_THREAD_STATE_SLEEPING) { ... 1412 </example> 1413 <p/> 1414 For waiting (that is, in <code>Object.wait</code>, parked, or sleeping) it would be: 1415 <example> 1416 if (state & JVMTI_THREAD_STATE_WAITING) { ... 1417 </example> 1418 For some states, more than one bit will need to be tested as is the case 1419 when testing if a thread has not yet been started: 1420 <example> 1421 if ((state & (JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_TERMINATED)) == 0) { ... 1422 </example> 1423 To distinguish timed from untimed <code>Object.wait</code>: 1424 <example> 1425 if (state & JVMTI_THREAD_STATE_IN_OBJECT_WAIT) { 1426 if (state & JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT) { 1427 printf("in Object.wait(long timeout)\n"); 1428 } else { 1429 printf("in Object.wait()\n"); 1430 } 1431 } 1432 </example> 1433 <p/> 1434 <b>Relationship to <code>java.lang.Thread.State</code></b> 1435 <p/> 1436 The thread state represented by <code>java.lang.Thread.State</code> 1437 returned from <code>java.lang.Thread.getState()</code> is a subset of the 1438 information returned from this function. 1439 The corresponding <code>java.lang.Thread.State</code> can be determined 1440 by using the provided conversion masks. 1441 For example, this returns the name of the <code>java.lang.Thread.State</code> thread state: 1442 <example> 1443 err = (*jvmti)->GetThreadState(jvmti, thread, &state); 1444 abortOnError(err); 1445 switch (state & JVMTI_JAVA_LANG_THREAD_STATE_MASK) { 1446 case JVMTI_JAVA_LANG_THREAD_STATE_NEW: 1447 return "NEW"; 1448 case JVMTI_JAVA_LANG_THREAD_STATE_TERMINATED: 1449 return "TERMINATED"; 1450 case JVMTI_JAVA_LANG_THREAD_STATE_RUNNABLE: 1451 return "RUNNABLE"; 1452 case JVMTI_JAVA_LANG_THREAD_STATE_BLOCKED: 1453 return "BLOCKED"; 1454 case JVMTI_JAVA_LANG_THREAD_STATE_WAITING: 1455 return "WAITING"; 1456 case JVMTI_JAVA_LANG_THREAD_STATE_TIMED_WAITING: 1457 return "TIMED_WAITING"; 1458 } 1459 </example> 1460 </description> 1461 <origin>new</origin> 1462 <capabilities> 1463 </capabilities> 1464 <parameters> 1465 <param id="thread"> 1466 <jthread null="current" started="maybe" impl="noconvert"/> 1467 <description> 1468 The thread to query. 1469 </description> 1470 </param> 1471 <param id="thread_state_ptr"> 1472 <outptr><jint/></outptr> 1473 <description> 1474 On return, points to state flags, 1475 as defined by the <internallink id="jvmtiThreadState">Thread State Flags</internallink>. 1476 </description> 1477 </param> 1478 </parameters> 1479 <errors> 1480 </errors> 1481 </function> 1482 1483 <function id="GetCurrentThread" phase="start" num="18" since="1.1"> 1484 <synopsis>Get Current Thread</synopsis> 1485 <description> 1486 Get the current thread. 1487 The current thread is the Java programming language thread which has called the function. 1488 The function may return <code>NULL</code> in the start phase if the 1489 <internallink id="jvmtiCapabilities.can_generate_early_vmstart"> 1490 <code>can_generate_early_vmstart</code></internallink> capability is enabled 1491 and the <code>java.lang.Thread</code> class has not been initialized yet. 1492 <p/> 1493 Note that most <jvmti/> functions that take a thread 1494 as an argument will accept <code>NULL</code> to mean 1495 the current thread. 1496 </description> 1497 <origin>new</origin> 1498 <capabilities> 1499 </capabilities> 1500 <parameters> 1501 <param id="thread_ptr"> 1502 <outptr><jthread/></outptr> 1503 <description> 1504 On return, points to the current thread, or <code>NULL</code>. 1505 </description> 1506 </param> 1507 </parameters> 1508 <errors> 1509 </errors> 1510 </function> 1511 1512 <function id="GetAllThreads" num="4"> 1513 <synopsis>Get All Threads</synopsis> 1514 <description> 1515 Get all live threads. 1516 The threads are Java programming language threads; 1517 that is, threads that are attached to the VM. 1518 A thread is live if <code>java.lang.Thread.isAlive()</code> 1519 would return <code>true</code>, that is, the thread has 1520 been started and has not yet died. 1521 The universe of threads is determined by the context of the <jvmti/> 1522 environment, which typically is all threads attached to the VM. 1523 Note that this includes <jvmti/> agent threads 1524 (see <functionlink id="RunAgentThread"/>). 1525 </description> 1526 <origin>jvmdi</origin> 1527 <capabilities> 1528 </capabilities> 1529 <parameters> 1530 <param id="threads_count_ptr"> 1531 <outptr><jint/></outptr> 1532 <description> 1533 On return, points to the number of running threads. 1534 </description> 1535 </param> 1536 <param id="threads_ptr"> 1537 <allocbuf outcount="threads_count_ptr"><jthread/></allocbuf> 1538 <description> 1539 On return, points to an array of references, one 1540 for each running thread. 1541 </description> 1542 </param> 1543 </parameters> 1544 <errors> 1545 </errors> 1546 </function> 1547 1548 <function id="SuspendThread" num="5"> 1549 <synopsis>Suspend Thread</synopsis> 1550 <description> 1551 Suspend the specified thread. If the calling thread is specified, 1552 this function will not return until some other thread calls 1553 <functionlink id="ResumeThread"></functionlink>. 1554 If the thread is currently suspended, this function 1555 does nothing and returns an error. 1556 </description> 1557 <origin>jvmdi</origin> 1558 <capabilities> 1559 <required id="can_suspend"></required> 1560 </capabilities> 1561 <parameters> 1562 <param id="thread"> 1563 <jthread null="current"/> 1564 <description> 1565 The thread to suspend. 1566 </description> 1567 </param> 1568 </parameters> 1569 <errors> 1570 <error id="JVMTI_ERROR_THREAD_SUSPENDED"> 1571 Thread already suspended. 1572 </error> 1573 </errors> 1574 </function> 1575 1576 <elide> 1577 <function id="SuspendAllThreads" num="101"> 1578 <synopsis>Suspend All Threads</synopsis> 1579 <description> 1580 <issue> 1581 There has been no explicit call for this function, and it will 1582 thus be removed if there is no interest. 1583 </issue> 1584 Suspend all live threads except: 1585 <ul> 1586 <li>already suspended threads</li> 1587 <li>those listed in <paramlink id="except_list"></paramlink></li> 1588 <li>certain system (non application) threads, as determined 1589 by the VM implementation</li> 1590 </ul> 1591 The threads are Java programming language threads; 1592 native threads which are not attached to the VM are not 1593 Java programming language threads. 1594 A thread is live if <code>java.lang.Thread.isAlive()</code> 1595 would return <code>true</code>, that is, the thread has 1596 been started and has not yet died. 1597 The universe of threads is determined 1598 by the context of the <jvmti/> 1599 environment, which, typically, is all threads attached to the VM, 1600 except critical VM internal threads and <jvmti/> agent threads 1601 (see <functionlink id="RunAgentThread"/>). 1602 <p/> 1603 If the calling thread is specified, 1604 all other threads are suspended first then the caller thread is suspended - 1605 this function will not return until some other thread calls 1606 <functionlink id="ResumeThread"></functionlink>. 1607 <p/> 1608 The list of actually 1609 suspended threads is returned in 1610 <paramlink id="suspended_list_ptr"></paramlink>. 1611 Suspension is as defined in <functionlink id="SuspendThread"></functionlink>. 1612 <functionlink id="ResumeThreadList"></functionlink> 1613 can be used to resume the suspended threads. 1614 </description> 1615 <origin>new</origin> 1616 <capabilities> 1617 <required id="can_suspend"></required> 1618 </capabilities> 1619 <parameters> 1620 <param id="except_count"> 1621 <jint min="0"/> 1622 <description> 1623 The number of threads in the list of threads not to be suspended. 1624 </description> 1625 </param> 1626 <param id="except_list"> 1627 <inbuf incount="except_count"> 1628 <jthread/> 1629 <nullok>not an error if <code>except_count == 0</code></nullok> 1630 </inbuf> 1631 <description> 1632 The list of threads not to be suspended. 1633 </description> 1634 </param> 1635 <param id="suspended_count_ptr"> 1636 <outptr><jint/></outptr> 1637 <description> 1638 On return, points to the number of threads suspended by this call. 1639 </description> 1640 </param> 1641 <param id="suspended_list_ptr"> 1642 <allocbuf outcount="suspended_count_ptr"><jthread/></allocbuf> 1643 <description> 1644 On return, points to an array of references, one 1645 for each thread suspended. 1646 </description> 1647 </param> 1648 </parameters> 1649 <errors> 1650 <error id="JVMTI_ERROR_INVALID_THREAD"> 1651 A thread in <paramlink id="except_list"></paramlink> was invalid. 1652 </error> 1653 <error id="JVMTI_ERROR_NULL_POINTER"> 1654 Both <paramlink id="except_list"></paramlink> was <code>NULL</code> 1655 and <paramlink id="except_count"></paramlink> was non-zero. 1656 </error> 1657 </errors> 1658 </function> 1659 </elide> 1660 1661 <function id="SuspendThreadList" num="92"> 1662 <synopsis>Suspend Thread List</synopsis> 1663 <description> 1664 Suspend the <paramlink id="request_count"></paramlink> 1665 threads specified in the 1666 <paramlink id="request_list"></paramlink> array. 1667 Threads may be resumed with 1668 <functionlink id="ResumeThreadList"></functionlink> or 1669 <functionlink id="ResumeThread"></functionlink>. 1670 If the calling thread is specified in the 1671 <paramlink id="request_list"></paramlink> array, this function will 1672 not return until some other thread resumes it. 1673 Errors encountered in the suspension of a thread 1674 are returned in the <paramlink id="results"></paramlink> 1675 array, <b>not</b> in the return value of this function. 1676 Threads that are currently suspended do not change state. 1677 </description> 1678 <origin>jvmdi</origin> 1679 <capabilities> 1680 <required id="can_suspend"></required> 1681 </capabilities> 1682 <parameters> 1683 <param id="request_count"> 1684 <jint min="0"/> 1685 <description> 1686 The number of threads to suspend. 1687 </description> 1688 </param> 1689 <param id="request_list"> 1690 <inbuf incount="request_count"><jthread/></inbuf> 1691 <description> 1692 The list of threads to suspend. 1693 </description> 1694 </param> 1695 <param id="results"> 1696 <outbuf incount="request_count"><enum>jvmtiError</enum></outbuf> 1697 <description> 1698 An agent supplied array of 1699 <paramlink id="request_count"></paramlink> elements. 1700 On return, filled with the error code for 1701 the suspend of the corresponding thread. 1702 The error code will be 1703 <errorlink id="JVMTI_ERROR_NONE"></errorlink> 1704 if the thread was suspended by this call. 1705 Possible error codes are those specified 1706 for <functionlink id="SuspendThread"></functionlink>. 1707 </description> 1708 </param> 1709 </parameters> 1710 <errors> 1711 </errors> 1712 </function> 1713 1714 <function id="ResumeThread" num="6"> 1715 <synopsis>Resume Thread</synopsis> 1716 <description> 1717 Resume a suspended thread. 1718 Any threads currently suspended through 1719 a <jvmti/> suspend function (eg. 1720 <functionlink id="SuspendThread"></functionlink>) 1721 or <code>java.lang.Thread.suspend()</code> 1722 will resume execution; 1723 all other threads are unaffected. 1724 </description> 1725 <origin>jvmdi</origin> 1726 <capabilities> 1727 <required id="can_suspend"></required> 1728 </capabilities> 1729 <parameters> 1730 <param id="thread"> 1731 <jthread/> 1732 <description> 1733 The thread to resume. 1734 </description> 1735 </param> 1736 </parameters> 1737 <errors> 1738 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 1739 Thread was not suspended. 1740 </error> 1741 <error id="JVMTI_ERROR_INVALID_TYPESTATE"> 1742 The state of the thread has been modified, and is now inconsistent. 1743 </error> 1744 </errors> 1745 </function> 1746 1747 <function id="ResumeThreadList" num="93"> 1748 <synopsis>Resume Thread List</synopsis> 1749 <description> 1750 Resume the <paramlink id="request_count"></paramlink> 1751 threads specified in the 1752 <paramlink id="request_list"></paramlink> array. 1753 Any thread suspended through 1754 a <jvmti/> suspend function (eg. 1755 <functionlink id="SuspendThreadList"></functionlink>) 1756 or <code>java.lang.Thread.suspend()</code> 1757 will resume execution. 1758 </description> 1759 <origin>jvmdi</origin> 1760 <capabilities> 1761 <required id="can_suspend"></required> 1762 </capabilities> 1763 <parameters> 1764 <param id="request_count"> 1765 <jint min="0"/> 1766 <description> 1767 The number of threads to resume. 1768 </description> 1769 </param> 1770 <param id="request_list"> 1771 <inbuf incount="request_count"><jthread/></inbuf> 1772 <description> 1773 The threads to resume. 1774 </description> 1775 </param> 1776 <param id="results"> 1777 <outbuf incount="request_count"><enum>jvmtiError</enum></outbuf> 1778 <description> 1779 An agent supplied array of 1780 <paramlink id="request_count"></paramlink> elements. 1781 On return, filled with the error code for 1782 the resume of the corresponding thread. 1783 The error code will be 1784 <errorlink id="JVMTI_ERROR_NONE"></errorlink> 1785 if the thread was suspended by this call. 1786 Possible error codes are those specified 1787 for <functionlink id="ResumeThread"></functionlink>. 1788 </description> 1789 </param> 1790 </parameters> 1791 <errors> 1792 </errors> 1793 </function> 1794 1795 <function id="StopThread" num="7"> 1796 <synopsis>Stop Thread</synopsis> 1797 <description> 1798 Send the specified asynchronous exception to the specified thread. 1799 Normally, this function is used to kill the specified thread with an 1800 instance of the exception <code>ThreadDeath</code>, similar to 1801 <code>java.lang.Thread.stop</code>. 1802 </description> 1803 <origin>jvmdi</origin> 1804 <capabilities> 1805 <required id="can_signal_thread"></required> 1806 </capabilities> 1807 <parameters> 1808 <param id="thread"> 1809 <jthread/> 1810 <description> 1811 The thread to stop. 1812 </description> 1813 </param> 1814 <param id="exception"> 1815 <jobject/> 1816 <description> 1817 The asynchronous exception object. 1818 </description> 1819 </param> 1820 </parameters> 1821 <errors> 1822 </errors> 1823 </function> 1824 1825 <function id="InterruptThread" num="8"> 1826 <synopsis>Interrupt Thread</synopsis> 1827 <description> 1828 Interrupt the specified thread 1829 (similar to <code>java.lang.Thread.interrupt</code>). 1830 </description> 1831 <origin>jvmdi</origin> 1832 <capabilities> 1833 <required id="can_signal_thread"></required> 1834 </capabilities> 1835 <parameters> 1836 <param id="thread"> 1837 <jthread impl="noconvert"/> 1838 <description> 1839 The thread to interrupt. 1840 </description> 1841 </param> 1842 </parameters> 1843 <errors> 1844 </errors> 1845 </function> 1846 1847 <function id="GetThreadInfo" num="9"> 1848 <synopsis>Get Thread Info</synopsis> 1849 <typedef id="jvmtiThreadInfo" label="Thread information structure"> 1850 <field id="name"> 1851 <allocfieldbuf><char/></allocfieldbuf> 1852 <description> 1853 The thread name, encoded as a 1854 <internallink id="mUTF">modified UTF-8</internallink> string. 1855 </description> 1856 </field> 1857 <field id="priority"> 1858 <jint/> 1859 <description> 1860 The thread priority. See the thread priority constants: 1861 <datalink id="jvmtiThreadPriority"></datalink>. 1862 </description> 1863 </field> 1864 <field id="is_daemon"> 1865 <jboolean/> 1866 <description> 1867 Is this a daemon thread? 1868 </description> 1869 </field> 1870 <field id="thread_group"> 1871 <jthreadGroup/> 1872 <description> 1873 The thread group to which this thread belongs. 1874 <code>NULL</code> if the thread has died. 1875 </description> 1876 </field> 1877 <field id="context_class_loader"> 1878 <jobject/> 1879 <description> 1880 The context class loader associated with this thread. 1881 </description> 1882 </field> 1883 </typedef> 1884 <description> 1885 Get thread information. The fields of the <datalink id="jvmtiThreadInfo"/> structure 1886 are filled in with details of the specified thread. 1887 </description> 1888 <origin>jvmdi</origin> 1889 <capabilities> 1890 </capabilities> 1891 <parameters> 1892 <param id="thread"> 1893 <jthread null="current" impl="noconvert" started="maybe"/> 1894 <description> 1895 The thread to query. 1896 </description> 1897 </param> 1898 <param id="info_ptr"> 1899 <outptr><struct>jvmtiThreadInfo</struct></outptr> 1900 <description> 1901 On return, filled with information describing the specified thread. 1902 </description> 1903 </param> 1904 </parameters> 1905 <errors> 1906 </errors> 1907 </function> 1908 1909 <function id="GetOwnedMonitorInfo" num="10"> 1910 <synopsis>Get Owned Monitor Info</synopsis> 1911 <description> 1912 Get information about the monitors owned by the 1913 specified thread. 1914 </description> 1915 <origin>jvmdiClone</origin> 1916 <capabilities> 1917 <required id="can_get_owned_monitor_info"></required> 1918 </capabilities> 1919 <parameters> 1920 <param id="thread"> 1921 <jthread null="current"/> 1922 <description> 1923 The thread to query. 1924 </description> 1925 </param> 1926 <param id="owned_monitor_count_ptr"> 1927 <outptr><jint/></outptr> 1928 <description> 1929 The number of monitors returned. 1930 </description> 1931 </param> 1932 <param id="owned_monitors_ptr"> 1933 <allocbuf outcount="owned_monitor_count_ptr"><jobject/></allocbuf> 1934 <description> 1935 The array of owned monitors. 1936 </description> 1937 </param> 1938 </parameters> 1939 <errors> 1940 </errors> 1941 </function> 1942 1943 <function id="GetOwnedMonitorStackDepthInfo" num="153" since="1.1"> 1944 <synopsis>Get Owned Monitor Stack Depth Info</synopsis> 1945 <typedef id="jvmtiMonitorStackDepthInfo" 1946 label="Monitor stack depth information structure"> 1947 <field id="monitor"> 1948 <jobject/> 1949 <description> 1950 The owned monitor. 1951 </description> 1952 </field> 1953 <field id="stack_depth"> 1954 <jint/> 1955 <description> 1956 The stack depth. Corresponds to the stack depth used in the 1957 <internallink id="stack">Stack Frame functions</internallink>. 1958 That is, zero is the current frame, one is the frame which 1959 called the current frame. And it is negative one if the 1960 implementation cannot determine the stack depth (e.g., for 1961 monitors acquired by JNI <code>MonitorEnter</code>). 1962 </description> 1963 </field> 1964 </typedef> 1965 <description> 1966 Get information about the monitors owned by the 1967 specified thread and the depth of the stack frame which locked them. 1968 </description> 1969 <origin>new</origin> 1970 <capabilities> 1971 <required id="can_get_owned_monitor_stack_depth_info"></required> 1972 </capabilities> 1973 <parameters> 1974 <param id="thread"> 1975 <jthread null="current"/> 1976 <description> 1977 The thread to query. 1978 </description> 1979 </param> 1980 <param id="monitor_info_count_ptr"> 1981 <outptr><jint/></outptr> 1982 <description> 1983 The number of monitors returned. 1984 </description> 1985 </param> 1986 <param id="monitor_info_ptr"> 1987 <allocbuf outcount="monitor_info_count_ptr"> 1988 <struct>jvmtiMonitorStackDepthInfo</struct> 1989 </allocbuf> 1990 <description> 1991 The array of owned monitor depth information. 1992 </description> 1993 </param> 1994 </parameters> 1995 <errors> 1996 </errors> 1997 </function> 1998 1999 <function id="GetCurrentContendedMonitor" num="11"> 2000 <synopsis>Get Current Contended Monitor</synopsis> 2001 <description> 2002 Get the object, if any, whose monitor the specified thread is waiting to 2003 enter or waiting to regain through <code>java.lang.Object.wait</code>. 2004 </description> 2005 <origin>jvmdi</origin> 2006 <capabilities> 2007 <required id="can_get_current_contended_monitor"></required> 2008 </capabilities> 2009 <parameters> 2010 <param id="thread"> 2011 <jthread null="current"/> 2012 <description> 2013 The thread to query. 2014 </description> 2015 </param> 2016 <param id="monitor_ptr"> 2017 <outptr><jobject/></outptr> 2018 <description> 2019 On return, filled with the current contended monitor, or 2020 NULL if there is none. 2021 </description> 2022 </param> 2023 </parameters> 2024 <errors> 2025 </errors> 2026 </function> 2027 2028 <callback id="jvmtiStartFunction"> 2029 <void/> 2030 <synopsis>Agent Start Function</synopsis> 2031 <description> 2032 Agent supplied callback function. 2033 This function is the entry point for an agent thread 2034 started with 2035 <functionlink id="RunAgentThread"></functionlink>. 2036 </description> 2037 <parameters> 2038 <param id="jvmti_env"> 2039 <outptr> 2040 <struct>jvmtiEnv</struct> 2041 </outptr> 2042 <description> 2043 The <jvmti/> environment. 2044 </description> 2045 </param> 2046 <param id="jni_env"> 2047 <outptr> 2048 <struct>JNIEnv</struct> 2049 </outptr> 2050 <description> 2051 The JNI environment. 2052 </description> 2053 </param> 2054 <param id="arg"> 2055 <outptr> 2056 <void/> 2057 </outptr> 2058 <description> 2059 The <code>arg</code> parameter passed to 2060 <functionlink id="RunAgentThread"></functionlink>. 2061 </description> 2062 </param> 2063 </parameters> 2064 </callback> 2065 2066 <function id="RunAgentThread" num="12"> 2067 <synopsis>Run Agent Thread</synopsis> 2068 <description> 2069 Starts the execution of an agent thread. with the specified native function. 2070 The parameter <paramlink id="arg"></paramlink> is forwarded on to the 2071 <functionlink id="jvmtiStartFunction">start function</functionlink> 2072 (specified with <paramlink id="proc"></paramlink>) as its single argument. 2073 This function allows the creation of agent threads 2074 for handling communication with another process or for handling events 2075 without the need to load a special subclass of <code>java.lang.Thread</code> or 2076 implementer of <code>java.lang.Runnable</code>. 2077 Instead, the created thread can run entirely in native code. 2078 However, the created thread does require a newly created instance 2079 of <code>java.lang.Thread</code> (referenced by the argument <code>thread</code>) to 2080 which it will be associated. 2081 The thread object can be created with JNI calls. 2082 <p/> 2083 The following common thread priorities are provided for your convenience: 2084 <constants id="jvmtiThreadPriority" label="Thread Priority Constants" kind="const"> 2085 <constant id="JVMTI_THREAD_MIN_PRIORITY" num="1"> 2086 Minimum possible thread priority 2087 </constant> 2088 <constant id="JVMTI_THREAD_NORM_PRIORITY" num="5"> 2089 Normal thread priority 2090 </constant> 2091 <constant id="JVMTI_THREAD_MAX_PRIORITY" num="10"> 2092 Maximum possible thread priority 2093 </constant> 2094 </constants> 2095 <p/> 2096 The new thread is started as a daemon thread with the specified 2097 <paramlink id="priority"></paramlink>. 2098 If enabled, a <eventlink id="ThreadStart"/> event will be sent. 2099 <p/> 2100 Since the thread has been started, the thread will be live when this function 2101 returns, unless the thread has died immediately. 2102 <p/> 2103 The thread group of the thread is ignored -- specifically, the thread is not 2104 added to the thread group and the thread is not seen on queries of the thread 2105 group at either the Java programming language or <jvmti/> levels. 2106 <p/> 2107 The thread is not visible to Java programming language queries but is 2108 included in <jvmti/> queries (for example, 2109 <functionlink id="GetAllThreads"/> and 2110 <functionlink id="GetAllStackTraces"/>). 2111 <p/> 2112 Upon execution of <code>proc</code>, the new thread will be attached to the 2113 VM -- see the JNI documentation on 2114 <externallink id="jni/invocation.html#attaching-to-the-vm" 2115 >Attaching to the VM</externallink>. 2116 </description> 2117 <origin>jvmdiClone</origin> 2118 <capabilities> 2119 </capabilities> 2120 <parameters> 2121 <param id="thread"> 2122 <jthread impl="noconvert" started="no"/> 2123 <description> 2124 The thread to run. 2125 </description> 2126 </param> 2127 <param id="proc"> 2128 <ptrtype> 2129 <struct>jvmtiStartFunction</struct> 2130 </ptrtype> 2131 <description> 2132 The start function. 2133 </description> 2134 </param> 2135 <param id="arg"> 2136 <inbuf> 2137 <void/> 2138 <nullok><code>NULL</code> is passed to the start function</nullok> 2139 </inbuf> 2140 <description> 2141 The argument to the start function. 2142 </description> 2143 </param> 2144 <param id="priority"> 2145 <jint/> 2146 <description> 2147 The priority of the started thread. Any thread 2148 priority allowed by <code>java.lang.Thread.setPriority</code> can be used including 2149 those in <datalink id="jvmtiThreadPriority"></datalink>. 2150 </description> 2151 </param> 2152 </parameters> 2153 <errors> 2154 <error id="JVMTI_ERROR_INVALID_PRIORITY"> 2155 <paramlink id="priority"/> is less than 2156 <datalink id="JVMTI_THREAD_MIN_PRIORITY"/> 2157 or greater than 2158 <datalink id="JVMTI_THREAD_MAX_PRIORITY"/> 2159 </error> 2160 </errors> 2161 </function> 2162 2163 <function id="SetThreadLocalStorage" jkernel="yes" impl="notrace" phase="start" num="103"> 2164 <synopsis>Set Thread Local Storage</synopsis> 2165 <description> 2166 The VM stores a pointer value associated with each environment-thread 2167 pair. This pointer value is called <i>thread-local storage</i>. 2168 This value is <code>NULL</code> unless set with this function. 2169 Agents can allocate memory in which they store thread specific 2170 information. By setting thread-local storage it can then be 2171 accessed with 2172 <functionlink id="GetThreadLocalStorage"></functionlink>. 2173 <p/> 2174 This function is called by the agent to set the value of the <jvmti/> 2175 thread-local storage. <jvmti/> supplies to the agent a pointer-size 2176 thread-local storage that can be used to record per-thread 2177 information. 2178 </description> 2179 <origin>jvmpi</origin> 2180 <capabilities> 2181 </capabilities> 2182 <parameters> 2183 <param id="thread"> 2184 <jthread null="current"/> 2185 <description> 2186 Store to this thread. 2187 </description> 2188 </param> 2189 <param id="data"> 2190 <inbuf> 2191 <void/> 2192 <nullok>value is set to <code>NULL</code></nullok> 2193 </inbuf> 2194 <description> 2195 The value to be entered into the thread-local storage. 2196 </description> 2197 </param> 2198 </parameters> 2199 <errors> 2200 </errors> 2201 </function> 2202 2203 <function id="GetThreadLocalStorage" jkernel="yes" impl="innative notrace" phase="start" num="102"> 2204 <synopsis>Get Thread Local Storage</synopsis> 2205 <description> 2206 Called by the agent to get the value of the <jvmti/> thread-local 2207 storage. 2208 </description> 2209 <origin>jvmpi</origin> 2210 <capabilities> 2211 </capabilities> 2212 <parameters> 2213 <param id="thread"> 2214 <jthread null="current" impl="noconvert"/> 2215 <description> 2216 Retrieve from this thread. 2217 </description> 2218 </param> 2219 <param id="data_ptr"> 2220 <agentbuf><void/></agentbuf> 2221 <description> 2222 Pointer through which the value of the thread local 2223 storage is returned. 2224 If thread-local storage has not been set with 2225 <functionlink id="SetThreadLocalStorage"></functionlink> the returned 2226 pointer is <code>NULL</code>. 2227 </description> 2228 </param> 2229 </parameters> 2230 <errors> 2231 </errors> 2232 </function> 2233 2234 </category> 2235 2236 <category id="thread_groups" label="Thread Group"> 2237 <intro> 2238 </intro> 2239 2240 <function id="GetTopThreadGroups" num="13"> 2241 <synopsis>Get Top Thread Groups</synopsis> 2242 <description> 2243 Return all top-level (parentless) thread groups in the VM. 2244 </description> 2245 <origin>jvmdi</origin> 2246 <capabilities> 2247 </capabilities> 2248 <parameters> 2249 <param id="group_count_ptr"> 2250 <outptr><jint/></outptr> 2251 <description> 2252 On return, points to the number of top-level thread groups. 2253 </description> 2254 </param> 2255 <param id="groups_ptr"> 2256 <allocbuf outcount="group_count_ptr"><jthreadGroup/></allocbuf> 2257 <description> 2258 On return, refers to a pointer to the top-level thread group array. 2259 </description> 2260 </param> 2261 </parameters> 2262 <errors> 2263 </errors> 2264 </function> 2265 2266 <function id="GetThreadGroupInfo" num="14"> 2267 <synopsis>Get Thread Group Info</synopsis> 2268 <typedef id="jvmtiThreadGroupInfo" label="Thread group information structure"> 2269 <field id="parent"> 2270 <jthreadGroup/> 2271 <description> 2272 The parent thread group. 2273 </description> 2274 </field> 2275 <field id="name"> 2276 <allocfieldbuf><char/></allocfieldbuf> 2277 <description> 2278 The thread group's name, encoded as a 2279 <internallink id="mUTF">modified UTF-8</internallink> string. 2280 </description> 2281 </field> 2282 <field id="max_priority"> 2283 <jint/> 2284 <description> 2285 The maximum priority for this thread group. 2286 </description> 2287 </field> 2288 <field id="is_daemon"> 2289 <jboolean/> 2290 <description> 2291 Is this a daemon thread group? 2292 </description> 2293 </field> 2294 </typedef> 2295 <description> 2296 Get information about the thread group. The fields of the 2297 <functionlink id="jvmtiThreadGroupInfo"></functionlink> structure 2298 are filled in with details of the specified thread group. 2299 </description> 2300 <origin>jvmdi</origin> 2301 <capabilities> 2302 </capabilities> 2303 <parameters> 2304 <param id="group"> 2305 <jthreadGroup/> 2306 <description> 2307 The thread group to query. 2308 </description> 2309 </param> 2310 <param id="info_ptr"> 2311 <outptr><struct>jvmtiThreadGroupInfo</struct></outptr> 2312 <description> 2313 On return, filled with information describing the specified 2314 thread group. 2315 </description> 2316 </param> 2317 </parameters> 2318 <errors> 2319 </errors> 2320 </function> 2321 2322 <function id="GetThreadGroupChildren" num="15"> 2323 <synopsis>Get Thread Group Children</synopsis> 2324 <description> 2325 Get the live threads and active subgroups in this thread group. 2326 </description> 2327 <origin>jvmdi</origin> 2328 <capabilities> 2329 </capabilities> 2330 <parameters> 2331 <param id="group"> 2332 <jthreadGroup/> 2333 <description> 2334 The group to query. 2335 </description> 2336 </param> 2337 <param id="thread_count_ptr"> 2338 <outptr><jint/></outptr> 2339 <description> 2340 On return, points to the number of live threads in this thread group. 2341 </description> 2342 </param> 2343 <param id="threads_ptr"> 2344 <allocbuf outcount="thread_count_ptr"><jthread/></allocbuf> 2345 <description> 2346 On return, points to an array of the live threads in this thread group. 2347 </description> 2348 </param> 2349 <param id="group_count_ptr"> 2350 <outptr><jint/></outptr> 2351 <description> 2352 On return, points to the number of active child thread groups 2353 </description> 2354 </param> 2355 <param id="groups_ptr"> 2356 <allocbuf outcount="group_count_ptr"><jthreadGroup/></allocbuf> 2357 <description> 2358 On return, points to an array of the active child thread groups. 2359 </description> 2360 </param> 2361 </parameters> 2362 <errors> 2363 </errors> 2364 </function> 2365 </category> 2366 2367 <category id="stack" label="Stack Frame"> 2368 <intro> 2369 These functions provide information about the stack of a thread. 2370 Stack frames are referenced by depth. 2371 The frame at depth zero is the current frame. 2372 <p/> 2373 Stack frames are as described in 2374 <vmspec chapter="3.6"/>, 2375 That is, they correspond to method 2376 invocations (including native methods) but do not correspond to platform native or 2377 VM internal frames. 2378 <p/> 2379 A <jvmti/> implementation may use method invocations to launch a thread and 2380 the corresponding frames may be included in the stack as presented by these functions -- 2381 that is, there may be frames shown 2382 deeper than <code>main()</code> and <code>run()</code>. 2383 However this presentation must be consistent across all <jvmti/> functionality which 2384 uses stack frames or stack depth. 2385 </intro> 2386 2387 <typedef id="jvmtiFrameInfo" label="Stack frame information structure"> 2388 <description> 2389 Information about a stack frame is returned in this structure. 2390 </description> 2391 <field id="method"> 2392 <jmethodID/> 2393 <description> 2394 The method executing in this frame. 2395 </description> 2396 </field> 2397 <field id="location"> 2398 <jlocation/> 2399 <description> 2400 The index of the instruction executing in this frame. 2401 <code>-1</code> if the frame is executing a native method. 2402 </description> 2403 </field> 2404 </typedef> 2405 2406 <typedef id="jvmtiStackInfo" label="Stack information structure"> 2407 <description> 2408 Information about a set of stack frames is returned in this structure. 2409 </description> 2410 <field id="thread"> 2411 <jthread/> 2412 <description> 2413 On return, the thread traced. 2414 </description> 2415 </field> 2416 <field id="state"> 2417 <jint/> 2418 <description> 2419 On return, the thread state. See <functionlink id="GetThreadState"></functionlink>. 2420 </description> 2421 </field> 2422 <field id="frame_buffer"> 2423 <outbuf incount="max_frame_count"> 2424 <struct>jvmtiFrameInfo</struct> 2425 </outbuf> 2426 <description> 2427 On return, this agent allocated buffer is filled 2428 with stack frame information. 2429 </description> 2430 </field> 2431 <field id="frame_count"> 2432 <jint/> 2433 <description> 2434 On return, the number of records filled into 2435 <code>frame_buffer</code>. 2436 This will be 2437 min(<code>max_frame_count</code>, <i>stackDepth</i>). 2438 </description> 2439 </field> 2440 </typedef> 2441 2442 <function id="GetStackTrace" num="104"> 2443 <synopsis>Get Stack Trace</synopsis> 2444 <description> 2445 Get information about the stack of a thread. 2446 If <paramlink id="max_frame_count"></paramlink> is less than the depth of the stack, 2447 the <paramlink id="max_frame_count"></paramlink> topmost frames are returned, 2448 otherwise the entire stack is returned. 2449 The topmost frames, those most recently invoked, are at the beginning of the returned buffer. 2450 <p/> 2451 The following example causes up to five of the topmost frames 2452 to be returned and (if there are any frames) the currently 2453 executing method name to be printed. 2454 <example> 2455jvmtiFrameInfo frames[5]; 2456jint count; 2457jvmtiError err; 2458 2459err = (*jvmti)->GetStackTrace(jvmti, aThread, 0, 5, 2460 frames, &count); 2461if (err == JVMTI_ERROR_NONE && count >= 1) { 2462 char *methodName; 2463 err = (*jvmti)->GetMethodName(jvmti, frames[0].method, 2464 &methodName, NULL, NULL); 2465 if (err == JVMTI_ERROR_NONE) { 2466 printf("Executing method: %s", methodName); 2467 } 2468} 2469 </example> 2470 <todo> 2471 check example code. 2472 </todo> 2473 <p/> 2474 The <paramlink id="thread"></paramlink> need not be suspended 2475 to call this function. 2476 <p/> 2477 The <functionlink id="GetLineNumberTable"></functionlink> 2478 function can be used to map locations to line numbers. Note that 2479 this mapping can be done lazily. 2480 </description> 2481 <origin>jvmpi</origin> 2482 <capabilities> 2483 </capabilities> 2484 <parameters> 2485 <param id="thread"> 2486 <jthread null="current"/> 2487 <description> 2488 Fetch the stack trace of this thread. 2489 </description> 2490 </param> 2491 <param id="start_depth"> 2492 <jint/> 2493 <description> 2494 Begin retrieving frames at this depth. 2495 If non-negative, count from the current frame, 2496 the first frame retrieved is at depth <code>start_depth</code>. 2497 For example, if zero, start from the current frame; if one, start from the 2498 caller of the current frame; if two, start from the caller of the 2499 caller of the current frame; and so on. 2500 If negative, count from below the oldest frame, 2501 the first frame retrieved is at depth <i>stackDepth</i><code> + start_depth</code>, 2502 where <i>stackDepth</i> is the count of frames on the stack. 2503 For example, if negative one, only the oldest frame is retrieved; 2504 if negative two, start from the frame called by the oldest frame. 2505 </description> 2506 </param> 2507 <param id="max_frame_count"> 2508 <jint min="0"/> 2509 <description> 2510 The maximum number of <datalink id="jvmtiFrameInfo"/> records to retrieve. 2511 </description> 2512 </param> 2513 <param id="frame_buffer"> 2514 <outbuf incount="max_frame_count" outcount="count_ptr"> 2515 <struct>jvmtiFrameInfo</struct> 2516 </outbuf> 2517 <description> 2518 On return, this agent allocated buffer is filled 2519 with stack frame information. 2520 </description> 2521 </param> 2522 <param id="count_ptr"> 2523 <outptr><jint/></outptr> 2524 <description> 2525 On return, points to the number of records filled in. 2526 For non-negative <code>start_depth</code>, this will be 2527 min(<code>max_frame_count</code>, <i>stackDepth</i><code> - start_depth</code>). 2528 For negative <code>start_depth</code>, this will be 2529 min(<code>max_frame_count</code>, <code>-start_depth</code>). 2530 </description> 2531 </param> 2532 </parameters> 2533 <errors> 2534 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 2535 <paramlink id="start_depth"/> is positive and greater than or equal to <i>stackDepth</i>. 2536 Or <paramlink id="start_depth"/> is negative and less than <i>-stackDepth</i>. 2537 </error> 2538 </errors> 2539 </function> 2540 2541 2542 <function id="GetAllStackTraces" num="100"> 2543 <synopsis>Get All Stack Traces</synopsis> 2544 <description> 2545 Get information about the stacks of all live threads 2546 (including <internallink id="RunAgentThread">agent threads</internallink>). 2547 If <paramlink id="max_frame_count"/> is less than the depth of a stack, 2548 the <paramlink id="max_frame_count"/> topmost frames are returned for that thread, 2549 otherwise the entire stack is returned. 2550 The topmost frames, those most recently invoked, are at the beginning of the returned buffer. 2551 <p/> 2552 All stacks are collected simultaneously, that is, no changes will occur to the 2553 thread state or stacks between the sampling of one thread and the next. 2554 The threads need not be suspended. 2555 2556 <example> 2557jvmtiStackInfo *stack_info; 2558jint thread_count; 2559int ti; 2560jvmtiError err; 2561 2562err = (*jvmti)->GetAllStackTraces(jvmti, MAX_FRAMES, &stack_info, &thread_count); 2563if (err != JVMTI_ERROR_NONE) { 2564 ... 2565} 2566for (ti = 0; ti < thread_count; ++ti) { 2567 jvmtiStackInfo *infop = &stack_info[ti]; 2568 jthread thread = infop->thread; 2569 jint state = infop->state; 2570 jvmtiFrameInfo *frames = infop->frame_buffer; 2571 int fi; 2572 2573 myThreadAndStatePrinter(thread, state); 2574 for (fi = 0; fi < infop->frame_count; fi++) { 2575 myFramePrinter(frames[fi].method, frames[fi].location); 2576 } 2577} 2578/* this one Deallocate call frees all data allocated by GetAllStackTraces */ 2579err = (*jvmti)->Deallocate(jvmti, stack_info); 2580 </example> 2581 <todo> 2582 check example code. 2583 </todo> 2584 2585 </description> 2586 <origin>new</origin> 2587 <capabilities> 2588 </capabilities> 2589 <parameters> 2590 <param id="max_frame_count"> 2591 <jint min="0"/> 2592 <description> 2593 The maximum number of <datalink id="jvmtiFrameInfo"/> records to retrieve per thread. 2594 </description> 2595 </param> 2596 <param id="stack_info_ptr"> 2597 <allocbuf> 2598 <struct>jvmtiStackInfo</struct> 2599 </allocbuf> 2600 <description> 2601 On return, this buffer is filled 2602 with stack information for each thread. 2603 The number of <datalink id="jvmtiStackInfo"/> records is determined 2604 by <paramlink id="thread_count_ptr"/>. 2605 <p/> 2606 Note that this buffer is allocated to include the <datalink id="jvmtiFrameInfo"/> 2607 buffers pointed to by <datalink id="jvmtiStackInfo.frame_buffer"/>. 2608 These buffers must not be separately deallocated. 2609 </description> 2610 </param> 2611 <param id="thread_count_ptr"> 2612 <outptr><jint/></outptr> 2613 <description> 2614 The number of threads traced. 2615 </description> 2616 </param> 2617 </parameters> 2618 <errors> 2619 </errors> 2620 </function> 2621 2622 <function id="GetThreadListStackTraces" num="101"> 2623 <synopsis>Get Thread List Stack Traces</synopsis> 2624 <description> 2625 Get information about the stacks of the supplied threads. 2626 If <paramlink id="max_frame_count"/> is less than the depth of a stack, 2627 the <paramlink id="max_frame_count"/> topmost frames are returned for that thread, 2628 otherwise the entire stack is returned. 2629 The topmost frames, those most recently invoked, are at the beginning of the returned buffer. 2630 <p/> 2631 All stacks are collected simultaneously, that is, no changes will occur to the 2632 thread state or stacks between the sampling one thread and the next. 2633 The threads need not be suspended. 2634 <p/> 2635 If a thread has not yet started or terminates before the stack information is collected, 2636 a zero length stack (<datalink id="jvmtiStackInfo.frame_count"/> will be zero) 2637 will be returned and the thread <datalink id="jvmtiStackInfo.state"/> can be checked. 2638 <p/> 2639 See the example for the similar function 2640 <functionlink id="GetAllStackTraces"/>. 2641 </description> 2642 <origin>new</origin> 2643 <capabilities> 2644 </capabilities> 2645 <parameters> 2646 <param id="thread_count"> 2647 <jint min="0"/> 2648 <description> 2649 The number of threads to trace. 2650 </description> 2651 </param> 2652 <param id="thread_list"> 2653 <inbuf incount="thread_count"><jthread/></inbuf> 2654 <description> 2655 The list of threads to trace. 2656 </description> 2657 </param> 2658 <param id="max_frame_count"> 2659 <jint min="0"/> 2660 <description> 2661 The maximum number of <datalink id="jvmtiFrameInfo"/> records to retrieve per thread. 2662 </description> 2663 </param> 2664 <param id="stack_info_ptr"> 2665 <allocbuf outcount="thread_count"> 2666 <struct>jvmtiStackInfo</struct> 2667 </allocbuf> 2668 <description> 2669 On return, this buffer is filled 2670 with stack information for each thread. 2671 The number of <datalink id="jvmtiStackInfo"/> records is determined 2672 by <paramlink id="thread_count"/>. 2673 <p/> 2674 Note that this buffer is allocated to include the <datalink id="jvmtiFrameInfo"/> 2675 buffers pointed to by <datalink id="jvmtiStackInfo.frame_buffer"/>. 2676 These buffers must not be separately deallocated. 2677 </description> 2678 </param> 2679 </parameters> 2680 <errors> 2681 <error id="JVMTI_ERROR_INVALID_THREAD"> 2682 An element in <paramlink id="thread_list"/> is not a thread object. 2683 </error> 2684 </errors> 2685 </function> 2686 2687 <elide> 2688 <function id="AsyncGetStackTrace" num="1000"> 2689 <synopsis>Get Stack Trace--Asynchronous</synopsis> 2690 <description> 2691 Get information about the entire stack of a thread (or a sub-section of it). 2692 This is the asynchronous version of <functionlink id="GetStackTrace"></functionlink> 2693 and is reentrant and safe to call 2694 from asynchronous signal handlers. 2695 The stack trace is returned only for the calling thread. 2696 <p/> 2697 The <functionlink id="GetLineNumberTable"></functionlink> 2698 function can be used to map locations to line numbers. Note that 2699 this mapping can be done lazily. 2700 </description> 2701 <origin>jvmpi</origin> 2702 <capabilities> 2703 <required id="can_get_async_stack_trace"></required> 2704 <capability id="can_show_JVM_spec_async_frames"> 2705 If <code>false</code>, 2706 <paramlink id="use_java_stack"></paramlink> 2707 must be <code>false</code>. 2708 </capability> 2709 </capabilities> 2710 <parameters> 2711 <param id="use_java_stack"> 2712 <jboolean/> 2713 <description> 2714 Return the stack showing <vmspec/> 2715 model of the stack; 2716 otherwise, show the internal representation of the stack with 2717 inlined and optimized methods missing. If the virtual machine 2718 is using the <i>Java Virtual Machine Specification</i> stack model 2719 internally, this flag is ignored. 2720 </description> 2721 </param> 2722 <param id="max_count"> 2723 <jint min="0"/> 2724 <description> 2725 The maximum number of <datalink id="jvmtiFrameInfo"/> records to retrieve. 2726 Retrieve this many unless the stack depth is less than <code>max_count</code>. 2727 </description> 2728 </param> 2729 <param id="frame_buffer"> 2730 <outbuf incount="max_count" outcount="count_ptr"> 2731 <struct>jvmtiFrameInfo</struct> 2732 <nullok>this information is not returned</nullok> 2733 </outbuf> 2734 <description> 2735 The agent passes in a buffer 2736 large enough to hold <code>max_count</code> records of 2737 <datalink id="jvmtiFrameInfo"></datalink>. This buffer must be 2738 pre-allocated by the agent. 2739 </description> 2740 </param> 2741 <param id="count_ptr"> 2742 <outptr><jint/></outptr> 2743 <description> 2744 On return, points to the number of records filled in.. 2745 </description> 2746 </param> 2747 </parameters> 2748 <errors> 2749 <error id="JVMTI_ERROR_UNATTACHED_THREAD"> 2750 The thread being used to call this function is not attached 2751 to the virtual machine. Calls must be made from attached threads. 2752 </error> 2753 </errors> 2754 </function> 2755 </elide> 2756 2757 <function id="GetFrameCount" num="16"> 2758 <synopsis>Get Frame Count</synopsis> 2759 <description> 2760 Get the number of frames currently in the specified thread's call stack. 2761 <p/> 2762 If this function is called for a thread actively executing bytecodes (for example, 2763 not the current thread and not suspended), the information returned is transient. 2764 </description> 2765 <origin>jvmdi</origin> 2766 <capabilities> 2767 </capabilities> 2768 <parameters> 2769 <param id="thread"> 2770 <jthread null="current"/> 2771 <description> 2772 The thread to query. 2773 </description> 2774 </param> 2775 <param id="count_ptr"> 2776 <outptr><jint/></outptr> 2777 <description> 2778 On return, points to the number of frames in the call stack. 2779 </description> 2780 </param> 2781 </parameters> 2782 <errors> 2783 </errors> 2784 </function> 2785 2786 <function id="PopFrame" num="80"> 2787 <synopsis>Pop Frame</synopsis> 2788 <description> 2789 Pop the current frame of <code>thread</code>'s stack. 2790 Popping a frame takes you to the previous frame. 2791 When the thread is resumed, the execution 2792 state of the thread is reset to the state 2793 immediately before the called method was invoked. 2794 That is (using <vmspec/> terminology): 2795 <ul> 2796 <li>the current frame is discarded as the previous frame becomes the current one</li> 2797 <li>the operand stack is restored--the argument values are added back 2798 and if the invoke was not <code>invokestatic</code>, 2799 <code>objectref</code> is added back as well</li> 2800 <li>the Java virtual machine PC is restored to the opcode 2801 of the invoke instruction</li> 2802 </ul> 2803 Note however, that any changes to the arguments, which 2804 occurred in the called method, remain; 2805 when execution continues, the first instruction to 2806 execute will be the invoke. 2807 <p/> 2808 Between calling <code>PopFrame</code> and resuming the 2809 thread the state of the stack is undefined. 2810 To pop frames beyond the first, 2811 these three steps must be repeated: 2812 <ul> 2813 <li>suspend the thread via an event (step, breakpoint, ...)</li> 2814 <li>call <code>PopFrame</code></li> 2815 <li>resume the thread</li> 2816 </ul> 2817 <p/> 2818 A lock acquired by calling the called method 2819 (if it is a <code>synchronized</code> method) 2820 and locks acquired by entering <code>synchronized</code> 2821 blocks within the called method are released. 2822 Note: this does not apply to native locks or 2823 <code>java.util.concurrent.locks</code> locks. 2824 <p/> 2825 Finally blocks are not executed. 2826 <p/> 2827 Changes to global state are not addressed and thus remain changed. 2828 <p/> 2829 The specified thread must be suspended or must be the current thread. 2830 <p/> 2831 Both the called method and calling method must be non-native Java programming 2832 language methods. 2833 <p/> 2834 No <jvmti/> events are generated by this function. 2835 </description> 2836 <origin>jvmdi</origin> 2837 <capabilities> 2838 <required id="can_pop_frame"></required> 2839 </capabilities> 2840 <parameters> 2841 <param id="thread"> 2842 <jthread/> 2843 <description> 2844 The thread whose current frame is to be popped. 2845 </description> 2846 </param> 2847 </parameters> 2848 <errors> 2849 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 2850 Called or calling method is a native method. 2851 The implementation is unable to pop this frame. 2852 </error> 2853 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 2854 Thread was not suspended and was not the current thread. 2855 </error> 2856 <error id="JVMTI_ERROR_NO_MORE_FRAMES"> 2857 There are less than two stack frames on the call stack. 2858 </error> 2859 </errors> 2860 </function> 2861 2862 <function id="GetFrameLocation" num="19"> 2863 <synopsis>Get Frame Location</synopsis> 2864 <description> 2865 <p/> 2866 For a Java programming language frame, return the location of the instruction 2867 currently executing. 2868 </description> 2869 <origin>jvmdiClone</origin> 2870 <capabilities> 2871 </capabilities> 2872 <parameters> 2873 <param id="thread"> 2874 <jthread null="current" frame="frame"/> 2875 <description> 2876 The thread of the frame to query. 2877 </description> 2878 </param> 2879 <param id="depth"> 2880 <jframeID thread="thread"/> 2881 <description> 2882 The depth of the frame to query. 2883 </description> 2884 </param> 2885 <param id="method_ptr"> 2886 <outptr><jmethodID/></outptr> 2887 <description> 2888 On return, points to the method for the current location. 2889 </description> 2890 </param> 2891 <param id="location_ptr"> 2892 <outptr><jlocation/></outptr> 2893 <description> 2894 On return, points to the index of the currently 2895 executing instruction. 2896 Is set to <code>-1</code> if the frame is executing 2897 a native method. 2898 </description> 2899 </param> 2900 </parameters> 2901 <errors> 2902 </errors> 2903 </function> 2904 2905 <function id="NotifyFramePop" num="20"> 2906 <synopsis>Notify Frame Pop</synopsis> 2907 <description> 2908 When the frame that is currently at <paramlink id="depth"></paramlink> 2909 is popped from the stack, generate a 2910 <eventlink id="FramePop"></eventlink> event. See the 2911 <eventlink id="FramePop"></eventlink> event for details. 2912 Only frames corresponding to non-native Java programming language 2913 methods can receive notification. 2914 <p/> 2915 The specified thread must be suspended or must be the current thread. 2916 </description> 2917 <origin>jvmdi</origin> 2918 <capabilities> 2919 <required id="can_generate_frame_pop_events"></required> 2920 </capabilities> 2921 <parameters> 2922 <param id="thread"> 2923 <jthread null="current" frame="depth"/> 2924 <description> 2925 The thread of the frame for which the frame pop event will be generated. 2926 </description> 2927 </param> 2928 <param id="depth"> 2929 <jframeID thread="thread"/> 2930 <description> 2931 The depth of the frame for which the frame pop event will be generated. 2932 </description> 2933 </param> 2934 </parameters> 2935 <errors> 2936 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 2937 The frame at <code>depth</code> is executing a 2938 native method. 2939 </error> 2940 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 2941 Thread was not suspended and was not the current thread. 2942 </error> 2943 </errors> 2944 </function> 2945 2946 </category> 2947 2948 <category id="ForceEarlyReturn" label="Force Early Return"> 2949 <intro> 2950 These functions allow an agent to force a method 2951 to return at any point during its execution. 2952 The method which will return early is referred to as the <i>called method</i>. 2953 The called method is the current method 2954 (as defined by 2955 <vmspec chapter="3.6"/>) 2956 for the specified thread at 2957 the time the function is called. 2958 <p/> 2959 The specified thread must be suspended or must be the current thread. 2960 The return occurs when execution of Java programming 2961 language code is resumed on this thread. 2962 Between calling one of these functions and resumption 2963 of thread execution, the state of the stack is undefined. 2964 <p/> 2965 No further instructions are executed in the called method. 2966 Specifically, finally blocks are not executed. 2967 Note: this can cause inconsistent states in the application. 2968 <p/> 2969 A lock acquired by calling the called method 2970 (if it is a <code>synchronized</code> method) 2971 and locks acquired by entering <code>synchronized</code> 2972 blocks within the called method are released. 2973 Note: this does not apply to native locks or 2974 <code>java.util.concurrent.locks</code> locks. 2975 <p/> 2976 Events, such as <eventlink id="MethodExit"></eventlink>, 2977 are generated as they would be in a normal return. 2978 <p/> 2979 The called method must be a non-native Java programming 2980 language method. 2981 Forcing return on a thread with only one frame on the 2982 stack causes the thread to exit when resumed. 2983 </intro> 2984 2985 <function id="ForceEarlyReturnObject" num="81" since="1.1"> 2986 <synopsis>Force Early Return - Object</synopsis> 2987 <description> 2988 This function can be used to return from a method whose 2989 result type is <code>Object</code> 2990 or a subclass of <code>Object</code>. 2991 </description> 2992 <origin>new</origin> 2993 <capabilities> 2994 <required id="can_force_early_return"></required> 2995 </capabilities> 2996 <parameters> 2997 <param id="thread"> 2998 <jthread null="current"/> 2999 <description> 3000 The thread whose current frame is to return early. 3001 </description> 3002 </param> 3003 <param id="value"> 3004 <jobject/> 3005 <description> 3006 The return value for the called frame. 3007 An object or <code>NULL</code>. 3008 </description> 3009 </param> 3010 </parameters> 3011 <errors> 3012 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 3013 Attempted to return early from a frame 3014 corresponding to a native method. 3015 Or the implementation is unable to provide 3016 this functionality on this frame. 3017 </error> 3018 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 3019 The result type of the called method is not 3020 <code>Object</code> or a subclass of <code>Object</code>. 3021 </error> 3022 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 3023 The supplied <paramlink id="value"/> is not compatible with the 3024 result type of the called method. 3025 </error> 3026 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 3027 Thread was not suspended and was not the current thread. 3028 </error> 3029 <error id="JVMTI_ERROR_NO_MORE_FRAMES"> 3030 There are no more frames on the call stack. 3031 </error> 3032 </errors> 3033 </function> 3034 3035 <function id="ForceEarlyReturnInt" num="82" since="1.1"> 3036 <synopsis>Force Early Return - Int</synopsis> 3037 <description> 3038 This function can be used to return from a method whose 3039 result type is <code>int</code>, <code>short</code>, 3040 <code>char</code>, <code>byte</code>, or 3041 <code>boolean</code>. 3042 </description> 3043 <origin>new</origin> 3044 <capabilities> 3045 <required id="can_force_early_return"></required> 3046 </capabilities> 3047 <parameters> 3048 <param id="thread"> 3049 <jthread null="current"/> 3050 <description> 3051 The thread whose current frame is to return early. 3052 </description> 3053 </param> 3054 <param id="value"> 3055 <jint/> 3056 <description> 3057 The return value for the called frame. 3058 </description> 3059 </param> 3060 </parameters> 3061 <errors> 3062 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 3063 Attempted to return early from a frame 3064 corresponding to a native method. 3065 Or the implementation is unable to provide 3066 this functionality on this frame. 3067 </error> 3068 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 3069 The result type of the called method is not 3070 <code>int</code>, <code>short</code>, 3071 <code>char</code>, <code>byte</code>, or 3072 <code>boolean</code>. 3073 </error> 3074 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 3075 Thread was not suspended and was not the current thread. 3076 </error> 3077 <error id="JVMTI_ERROR_NO_MORE_FRAMES"> 3078 There are no frames on the call stack. 3079 </error> 3080 </errors> 3081 </function> 3082 3083 <function id="ForceEarlyReturnLong" num="83" since="1.1"> 3084 <synopsis>Force Early Return - Long</synopsis> 3085 <description> 3086 This function can be used to return from a method whose 3087 result type is <code>long</code>. 3088 </description> 3089 <origin>new</origin> 3090 <capabilities> 3091 <required id="can_force_early_return"></required> 3092 </capabilities> 3093 <parameters> 3094 <param id="thread"> 3095 <jthread null="current"/> 3096 <description> 3097 The thread whose current frame is to return early. 3098 </description> 3099 </param> 3100 <param id="value"> 3101 <jlong/> 3102 <description> 3103 The return value for the called frame. 3104 </description> 3105 </param> 3106 </parameters> 3107 <errors> 3108 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 3109 Attempted to return early from a frame 3110 corresponding to a native method. 3111 Or the implementation is unable to provide 3112 this functionality on this frame. 3113 </error> 3114 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 3115 The result type of the called method is not <code>long</code>. 3116 </error> 3117 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 3118 Thread was not suspended and was not the current thread. 3119 </error> 3120 <error id="JVMTI_ERROR_NO_MORE_FRAMES"> 3121 There are no frames on the call stack. 3122 </error> 3123 </errors> 3124 </function> 3125 3126 <function id="ForceEarlyReturnFloat" num="84" since="1.1"> 3127 <synopsis>Force Early Return - Float</synopsis> 3128 <description> 3129 This function can be used to return from a method whose 3130 result type is <code>float</code>. 3131 </description> 3132 <origin>new</origin> 3133 <capabilities> 3134 <required id="can_force_early_return"></required> 3135 </capabilities> 3136 <parameters> 3137 <param id="thread"> 3138 <jthread null="current"/> 3139 <description> 3140 The thread whose current frame is to return early. 3141 </description> 3142 </param> 3143 <param id="value"> 3144 <jfloat/> 3145 <description> 3146 The return value for the called frame. 3147 </description> 3148 </param> 3149 </parameters> 3150 <errors> 3151 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 3152 Attempted to return early from a frame 3153 corresponding to a native method. 3154 Or the implementation is unable to provide 3155 this functionality on this frame. 3156 </error> 3157 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 3158 The result type of the called method is not <code>float</code>. 3159 </error> 3160 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 3161 Thread was not suspended and was not the current thread. 3162 </error> 3163 <error id="JVMTI_ERROR_NO_MORE_FRAMES"> 3164 There are no frames on the call stack. 3165 </error> 3166 </errors> 3167 </function> 3168 3169 <function id="ForceEarlyReturnDouble" num="85" since="1.1"> 3170 <synopsis>Force Early Return - Double</synopsis> 3171 <description> 3172 This function can be used to return from a method whose 3173 result type is <code>double</code>. 3174 </description> 3175 <origin>new</origin> 3176 <capabilities> 3177 <required id="can_force_early_return"></required> 3178 </capabilities> 3179 <parameters> 3180 <param id="thread"> 3181 <jthread null="current"/> 3182 <description> 3183 The thread whose current frame is to return early. 3184 </description> 3185 </param> 3186 <param id="value"> 3187 <jdouble/> 3188 <description> 3189 The return value for the called frame. 3190 </description> 3191 </param> 3192 </parameters> 3193 <errors> 3194 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 3195 Attempted to return early from a frame corresponding to a native method. 3196 Or the implementation is unable to provide this functionality on this frame. 3197 </error> 3198 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 3199 The result type of the called method is not <code>double</code>. 3200 </error> 3201 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 3202 Thread was not suspended and was not the current thread. 3203 </error> 3204 <error id="JVMTI_ERROR_NO_MORE_FRAMES"> 3205 There are no frames on the call stack. 3206 </error> 3207 </errors> 3208 </function> 3209 3210 <function id="ForceEarlyReturnVoid" num="86" since="1.1"> 3211 <synopsis>Force Early Return - Void</synopsis> 3212 <description> 3213 This function can be used to return from a method with no result type. 3214 That is, the called method must be declared <code>void</code>. 3215 </description> 3216 <origin>new</origin> 3217 <capabilities> 3218 <required id="can_force_early_return"></required> 3219 </capabilities> 3220 <parameters> 3221 <param id="thread"> 3222 <jthread null="current"/> 3223 <description> 3224 The thread whose current frame is to return early. 3225 </description> 3226 </param> 3227 </parameters> 3228 <errors> 3229 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 3230 Attempted to return early from a frame 3231 corresponding to a native method. 3232 Or the implementation is unable to provide 3233 this functionality on this frame. 3234 </error> 3235 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 3236 The called method has a result type. 3237 </error> 3238 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 3239 Thread was not suspended and was not the current thread. 3240 </error> 3241 <error id="JVMTI_ERROR_NO_MORE_FRAMES"> 3242 There are no frames on the call stack. 3243 </error> 3244 </errors> 3245 </function> 3246 3247 </category> 3248 3249 <category id="Heap" label="Heap"> 3250 <intro> 3251 These functions are used to analyze the heap. 3252 Functionality includes the ability to view the objects in the 3253 heap and to tag these objects. 3254 </intro> 3255 3256 <intro id="objectTags" label="Object Tags"> 3257 A <i>tag</i> is a value associated with an object. 3258 Tags are explicitly set by the agent using the 3259 <functionlink id="SetTag"></functionlink> function or by 3260 callback functions such as <functionlink id="jvmtiHeapIterationCallback"/>. 3261 <p/> 3262 Tags are local to the environment; that is, the tags of one 3263 environment are not visible in another. 3264 <p/> 3265 Tags are <code>jlong</code> values which can be used 3266 simply to mark an object or to store a pointer to more detailed 3267 information. Objects which have not been tagged have a 3268 tag of zero. 3269 Setting a tag to zero makes the object untagged. 3270 </intro> 3271 3272 <intro id="heapCallbacks" label="Heap Callback Functions"> 3273 Heap functions which iterate through the heap and recursively 3274 follow object references use agent supplied callback functions 3275 to deliver the information. 3276 <p/> 3277 These heap callback functions must adhere to the following restrictions -- 3278 These callbacks must not use JNI functions. 3279 These callbacks must not use <jvmti/> functions except 3280 <i>callback safe</i> functions which 3281 specifically allow such use (see the raw monitor, memory management, 3282 and environment local storage functions). 3283 <p/> 3284 An implementation may invoke a callback on an internal thread or 3285 the thread which called the iteration function. 3286 Heap callbacks are single threaded -- no more than one callback will 3287 be invoked at a time. 3288 <p/> 3289 The Heap Filter Flags can be used to prevent reporting 3290 based on the tag status of an object or its class. 3291 If no flags are set (the <code>jint</code> is zero), objects 3292 will not be filtered out. 3293 3294 <constants id="jvmtiHeapFilter" label="Heap Filter Flags" kind="bits"> 3295 <constant id="JVMTI_HEAP_FILTER_TAGGED" num="0x4"> 3296 Filter out tagged objects. Objects which are tagged are not included. 3297 </constant> 3298 <constant id="JVMTI_HEAP_FILTER_UNTAGGED" num="0x8"> 3299 Filter out untagged objects. Objects which are not tagged are not included. 3300 </constant> 3301 <constant id="JVMTI_HEAP_FILTER_CLASS_TAGGED" num="0x10"> 3302 Filter out objects with tagged classes. Objects whose class is tagged are not included. 3303 </constant> 3304 <constant id="JVMTI_HEAP_FILTER_CLASS_UNTAGGED" num="0x20"> 3305 Filter out objects with untagged classes. Objects whose class is not tagged are not included. 3306 </constant> 3307 </constants> 3308 3309 <p/> 3310 The Heap Visit Control Flags are returned by the heap callbacks 3311 and can be used to abort the iteration. For the 3312 <functionlink id="jvmtiHeapReferenceCallback">Heap 3313 Reference Callback</functionlink>, it can also be used 3314 to prune the graph of traversed references 3315 (<code>JVMTI_VISIT_OBJECTS</code> is not set). 3316 3317 <constants id="jvmtiHeapVisitControl" 3318 label="Heap Visit Control Flags" 3319 kind="bits" 3320 since="1.1"> 3321 <constant id="JVMTI_VISIT_OBJECTS" num="0x100"> 3322 If we are visiting an object and if this callback 3323 was initiated by <functionlink id="FollowReferences"/>, 3324 traverse the references of this object. 3325 Otherwise ignored. 3326 </constant> 3327 <constant id="JVMTI_VISIT_ABORT" num="0x8000"> 3328 Abort the iteration. Ignore all other bits. 3329 </constant> 3330 </constants> 3331 3332 <p/> 3333 The Heap Reference Enumeration is provided by the 3334 <functionlink id="jvmtiHeapReferenceCallback">Heap 3335 Reference Callback</functionlink> and 3336 <functionlink id="jvmtiPrimitiveFieldCallback">Primitive Field 3337 Callback</functionlink> to 3338 describe the kind of reference 3339 being reported. 3340 3341 <constants id="jvmtiHeapReferenceKind" 3342 label="Heap Reference Enumeration" 3343 kind="enum" 3344 since="1.1"> 3345 <constant id="JVMTI_HEAP_REFERENCE_CLASS" num="1"> 3346 Reference from an object to its class. 3347 </constant> 3348 <constant id="JVMTI_HEAP_REFERENCE_FIELD" num="2"> 3349 Reference from an object to the value of one of its instance fields. 3350 </constant> 3351 <constant id="JVMTI_HEAP_REFERENCE_ARRAY_ELEMENT" num="3"> 3352 Reference from an array to one of its elements. 3353 </constant> 3354 <constant id="JVMTI_HEAP_REFERENCE_CLASS_LOADER" num="4"> 3355 Reference from a class to its class loader. 3356 </constant> 3357 <constant id="JVMTI_HEAP_REFERENCE_SIGNERS" num="5"> 3358 Reference from a class to its signers array. 3359 </constant> 3360 <constant id="JVMTI_HEAP_REFERENCE_PROTECTION_DOMAIN" num="6"> 3361 Reference from a class to its protection domain. 3362 </constant> 3363 <constant id="JVMTI_HEAP_REFERENCE_INTERFACE" num="7"> 3364 Reference from a class to one of its interfaces. 3365 Note: interfaces are defined via a constant pool reference, 3366 so the referenced interfaces may also be reported with a 3367 <code>JVMTI_HEAP_REFERENCE_CONSTANT_POOL</code> reference kind. 3368 </constant> 3369 <constant id="JVMTI_HEAP_REFERENCE_STATIC_FIELD" num="8"> 3370 Reference from a class to the value of one of its static fields. 3371 </constant> 3372 <constant id="JVMTI_HEAP_REFERENCE_CONSTANT_POOL" num="9"> 3373 Reference from a class to a resolved entry in the constant pool. 3374 </constant> 3375 <constant id="JVMTI_HEAP_REFERENCE_SUPERCLASS" num="10"> 3376 Reference from a class to its superclass. 3377 A callback is not sent if the superclass is <code>java.lang.Object</code>. 3378 Note: loaded classes define superclasses via a constant pool 3379 reference, so the referenced superclass may also be reported with 3380 a <code>JVMTI_HEAP_REFERENCE_CONSTANT_POOL</code> reference kind. 3381 </constant> 3382 <constant id="JVMTI_HEAP_REFERENCE_JNI_GLOBAL" num="21"> 3383 Heap root reference: JNI global reference. 3384 </constant> 3385 <constant id="JVMTI_HEAP_REFERENCE_SYSTEM_CLASS" num="22"> 3386 Heap root reference: System class. 3387 </constant> 3388 <constant id="JVMTI_HEAP_REFERENCE_MONITOR" num="23"> 3389 Heap root reference: monitor. 3390 </constant> 3391 <constant id="JVMTI_HEAP_REFERENCE_STACK_LOCAL" num="24"> 3392 Heap root reference: local variable on the stack. 3393 </constant> 3394 <constant id="JVMTI_HEAP_REFERENCE_JNI_LOCAL" num="25"> 3395 Heap root reference: JNI local reference. 3396 </constant> 3397 <constant id="JVMTI_HEAP_REFERENCE_THREAD" num="26"> 3398 Heap root reference: Thread. 3399 </constant> 3400 <constant id="JVMTI_HEAP_REFERENCE_OTHER" num="27"> 3401 Heap root reference: other heap root reference. 3402 </constant> 3403 </constants> 3404 3405 <p/> 3406 Definitions for the single character type descriptors of 3407 primitive types. 3408 3409 <constants id="jvmtiPrimitiveType" 3410 label="Primitive Type Enumeration" 3411 kind="enum" 3412 since="1.1"> 3413 <constant id="JVMTI_PRIMITIVE_TYPE_BOOLEAN" num="90"> 3414 'Z' - Java programming language <code>boolean</code> - JNI <code>jboolean</code> 3415 </constant> 3416 <constant id="JVMTI_PRIMITIVE_TYPE_BYTE" num="66"> 3417 'B' - Java programming language <code>byte</code> - JNI <code>jbyte</code> 3418 </constant> 3419 <constant id="JVMTI_PRIMITIVE_TYPE_CHAR" num="67"> 3420 'C' - Java programming language <code>char</code> - JNI <code>jchar</code> 3421 </constant> 3422 <constant id="JVMTI_PRIMITIVE_TYPE_SHORT" num="83"> 3423 'S' - Java programming language <code>short</code> - JNI <code>jshort</code> 3424 </constant> 3425 <constant id="JVMTI_PRIMITIVE_TYPE_INT" num="73"> 3426 'I' - Java programming language <code>int</code> - JNI <code>jint</code> 3427 </constant> 3428 <constant id="JVMTI_PRIMITIVE_TYPE_LONG" num="74"> 3429 'J' - Java programming language <code>long</code> - JNI <code>jlong</code> 3430 </constant> 3431 <constant id="JVMTI_PRIMITIVE_TYPE_FLOAT" num="70"> 3432 'F' - Java programming language <code>float</code> - JNI <code>jfloat</code> 3433 </constant> 3434 <constant id="JVMTI_PRIMITIVE_TYPE_DOUBLE" num="68"> 3435 'D' - Java programming language <code>double</code> - JNI <code>jdouble</code> 3436 </constant> 3437 </constants> 3438 </intro> 3439 3440 <typedef id="jvmtiHeapReferenceInfoField" 3441 label="Reference information structure for Field references" 3442 since="1.1"> 3443 <description> 3444 Reference information returned for 3445 <datalink id="JVMTI_HEAP_REFERENCE_FIELD"/> and 3446 <datalink id="JVMTI_HEAP_REFERENCE_STATIC_FIELD"/> references. 3447 </description> 3448 <field id="index"> 3449 <jint/> 3450 <description> 3451 For <datalink id="JVMTI_HEAP_REFERENCE_FIELD"/>, the 3452 referrer object is not a class or an interface. 3453 In this case, <code>index</code> is the index of the field 3454 in the class of the referrer object. 3455 This class is referred to below as <i>C</i>. 3456 <p/> 3457 For <datalink id="JVMTI_HEAP_REFERENCE_STATIC_FIELD"/>, 3458 the referrer object is a class (referred to below as <i>C</i>) 3459 or an interface (referred to below as <i>I</i>). 3460 In this case, <code>index</code> is the index of the field in 3461 that class or interface. 3462 <p/> 3463 If the referrer object is not an interface, then the field 3464 indices are determined as follows: 3465 <ul> 3466 <li>make a list of all the fields in <i>C</i> and its 3467 superclasses, starting with all the fields in 3468 <code>java.lang.Object</code> and ending with all the 3469 fields in <i>C</i>.</li> 3470 <li>Within this list, put 3471 the fields for a given class in the order returned by 3472 <functionlink id="GetClassFields"/>.</li> 3473 <li>Assign the fields in this list indices 3474 <i>n</i>, <i>n</i>+1, ..., in order, where <i>n</i> 3475 is the count of the fields in all the interfaces 3476 implemented by <i>C</i>. 3477 Note that <i>C</i> implements all interfaces 3478 directly implemented by its superclasses; as well 3479 as all superinterfaces of these interfaces.</li> 3480 </ul> 3481 If the referrer object is an interface, then the field 3482 indices are determined as follows: 3483 <ul> 3484 <li>make a list of the fields directly declared in 3485 <i>I</i>.</li> 3486 <li>Within this list, put 3487 the fields in the order returned by 3488 <functionlink id="GetClassFields"/>.</li> 3489 <li>Assign the fields in this list indices 3490 <i>n</i>, <i>n</i>+1, ..., in order, where <i>n</i> 3491 is the count of the fields in all the superinterfaces 3492 of <i>I</i>.</li> 3493 </ul> 3494 All fields are included in this computation, regardless of 3495 field modifier (static, public, private, etc). 3496 <p/> 3497 For example, given the following classes and interfaces: 3498 <example> 3499interface I0 { 3500 int p = 0; 3501} 3502 3503interface I1 extends I0 { 3504 int x = 1; 3505} 3506 3507interface I2 extends I0 { 3508 int y = 2; 3509} 3510 3511class C1 implements I1 { 3512 public static int a = 3; 3513 private int b = 4; 3514} 3515 3516class C2 extends C1 implements I2 { 3517 static int q = 5; 3518 final int r = 6; 3519} 3520 </example> 3521 Assume that <functionlink id="GetClassFields"/> called on 3522 <code>C1</code> returns the fields of <code>C1</code> in the 3523 order: a, b; and that the fields of <code>C2</code> are 3524 returned in the order: q, r. 3525 An instance of class <code>C1</code> will have the 3526 following field indices: 3527 <blockquote><table> 3528 <tr class="bgLight"> 3529 <th class="centered" scope="col">Field</th> 3530 <th class="centered" scope="col">Index</th> 3531 <th scope="col">Description</th> 3532 </tr> 3533 <tr> 3534 <th class="centered" scope="row"> 3535 a 3536 </th> 3537 <td class="centered"> 3538 2 3539 </td> 3540 <td> 3541 The count of the fields in the interfaces 3542 implemented by <code>C1</code> is two (<i>n</i>=2): 3543 <code>p</code> of <code>I0</code> 3544 and <code>x</code> of <code>I1</code>. 3545 </td> 3546 </tr> 3547 <tr> 3548 <th class="centered" scope="row"> 3549 b 3550 </th> 3551 <td class="centered"> 3552 3 3553 </td> 3554 <td> 3555 the subsequent index. 3556 </td> 3557 </tr> 3558 </table></blockquote> 3559 The class <code>C1</code> will have the same field indices. 3560 <p/> 3561 An instance of class <code>C2</code> will have the 3562 following field indices: 3563 <blockquote><table> 3564 <tr class="bgLight"> 3565 <th class="centered" scope="col">Field</th> 3566 <th class="centered" scope="col">Index</th> 3567 <th scope="col">Description</th> 3568 </tr> 3569 <tr> 3570 <th class="centered" scope="row"> 3571 a 3572 </th> 3573 <td class="centered"> 3574 3 3575 </td> 3576 <td> 3577 The count of the fields in the interfaces 3578 implemented by <code>C2</code> is three (<i>n</i>=3): 3579 <code>p</code> of <code>I0</code>, 3580 <code>x</code> of <code>I1</code> and <code>y</code> of <code>I2</code> 3581 (an interface of <code>C2</code>). Note that the field <code>p</code> 3582 of <code>I0</code> is only included once. 3583 </td> 3584 </tr> 3585 <tr> 3586 <th class="centered" scope="row"> 3587 b 3588 </th> 3589 <td class="centered"> 3590 4 3591 </td> 3592 <td> 3593 the subsequent index to "a". 3594 </td> 3595 </tr> 3596 <tr> 3597 <th class="centered" scope="row"> 3598 q 3599 </th> 3600 <td class="centered"> 3601 5 3602 </td> 3603 <td> 3604 the subsequent index to "b". 3605 </td> 3606 </tr> 3607 <tr> 3608 <th class="centered" scope="row"> 3609 r 3610 </th> 3611 <td class="centered"> 3612 6 3613 </td> 3614 <td> 3615 the subsequent index to "q". 3616 </td> 3617 </tr> 3618 </table></blockquote> 3619 The class <code>C2</code> will have the same field indices. 3620 Note that a field may have a different index depending on the 3621 object that is viewing it -- for example field "a" above. 3622 Note also: not all field indices may be visible from the 3623 callbacks, but all indices are shown for illustrative purposes. 3624 <p/> 3625 The interface <code>I1</code> will have the 3626 following field indices: 3627 <blockquote><table> 3628 <tr class="bgLight"> 3629 <th class="centered" scope="col">Field</th> 3630 <th class="centered" scope="col">Index</th> 3631 <th scope="col">Description</th> 3632 </tr> 3633 <tr> 3634 <th class="centered" scope="row"> 3635 x 3636 </th> 3637 <td class="centered"> 3638 1 3639 </td> 3640 <td> 3641 The count of the fields in the superinterfaces 3642 of <code>I1</code> is one (<i>n</i>=1): 3643 <code>p</code> of <code>I0</code>. 3644 </td> 3645 </tr> 3646 </table></blockquote> 3647 </description> 3648 </field> 3649 </typedef> 3650 3651 <typedef id="jvmtiHeapReferenceInfoArray" 3652 label="Reference information structure for Array references" 3653 since="1.1"> 3654 <description> 3655 Reference information returned for 3656 <datalink id="JVMTI_HEAP_REFERENCE_ARRAY_ELEMENT"/> references. 3657 </description> 3658 <field id="index"> 3659 <jint/> 3660 <description> 3661 The array index. 3662 </description> 3663 </field> 3664 </typedef> 3665 3666 <typedef id="jvmtiHeapReferenceInfoConstantPool" 3667 label="Reference information structure for Constant Pool references" 3668 since="1.1"> 3669 <description> 3670 Reference information returned for 3671 <datalink id="JVMTI_HEAP_REFERENCE_CONSTANT_POOL"/> references. 3672 </description> 3673 <field id="index"> 3674 <jint/> 3675 <description> 3676 The index into the constant pool of the class. See the description in 3677 <vmspec chapter="4.4"/>. 3678 </description> 3679 </field> 3680 </typedef> 3681 3682 <typedef id="jvmtiHeapReferenceInfoStackLocal" 3683 label="Reference information structure for Local Variable references" 3684 since="1.1"> 3685 <description> 3686 Reference information returned for 3687 <datalink id="JVMTI_HEAP_REFERENCE_STACK_LOCAL"/> references. 3688 </description> 3689 <field id="thread_tag"> 3690 <jlong/> 3691 <description> 3692 The tag of the thread corresponding to this stack, zero if not tagged. 3693 </description> 3694 </field> 3695 <field id="thread_id"> 3696 <jlong/> 3697 <description> 3698 The unique thread ID of the thread corresponding to this stack. 3699 </description> 3700 </field> 3701 <field id="depth"> 3702 <jint/> 3703 <description> 3704 The depth of the frame. 3705 </description> 3706 </field> 3707 <field id="method"> 3708 <jmethodID/> 3709 <description> 3710 The method executing in this frame. 3711 </description> 3712 </field> 3713 <field id="location"> 3714 <jlocation/> 3715 <description> 3716 The currently executing location in this frame. 3717 </description> 3718 </field> 3719 <field id="slot"> 3720 <jint/> 3721 <description> 3722 The slot number of the local variable. 3723 </description> 3724 </field> 3725 </typedef> 3726 3727 <typedef id="jvmtiHeapReferenceInfoJniLocal" 3728 label="Reference information structure for JNI local references" 3729 since="1.1"> 3730 <description> 3731 Reference information returned for 3732 <datalink id="JVMTI_HEAP_REFERENCE_JNI_LOCAL"/> references. 3733 </description> 3734 <field id="thread_tag"> 3735 <jlong/> 3736 <description> 3737 The tag of the thread corresponding to this stack, zero if not tagged. 3738 </description> 3739 </field> 3740 <field id="thread_id"> 3741 <jlong/> 3742 <description> 3743 The unique thread ID of the thread corresponding to this stack. 3744 </description> 3745 </field> 3746 <field id="depth"> 3747 <jint/> 3748 <description> 3749 The depth of the frame. 3750 </description> 3751 </field> 3752 <field id="method"> 3753 <jmethodID/> 3754 <description> 3755 The method executing in this frame. 3756 </description> 3757 </field> 3758 </typedef> 3759 3760 <typedef id="jvmtiHeapReferenceInfoReserved" 3761 label="Reference information structure for Other references" 3762 since="1.1"> 3763 <description> 3764 Reference information returned for other references. 3765 </description> 3766 <field id="reserved1"> 3767 <jlong/> 3768 <description> 3769 reserved for future use. 3770 </description> 3771 </field> 3772 <field id="reserved2"> 3773 <jlong/> 3774 <description> 3775 reserved for future use. 3776 </description> 3777 </field> 3778 <field id="reserved3"> 3779 <jlong/> 3780 <description> 3781 reserved for future use. 3782 </description> 3783 </field> 3784 <field id="reserved4"> 3785 <jlong/> 3786 <description> 3787 reserved for future use. 3788 </description> 3789 </field> 3790 <field id="reserved5"> 3791 <jlong/> 3792 <description> 3793 reserved for future use. 3794 </description> 3795 </field> 3796 <field id="reserved6"> 3797 <jlong/> 3798 <description> 3799 reserved for future use. 3800 </description> 3801 </field> 3802 <field id="reserved7"> 3803 <jlong/> 3804 <description> 3805 reserved for future use. 3806 </description> 3807 </field> 3808 <field id="reserved8"> 3809 <jlong/> 3810 <description> 3811 reserved for future use. 3812 </description> 3813 </field> 3814 </typedef> 3815 3816 <uniontypedef id="jvmtiHeapReferenceInfo" 3817 label="Reference information structure" 3818 since="1.1"> 3819 <description> 3820 The information returned about referrers. 3821 Represented as a union of the various kinds of reference information. 3822 </description> 3823 <field id="field"> 3824 <struct>jvmtiHeapReferenceInfoField</struct> 3825 <description> 3826 The referrer information for 3827 <datalink id="JVMTI_HEAP_REFERENCE_FIELD"/> 3828 and <datalink id="JVMTI_HEAP_REFERENCE_STATIC_FIELD"/> references. 3829 </description> 3830 </field> 3831 <field id="array"> 3832 <struct>jvmtiHeapReferenceInfoArray</struct> 3833 <description> 3834 The referrer information for 3835 For <datalink id="JVMTI_HEAP_REFERENCE_ARRAY_ELEMENT"/> references. 3836 </description> 3837 </field> 3838 <field id="constant_pool"> 3839 <struct>jvmtiHeapReferenceInfoConstantPool</struct> 3840 <description> 3841 The referrer information for 3842 For <datalink id="JVMTI_HEAP_REFERENCE_CONSTANT_POOL"/> references. 3843 </description> 3844 </field> 3845 <field id="stack_local"> 3846 <struct>jvmtiHeapReferenceInfoStackLocal</struct> 3847 <description> 3848 The referrer information for 3849 For <datalink id="JVMTI_HEAP_REFERENCE_STACK_LOCAL"/> references. 3850 </description> 3851 </field> 3852 <field id="jni_local"> 3853 <struct>jvmtiHeapReferenceInfoJniLocal</struct> 3854 <description> 3855 The referrer information for 3856 For <datalink id="JVMTI_HEAP_REFERENCE_JNI_LOCAL"/> references. 3857 </description> 3858 </field> 3859 <field id="other"> 3860 <struct>jvmtiHeapReferenceInfoReserved</struct> 3861 <description> 3862 reserved for future use. 3863 </description> 3864 </field> 3865 </uniontypedef> 3866 3867 <typedef id="jvmtiHeapCallbacks" 3868 label="Heap callback function structure" 3869 since="1.1"> 3870 <field id="heap_iteration_callback"> 3871 <ptrtype> 3872 <struct>jvmtiHeapIterationCallback</struct> 3873 </ptrtype> 3874 <description> 3875 The callback to be called to describe an 3876 object in the heap. Used by the 3877 <functionlink id="IterateThroughHeap"/> function, ignored by the 3878 <functionlink id="FollowReferences"/> function. 3879 </description> 3880 </field> 3881 <field id="heap_reference_callback"> 3882 <ptrtype> 3883 <struct>jvmtiHeapReferenceCallback</struct> 3884 </ptrtype> 3885 <description> 3886 The callback to be called to describe an 3887 object reference. Used by the 3888 <functionlink id="FollowReferences"/> function, ignored by the 3889 <functionlink id="IterateThroughHeap"/> function. 3890 </description> 3891 </field> 3892 <field id="primitive_field_callback"> 3893 <ptrtype> 3894 <struct>jvmtiPrimitiveFieldCallback</struct> 3895 </ptrtype> 3896 <description> 3897 The callback to be called to describe a 3898 primitive field. 3899 </description> 3900 </field> 3901 <field id="array_primitive_value_callback"> 3902 <ptrtype> 3903 <struct>jvmtiArrayPrimitiveValueCallback</struct> 3904 </ptrtype> 3905 <description> 3906 The callback to be called to describe an 3907 array of primitive values. 3908 </description> 3909 </field> 3910 <field id="string_primitive_value_callback"> 3911 <ptrtype> 3912 <struct>jvmtiStringPrimitiveValueCallback</struct> 3913 </ptrtype> 3914 <description> 3915 The callback to be called to describe a String value. 3916 </description> 3917 </field> 3918 <field id="reserved5"> 3919 <ptrtype> 3920 <struct>jvmtiReservedCallback</struct> 3921 </ptrtype> 3922 <description> 3923 Reserved for future use.. 3924 </description> 3925 </field> 3926 <field id="reserved6"> 3927 <ptrtype> 3928 <struct>jvmtiReservedCallback</struct> 3929 </ptrtype> 3930 <description> 3931 Reserved for future use.. 3932 </description> 3933 </field> 3934 <field id="reserved7"> 3935 <ptrtype> 3936 <struct>jvmtiReservedCallback</struct> 3937 </ptrtype> 3938 <description> 3939 Reserved for future use.. 3940 </description> 3941 </field> 3942 <field id="reserved8"> 3943 <ptrtype> 3944 <struct>jvmtiReservedCallback</struct> 3945 </ptrtype> 3946 <description> 3947 Reserved for future use.. 3948 </description> 3949 </field> 3950 <field id="reserved9"> 3951 <ptrtype> 3952 <struct>jvmtiReservedCallback</struct> 3953 </ptrtype> 3954 <description> 3955 Reserved for future use.. 3956 </description> 3957 </field> 3958 <field id="reserved10"> 3959 <ptrtype> 3960 <struct>jvmtiReservedCallback</struct> 3961 </ptrtype> 3962 <description> 3963 Reserved for future use.. 3964 </description> 3965 </field> 3966 <field id="reserved11"> 3967 <ptrtype> 3968 <struct>jvmtiReservedCallback</struct> 3969 </ptrtype> 3970 <description> 3971 Reserved for future use.. 3972 </description> 3973 </field> 3974 <field id="reserved12"> 3975 <ptrtype> 3976 <struct>jvmtiReservedCallback</struct> 3977 </ptrtype> 3978 <description> 3979 Reserved for future use.. 3980 </description> 3981 </field> 3982 <field id="reserved13"> 3983 <ptrtype> 3984 <struct>jvmtiReservedCallback</struct> 3985 </ptrtype> 3986 <description> 3987 Reserved for future use.. 3988 </description> 3989 </field> 3990 <field id="reserved14"> 3991 <ptrtype> 3992 <struct>jvmtiReservedCallback</struct> 3993 </ptrtype> 3994 <description> 3995 Reserved for future use.. 3996 </description> 3997 </field> 3998 <field id="reserved15"> 3999 <ptrtype> 4000 <struct>jvmtiReservedCallback</struct> 4001 </ptrtype> 4002 <description> 4003 Reserved for future use.. 4004 </description> 4005 </field> 4006 </typedef> 4007 4008 4009 <intro> 4010 <rationale> 4011 The heap dumping functionality (below) uses a callback 4012 for each object. While it would seem that a buffered approach 4013 would provide better throughput, tests do 4014 not show this to be the case--possibly due to locality of 4015 memory reference or array access overhead. 4016 </rationale> 4017 4018 <issue> 4019 Still under investigation as to if java.lang.ref references 4020 are reported as a different type of reference. 4021 </issue> 4022 4023 <issue> 4024 Should or can an indication of the cost or relative cost of 4025 these operations be included? 4026 </issue> 4027 4028 </intro> 4029 4030 <callback id="jvmtiHeapIterationCallback" since="1.1"> 4031 <jint/> 4032 <synopsis>Heap Iteration Callback</synopsis> 4033 <description> 4034 Agent supplied callback function. 4035 Describes (but does not pass in) an object in the heap. 4036 <p/> 4037 This function should return a bit vector of the desired 4038 <datalink id="jvmtiHeapVisitControl">visit control flags</datalink>. 4039 This will determine if the entire iteration should be aborted 4040 (the <code>JVMTI_VISIT_OBJECTS</code> flag is ignored). 4041 <p/> 4042 See the <internallink id="heapCallbacks">heap callback 4043 function restrictions</internallink>. 4044 </description> 4045 <parameters> 4046 <param id="class_tag"> 4047 <jlong/> 4048 <description> 4049 The tag of the class of object (zero if the class is not tagged). 4050 If the object represents a runtime class, 4051 the <code>class_tag</code> is the tag 4052 associated with <code>java.lang.Class</code> 4053 (zero if <code>java.lang.Class</code> is not tagged). 4054 </description> 4055 </param> 4056 <param id="size"> 4057 <jlong/> 4058 <description> 4059 Size of the object (in bytes). See <functionlink id="GetObjectSize"/>. 4060 </description> 4061 </param> 4062 <param id="tag_ptr"> 4063 <outptr><jlong/></outptr> 4064 <description> 4065 The object tag value, or zero if the object is not tagged. 4066 To set the tag value to be associated with the object 4067 the agent sets the <code>jlong</code> pointed to by the parameter. 4068 </description> 4069 </param> 4070 <param id="length"> 4071 <jint/> 4072 <description> 4073 If this object is an array, the length of the array. Otherwise negative one (-1). 4074 </description> 4075 </param> 4076 <param id="user_data"> 4077 <outptr><void/></outptr> 4078 <description> 4079 The user supplied data that was passed into the iteration function. 4080 </description> 4081 </param> 4082 </parameters> 4083 </callback> 4084 4085 <callback id="jvmtiHeapReferenceCallback" since="1.1"> 4086 <jint/> 4087 <synopsis>Heap Reference Callback</synopsis> 4088 <description> 4089 Agent supplied callback function. 4090 Describes a reference from an object or the VM (the referrer) to another object 4091 (the referree) or a heap root to a referree. 4092 <p/> 4093 This function should return a bit vector of the desired 4094 <datalink id="jvmtiHeapVisitControl">visit control flags</datalink>. 4095 This will determine if the objects referenced by the referree 4096 should be visited or if the entire iteration should be aborted. 4097 <p/> 4098 See the <internallink id="heapCallbacks">heap callback 4099 function restrictions</internallink>. 4100 </description> 4101 <parameters> 4102 <param id="reference_kind"> 4103 <enum>jvmtiHeapReferenceKind</enum> 4104 <description> 4105 The kind of reference. 4106 </description> 4107 </param> 4108 <param id="reference_info"> 4109 <inptr> 4110 <struct>jvmtiHeapReferenceInfo</struct> 4111 </inptr> 4112 <description> 4113 Details about the reference. 4114 Set when the <datalink id="jvmtiHeapReferenceCallback.reference_kind">reference_kind</datalink> is 4115 <datalink id="JVMTI_HEAP_REFERENCE_FIELD"/>, 4116 <datalink id="JVMTI_HEAP_REFERENCE_STATIC_FIELD"/>, 4117 <datalink id="JVMTI_HEAP_REFERENCE_ARRAY_ELEMENT"/>, 4118 <datalink id="JVMTI_HEAP_REFERENCE_CONSTANT_POOL"/>, 4119 <datalink id="JVMTI_HEAP_REFERENCE_STACK_LOCAL"/>, 4120 or <datalink id="JVMTI_HEAP_REFERENCE_JNI_LOCAL"/>. 4121 Otherwise <code>NULL</code>. 4122 </description> 4123 </param> 4124 <param id="class_tag"> 4125 <jlong/> 4126 <description> 4127 The tag of the class of referree object (zero if the class is not tagged). 4128 If the referree object represents a runtime class, 4129 the <code>class_tag</code> is the tag 4130 associated with <code>java.lang.Class</code> 4131 (zero if <code>java.lang.Class</code> is not tagged). 4132 </description> 4133 </param> 4134 <param id="referrer_class_tag"> 4135 <jlong/> 4136 <description> 4137 The tag of the class of the referrer object (zero if the class is not tagged 4138 or the referree is a heap root). If the referrer object represents a runtime 4139 class, the <code>referrer_class_tag</code> is the tag associated with 4140 the <code>java.lang.Class</code> 4141 (zero if <code>java.lang.Class</code> is not tagged). 4142 </description> 4143 </param> 4144 <param id="size"> 4145 <jlong/> 4146 <description> 4147 Size of the referree object (in bytes). 4148 See <functionlink id="GetObjectSize"/>. 4149 </description> 4150 </param> 4151 <param id="tag_ptr"> 4152 <outptr><jlong/></outptr> 4153 <description> 4154 Points to the referree object tag value, or zero if the object is not 4155 tagged. 4156 To set the tag value to be associated with the object 4157 the agent sets the <code>jlong</code> pointed to by the parameter. 4158 </description> 4159 </param> 4160 <param id="referrer_tag_ptr"> 4161 <outptr><jlong/></outptr> 4162 <description> 4163 Points to the tag of the referrer object, or 4164 points to the zero if the referrer 4165 object is not tagged. 4166 <code>NULL</code> if the referrer in not an object (that is, 4167 this callback is reporting a heap root). 4168 To set the tag value to be associated with the referrer object 4169 the agent sets the <code>jlong</code> pointed to by the parameter. 4170 If this callback is reporting a reference from an object to itself, 4171 <code>referrer_tag_ptr == tag_ptr</code>. 4172 </description> 4173 </param> 4174 <param id="length"> 4175 <jint/> 4176 <description> 4177 If this object is an array, the length of the array. Otherwise negative one (-1). 4178 </description> 4179 </param> 4180 <param id="user_data"> 4181 <outptr><void/></outptr> 4182 <description> 4183 The user supplied data that was passed into the iteration function. 4184 </description> 4185 </param> 4186 </parameters> 4187 </callback> 4188 4189 <callback id="jvmtiPrimitiveFieldCallback" since="1.1"> 4190 <jint/> 4191 <synopsis>Primitive Field Callback</synopsis> 4192 <description> 4193 Agent supplied callback function which 4194 describes a primitive field of an object (<i>the object</i>). 4195 A primitive field is a field whose type is a primitive type. 4196 This callback will describe a static field if the object is a class, 4197 and otherwise will describe an instance field. 4198 <p/> 4199 This function should return a bit vector of the desired 4200 <datalink id="jvmtiHeapVisitControl">visit control flags</datalink>. 4201 This will determine if the entire iteration should be aborted 4202 (the <code>JVMTI_VISIT_OBJECTS</code> flag is ignored). 4203 <p/> 4204 See the <internallink id="heapCallbacks">heap callback 4205 function restrictions</internallink>. 4206 </description> 4207 <parameters> 4208 <param id="kind"> 4209 <enum>jvmtiHeapReferenceKind</enum> 4210 <description> 4211 The kind of field -- instance or static (<datalink id="JVMTI_HEAP_REFERENCE_FIELD"/> or 4212 <datalink id="JVMTI_HEAP_REFERENCE_STATIC_FIELD"/>). 4213 </description> 4214 </param> 4215 <param id="info"> 4216 <inptr> 4217 <struct>jvmtiHeapReferenceInfo</struct> 4218 </inptr> 4219 <description> 4220 Which field (the field index). 4221 </description> 4222 </param> 4223 <param id="object_class_tag"> 4224 <jlong/> 4225 <description> 4226 The tag of the class of the object (zero if the class is not tagged). 4227 If the object represents a runtime class, the 4228 <code>object_class_tag</code> is the tag 4229 associated with <code>java.lang.Class</code> 4230 (zero if <code>java.lang.Class</code> is not tagged). 4231 </description> 4232 </param> 4233 <param id="object_tag_ptr"> 4234 <outptr><jlong/></outptr> 4235 <description> 4236 Points to the tag of the object, or zero if the object is not 4237 tagged. 4238 To set the tag value to be associated with the object 4239 the agent sets the <code>jlong</code> pointed to by the parameter. 4240 </description> 4241 </param> 4242 <param id="value"> 4243 <jvalue/> 4244 <description> 4245 The value of the field. 4246 </description> 4247 </param> 4248 <param id="value_type"> 4249 <enum>jvmtiPrimitiveType</enum> 4250 <description> 4251 The type of the field. 4252 </description> 4253 </param> 4254 <param id="user_data"> 4255 <outptr><void/></outptr> 4256 <description> 4257 The user supplied data that was passed into the iteration function. 4258 </description> 4259 </param> 4260 </parameters> 4261 </callback> 4262 4263 <callback id="jvmtiArrayPrimitiveValueCallback" since="1.1"> 4264 <jint/> 4265 <synopsis>Array Primitive Value Callback</synopsis> 4266 <description> 4267 Agent supplied callback function. 4268 Describes the values in an array of a primitive type. 4269 <p/> 4270 This function should return a bit vector of the desired 4271 <datalink id="jvmtiHeapVisitControl">visit control flags</datalink>. 4272 This will determine if the entire iteration should be aborted 4273 (the <code>JVMTI_VISIT_OBJECTS</code> flag is ignored). 4274 <p/> 4275 See the <internallink id="heapCallbacks">heap callback 4276 function restrictions</internallink>. 4277 </description> 4278 <parameters> 4279 <param id="class_tag"> 4280 <jlong/> 4281 <description> 4282 The tag of the class of the array object (zero if the class is not tagged). 4283 </description> 4284 </param> 4285 <param id="size"> 4286 <jlong/> 4287 <description> 4288 Size of the array (in bytes). 4289 See <functionlink id="GetObjectSize"/>. 4290 </description> 4291 </param> 4292 <param id="tag_ptr"> 4293 <outptr><jlong/></outptr> 4294 <description> 4295 Points to the tag of the array object, or zero if the object is not 4296 tagged. 4297 To set the tag value to be associated with the object 4298 the agent sets the <code>jlong</code> pointed to by the parameter. 4299 </description> 4300 </param> 4301 <param id="element_count"> 4302 <jint/> 4303 <description> 4304 The length of the primitive array. 4305 </description> 4306 </param> 4307 <param id="element_type"> 4308 <enum>jvmtiPrimitiveType</enum> 4309 <description> 4310 The type of the elements of the array. 4311 </description> 4312 </param> 4313 <param id="elements"> 4314 <vmbuf><void/></vmbuf> 4315 <description> 4316 The elements of the array in a packed array of <code>element_count</code> 4317 items of <code>element_type</code> size each. 4318 </description> 4319 </param> 4320 <param id="user_data"> 4321 <outptr><void/></outptr> 4322 <description> 4323 The user supplied data that was passed into the iteration function. 4324 </description> 4325 </param> 4326 </parameters> 4327 </callback> 4328 4329 <callback id="jvmtiStringPrimitiveValueCallback" since="1.1"> 4330 <jint/> 4331 <synopsis>String Primitive Value Callback</synopsis> 4332 <description> 4333 Agent supplied callback function. 4334 Describes the value of a java.lang.String. 4335 <p/> 4336 This function should return a bit vector of the desired 4337 <datalink id="jvmtiHeapVisitControl">visit control flags</datalink>. 4338 This will determine if the entire iteration should be aborted 4339 (the <code>JVMTI_VISIT_OBJECTS</code> flag is ignored). 4340 <p/> 4341 See the <internallink id="heapCallbacks">heap callback 4342 function restrictions</internallink>. 4343 </description> 4344 <parameters> 4345 <param id="class_tag"> 4346 <jlong/> 4347 <description> 4348 The tag of the class of the String class (zero if the class is not tagged). 4349 <issue>Is this needed?</issue> 4350 </description> 4351 </param> 4352 <param id="size"> 4353 <jlong/> 4354 <description> 4355 Size of the string (in bytes). 4356 See <functionlink id="GetObjectSize"/>. 4357 </description> 4358 </param> 4359 <param id="tag_ptr"> 4360 <outptr><jlong/></outptr> 4361 <description> 4362 Points to the tag of the String object, or zero if the object is not 4363 tagged. 4364 To set the tag value to be associated with the object 4365 the agent sets the <code>jlong</code> pointed to by the parameter. 4366 </description> 4367 </param> 4368 <param id="value"> 4369 <vmbuf><jchar/></vmbuf> 4370 <description> 4371 The value of the String, encoded as a Unicode string. 4372 </description> 4373 </param> 4374 <param id="value_length"> 4375 <jint/> 4376 <description> 4377 The length of the string. 4378 The length is equal to the number of 16-bit Unicode 4379 characters in the string. 4380 </description> 4381 </param> 4382 <param id="user_data"> 4383 <outptr><void/></outptr> 4384 <description> 4385 The user supplied data that was passed into the iteration function. 4386 </description> 4387 </param> 4388 </parameters> 4389 </callback> 4390 4391 4392 <callback id="jvmtiReservedCallback" since="1.1"> 4393 <jint/> 4394 <synopsis>reserved for future use Callback</synopsis> 4395 <description> 4396 Placeholder -- reserved for future use. 4397 </description> 4398 <parameters> 4399 </parameters> 4400 </callback> 4401 4402 <function id="FollowReferences" num="115" since="1.1"> 4403 <synopsis>Follow References</synopsis> 4404 <description> 4405 This function initiates a traversal over the objects that are 4406 directly and indirectly reachable from the specified object or, 4407 if <code>initial_object</code> is not specified, all objects 4408 reachable from the heap roots. 4409 The heap root are the set of system classes, 4410 JNI globals, references from thread stacks, and other objects used as roots 4411 for the purposes of garbage collection. 4412 <p/> 4413 This function operates by traversing the reference graph. 4414 Let <i>A</i>, <i>B</i>, ... represent objects. 4415 When a reference from <i>A</i> to <i>B</i> is traversed, 4416 when a reference from a heap root to <i>B</i> is traversed, 4417 or when <i>B</i> is specified as the <paramlink id="initial_object"/>, 4418 then <i>B</i> is said to be <i>visited</i>. 4419 A reference from <i>A</i> to <i>B</i> is not traversed until <i>A</i> 4420 is visited. 4421 References are reported in the same order that the references are traversed. 4422 Object references are reported by invoking the agent supplied 4423 callback function <functionlink id="jvmtiHeapReferenceCallback"/>. 4424 In a reference from <i>A</i> to <i>B</i>, <i>A</i> is known 4425 as the <i>referrer</i> and <i>B</i> as the <i>referree</i>. 4426 The callback is invoked exactly once for each reference from a referrer; 4427 this is true even if there are reference cycles or multiple paths to 4428 the referrer. 4429 There may be more than one reference between a referrer and a referree, 4430 each reference is reported. 4431 These references may be distinguished by examining the 4432 <datalink 4433 id="jvmtiHeapReferenceCallback.reference_kind"><code>reference_kind</code></datalink> 4434 and 4435 <datalink 4436 id="jvmtiHeapReferenceCallback.reference_info"><code>reference_info</code></datalink> 4437 parameters of the <functionlink id="jvmtiHeapReferenceCallback"/> callback. 4438 <p/> 4439 This function reports a Java programming language view of object references, 4440 not a virtual machine implementation view. The following object references 4441 are reported when they are non-null: 4442 <ul> 4443 <li>Instance objects report references to each non-primitive instance fields 4444 (including inherited fields).</li> 4445 <li>Instance objects report a reference to the object type (class).</li> 4446 <li>Classes report a reference to the superclass and directly 4447 implemented/extended interfaces.</li> 4448 <li>Classes report a reference to the class loader, protection domain, 4449 signers, and resolved entries in the constant pool.</li> 4450 <li>Classes report a reference to each directly declared non-primitive 4451 static field.</li> 4452 <li>Arrays report a reference to the array type (class) and each 4453 array element.</li> 4454 <li>Primitive arrays report a reference to the array type.</li> 4455 </ul> 4456 <p/> 4457 This function can also be used to examine primitive (non-object) values. 4458 The primitive value of an array or String 4459 is reported after the object has been visited; 4460 it is reported by invoking the agent supplied callback function 4461 <functionlink id="jvmtiArrayPrimitiveValueCallback"/> or 4462 <functionlink id="jvmtiStringPrimitiveValueCallback"/>. 4463 A primitive field 4464 is reported after the object with that field is visited; 4465 it is reported by invoking the agent supplied callback function 4466 <functionlink id="jvmtiPrimitiveFieldCallback"/>. 4467 <p/> 4468 Whether a callback is provided or is <code>NULL</code> only determines 4469 whether the callback will be invoked, it does not influence 4470 which objects are visited nor does it influence whether other callbacks 4471 will be invoked. 4472 However, the 4473 <datalink id="jvmtiHeapVisitControl">visit control flags</datalink> 4474 returned by <functionlink id="jvmtiHeapReferenceCallback"/> 4475 do determine if the objects referenced by the 4476 current object as visited. 4477 The <datalink id="jvmtiHeapFilter">heap filter flags</datalink> 4478 and <paramlink id="klass"/> provided as parameters to this function 4479 do not control which objects are visited but they do control which 4480 objects and primitive values are reported by the callbacks. 4481 For example, if the only callback that was set is 4482 <fieldlink id="array_primitive_value_callback" struct="jvmtiHeapCallbacks"/> and <code>klass</code> 4483 is set to the array of bytes class, then only arrays of byte will be 4484 reported. 4485 The table below summarizes this: 4486 <p/> 4487 <table> 4488 <tr class="bgLight"> 4489 <th/> 4490 <th class="centered" scope="col">Controls objects visited</th> 4491 <th class="centered" scope="col">Controls objects reported</th> 4492 <th class="centered" scope="col">Controls primitives reported</th> 4493 </tr> 4494 <tr> 4495 <th scope="row"> 4496 the 4497 <datalink id="jvmtiHeapVisitControl">Heap Visit Control Flags</datalink> 4498 returned by <functionlink id="jvmtiHeapReferenceCallback"/> 4499 </th> 4500 <td class="centered"> 4501 <b>Yes</b> 4502 </td> 4503 <td class="centered"> 4504 <b>Yes</b>, since visits are controlled 4505 </td> 4506 <td class="centered"> 4507 <b>Yes</b>, since visits are controlled 4508 </td> 4509 </tr> 4510 <tr> 4511 <th scope="row"> 4512 <fieldlink id="array_primitive_value_callback" struct="jvmtiHeapCallbacks"/> 4513 in <paramlink id="callbacks"/> set 4514 </th> 4515 <td class="centered"> 4516 No 4517 </td> 4518 <td class="centered"> 4519 <b>Yes</b> 4520 </td> 4521 <td class="centered"> 4522 No 4523 </td> 4524 </tr> 4525 <tr> 4526 <th scope="row"> 4527 <paramlink id="heap_filter"/> 4528 </th> 4529 <td class="centered"> 4530 No 4531 </td> 4532 <td class="centered"> 4533 <b>Yes</b> 4534 </td> 4535 <td class="centered"> 4536 <b>Yes</b> 4537 </td> 4538 </tr> 4539 <tr> 4540 <th scope="row"> 4541 <paramlink id="klass"/> 4542 </th> 4543 <td class="centered"> 4544 No 4545 </td> 4546 <td class="centered"> 4547 <b>Yes</b> 4548 </td> 4549 <td class="centered"> 4550 <b>Yes</b> 4551 </td> 4552 </tr> 4553 </table> 4554 <p/> 4555 During the execution of this function the state of the heap 4556 does not change: no objects are allocated, no objects are 4557 garbage collected, and the state of objects (including 4558 held values) does not change. 4559 As a result, threads executing Java 4560 programming language code, threads attempting to resume the 4561 execution of Java programming language code, and threads 4562 attempting to execute JNI functions are typically stalled. 4563 </description> 4564 <origin>new</origin> 4565 <capabilities> 4566 <required id="can_tag_objects"></required> 4567 </capabilities> 4568 <parameters> 4569 <param id="heap_filter"> 4570 <jint/> 4571 <description> 4572 This bit vector of 4573 <datalink id="jvmtiHeapFilter">heap filter flags</datalink>. 4574 restricts the objects for which the callback function is called. 4575 This applies to both the object and primitive callbacks. 4576 </description> 4577 </param> 4578 <param id="klass"> 4579 <ptrtype> 4580 <jclass/> 4581 <nullok>callbacks are not limited to instances of a particular 4582 class</nullok> 4583 </ptrtype> 4584 <description> 4585 Callbacks are only reported when the object is an instance of 4586 this class. 4587 Objects which are instances of a subclass of <code>klass</code> 4588 are not reported. 4589 If <code>klass</code> is an interface, no objects are reported. 4590 This applies to both the object and primitive callbacks. 4591 </description> 4592 </param> 4593 <param id="initial_object"> 4594 <ptrtype> 4595 <jobject/> 4596 <nullok>references are followed from the heap roots</nullok> 4597 </ptrtype> 4598 <description> 4599 The object to follow 4600 </description> 4601 </param> 4602 <param id="callbacks"> 4603 <inptr> 4604 <struct>jvmtiHeapCallbacks</struct> 4605 </inptr> 4606 <description> 4607 Structure defining the set of callback functions. 4608 </description> 4609 </param> 4610 <param id="user_data"> 4611 <inbuf> 4612 <void/> 4613 <nullok><code>NULL</code> is passed as the user supplied data</nullok> 4614 </inbuf> 4615 <description> 4616 User supplied data to be passed to the callback. 4617 </description> 4618 </param> 4619 </parameters> 4620 <errors> 4621 <error id="JVMTI_ERROR_INVALID_CLASS"> 4622 <paramlink id="klass"/> is not a valid class. 4623 </error> 4624 <error id="JVMTI_ERROR_INVALID_OBJECT"> 4625 <paramlink id="initial_object"/> is not a valid object. 4626 </error> 4627 </errors> 4628 </function> 4629 4630 4631 <function id="IterateThroughHeap" num="116" since="1.1"> 4632 <synopsis>Iterate Through Heap</synopsis> 4633 <description> 4634 Initiate an iteration over all objects in the heap. 4635 This includes both reachable and 4636 unreachable objects. Objects are visited in no particular order. 4637 <p/> 4638 Heap objects are reported by invoking the agent supplied 4639 callback function <functionlink id="jvmtiHeapIterationCallback"/>. 4640 References between objects are not reported. 4641 If only reachable objects are desired, or if object reference information 4642 is needed, use <functionlink id="FollowReferences"/>. 4643 <p/> 4644 This function can also be used to examine primitive (non-object) values. 4645 The primitive value of an array or String 4646 is reported after the object has been visited; 4647 it is reported by invoking the agent supplied callback function 4648 <functionlink id="jvmtiArrayPrimitiveValueCallback"/> or 4649 <functionlink id="jvmtiStringPrimitiveValueCallback"/>. 4650 A primitive field 4651 is reported after the object with that field is visited; 4652 it is reported by invoking the agent supplied 4653 callback function 4654 <functionlink id="jvmtiPrimitiveFieldCallback"/>. 4655 <p/> 4656 Unless the iteration is aborted by the 4657 <datalink id="jvmtiHeapVisitControl">Heap Visit Control Flags</datalink> 4658 returned by a callback, all objects in the heap are visited. 4659 Whether a callback is provided or is <code>NULL</code> only determines 4660 whether the callback will be invoked, it does not influence 4661 which objects are visited nor does it influence whether other callbacks 4662 will be invoked. 4663 The <datalink id="jvmtiHeapFilter">heap filter flags</datalink> 4664 and <paramlink id="klass"/> provided as parameters to this function 4665 do not control which objects are visited but they do control which 4666 objects and primitive values are reported by the callbacks. 4667 For example, if the only callback that was set is 4668 <fieldlink id="array_primitive_value_callback" struct="jvmtiHeapCallbacks"/> and <code>klass</code> 4669 is set to the array of bytes class, then only arrays of byte will be 4670 reported. The table below summarizes this (contrast this with 4671 <functionlink id="FollowReferences"/>): 4672 <p/> 4673 <table> 4674 <tr class="bgLight"> 4675 <th/> 4676 <th class="centered" scope="col">Controls objects visited</th> 4677 <th class="centered" scope="col">Controls objects reported</th> 4678 <th class="centered" scope="col">Controls primitives reported</th> 4679 </tr> 4680 <tr> 4681 <th scope="row"> 4682 the 4683 <datalink id="jvmtiHeapVisitControl">Heap Visit Control Flags</datalink> 4684 returned by <functionlink id="jvmtiHeapIterationCallback"/> 4685 </th> 4686 <td class="centered"> 4687 No<br/>(unless they abort the iteration) 4688 </td> 4689 <td class="centered"> 4690 No<br/>(unless they abort the iteration) 4691 </td> 4692 <td class="centered"> 4693 No<br/>(unless they abort the iteration) 4694 </td> 4695 </tr> 4696 <tr> 4697 <th scope="row"> 4698 <fieldlink id="array_primitive_value_callback" struct="jvmtiHeapCallbacks"/> 4699 in <paramlink id="callbacks"/> set 4700 </th> 4701 <td class="centered"> 4702 No 4703 </td> 4704 <td class="centered"> 4705 <b>Yes</b> 4706 </td> 4707 <td class="centered"> 4708 No 4709 </td> 4710 </tr> 4711 <tr> 4712 <th scope="row"> 4713 <paramlink id="heap_filter"/> 4714 </th> 4715 <td class="centered"> 4716 No 4717 </td> 4718 <td class="centered"> 4719 <b>Yes</b> 4720 </td> 4721 <td class="centered"> 4722 <b>Yes</b> 4723 </td> 4724 </tr> 4725 <tr> 4726 <th scope="row"> 4727 <paramlink id="klass"/> 4728 </th> 4729 <td class="centered"> 4730 No 4731 </td> 4732 <td class="centered"> 4733 <b>Yes</b> 4734 </td> 4735 <td class="centered"> 4736 <b>Yes</b> 4737 </td> 4738 </tr> 4739 </table> 4740 <p/> 4741 During the execution of this function the state of the heap 4742 does not change: no objects are allocated, no objects are 4743 garbage collected, and the state of objects (including 4744 held values) does not change. 4745 As a result, threads executing Java 4746 programming language code, threads attempting to resume the 4747 execution of Java programming language code, and threads 4748 attempting to execute JNI functions are typically stalled. 4749 </description> 4750 <origin>new</origin> 4751 <capabilities> 4752 <required id="can_tag_objects"></required> 4753 </capabilities> 4754 <parameters> 4755 <param id="heap_filter"> 4756 <jint/> 4757 <description> 4758 This bit vector of 4759 <datalink id="jvmtiHeapFilter">heap filter flags</datalink>. 4760 restricts the objects for which the callback function is called. 4761 This applies to both the object and primitive callbacks. 4762 </description> 4763 </param> 4764 <param id="klass"> 4765 <ptrtype> 4766 <jclass/> 4767 <nullok>callbacks are not limited to instances of a particular class</nullok> 4768 </ptrtype> 4769 <description> 4770 Callbacks are only reported when the object is an instance of 4771 this class. 4772 Objects which are instances of a subclass of <code>klass</code> 4773 are not reported. 4774 If <code>klass</code> is an interface, no objects are reported. 4775 This applies to both the object and primitive callbacks. 4776 </description> 4777 </param> 4778 <param id="callbacks"> 4779 <inptr> 4780 <struct>jvmtiHeapCallbacks</struct> 4781 </inptr> 4782 <description> 4783 Structure defining the set callback functions. 4784 </description> 4785 </param> 4786 <param id="user_data"> 4787 <inbuf> 4788 <void/> 4789 <nullok><code>NULL</code> is passed as the user supplied data</nullok> 4790 </inbuf> 4791 <description> 4792 User supplied data to be passed to the callback. 4793 </description> 4794 </param> 4795 </parameters> 4796 <errors> 4797 <error id="JVMTI_ERROR_INVALID_CLASS"> 4798 <paramlink id="klass"/> is not a valid class. 4799 </error> 4800 </errors> 4801 </function> 4802 4803 <function id="GetTag" phase="start" num="106"> 4804 <synopsis>Get Tag</synopsis> 4805 <description> 4806 Retrieve the tag associated with an object. 4807 The tag is a long value typically used to store a 4808 unique identifier or pointer to object information. 4809 The tag is set with 4810 <functionlink id="SetTag"></functionlink>. 4811 Objects for which no tags have been set return a 4812 tag value of zero. 4813 </description> 4814 <origin>new</origin> 4815 <capabilities> 4816 <required id="can_tag_objects"></required> 4817 </capabilities> 4818 <parameters> 4819 <param id="object"> 4820 <jobject/> 4821 <description> 4822 The object whose tag is to be retrieved. 4823 </description> 4824 </param> 4825 <param id="tag_ptr"> 4826 <outptr><jlong/></outptr> 4827 <description> 4828 On return, the referenced long is set to the value 4829 of the tag. 4830 </description> 4831 </param> 4832 </parameters> 4833 <errors> 4834 </errors> 4835 </function> 4836 4837 <function id="SetTag" phase="start" num="107"> 4838 <synopsis>Set Tag</synopsis> 4839 <description> 4840 Set the tag associated with an object. 4841 The tag is a long value typically used to store a 4842 unique identifier or pointer to object information. 4843 The tag is visible with 4844 <functionlink id="GetTag"></functionlink>. 4845 </description> 4846 <origin>new</origin> 4847 <capabilities> 4848 <required id="can_tag_objects"></required> 4849 </capabilities> 4850 <parameters> 4851 <param id="object"> 4852 <jobject/> 4853 <description> 4854 The object whose tag is to be set. 4855 </description> 4856 </param> 4857 <param id="tag"> 4858 <jlong/> 4859 <description> 4860 The new value of the tag. 4861 </description> 4862 </param> 4863 </parameters> 4864 <errors> 4865 </errors> 4866 </function> 4867 4868 <function id="GetObjectsWithTags" num="114"> 4869 <synopsis>Get Objects With Tags</synopsis> 4870 <description> 4871 Return objects in the heap with the specified tags. 4872 The format is parallel arrays of objects and tags. 4873 </description> 4874 <origin>new</origin> 4875 <capabilities> 4876 <required id="can_tag_objects"></required> 4877 </capabilities> 4878 <parameters> 4879 <param id="tag_count"> 4880 <jint min="0"/> 4881 <description> 4882 Number of tags to scan for. 4883 </description> 4884 </param> 4885 <param id="tags"> 4886 <inbuf incount="tag_count"> 4887 <jlong/> 4888 </inbuf> 4889 <description> 4890 Scan for objects with these tags. 4891 Zero is not permitted in this array. 4892 </description> 4893 </param> 4894 <param id="count_ptr"> 4895 <outptr> 4896 <jint/> 4897 </outptr> 4898 <description> 4899 Return the number of objects with any of the tags 4900 in <paramlink id="tags"/>. 4901 </description> 4902 </param> 4903 <param id="object_result_ptr"> 4904 <allocbuf outcount="count_ptr"> 4905 <jobject/> 4906 <nullok>this information is not returned</nullok> 4907 </allocbuf> 4908 <description> 4909 Returns the array of objects with any of the tags 4910 in <paramlink id="tags"/>. 4911 </description> 4912 </param> 4913 <param id="tag_result_ptr"> 4914 <allocbuf outcount="count_ptr"> 4915 <jlong/> 4916 <nullok>this information is not returned</nullok> 4917 </allocbuf> 4918 <description> 4919 For each object in <paramlink id="object_result_ptr"/>, 4920 return the tag at the corresponding index. 4921 </description> 4922 </param> 4923 </parameters> 4924 <errors> 4925 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 4926 Zero is present in <paramlink id="tags"></paramlink>. 4927 </error> 4928 </errors> 4929 </function> 4930 4931 <function id="ForceGarbageCollection" num="108"> 4932 <synopsis>Force Garbage Collection</synopsis> 4933 <description> 4934 Force the VM to perform a garbage collection. 4935 The garbage collection is as complete as possible. 4936 This function does not cause finalizers to be run. 4937 This function does not return until the garbage collection 4938 is finished. 4939 <p/> 4940 Although garbage collection is as complete 4941 as possible there is no guarantee that all 4942 <eventlink id="ObjectFree"/> 4943 events will have been 4944 sent by the time that this function 4945 returns. In particular, an object may be 4946 prevented from being freed because it 4947 is awaiting finalization. 4948 </description> 4949 <origin>new</origin> 4950 <capabilities> 4951 </capabilities> 4952 <parameters> 4953 </parameters> 4954 <errors> 4955 </errors> 4956 </function> 4957 4958 4959 </category> 4960 4961 <category id="Heap_1_0" label="Heap (1.0)"> 4962 <intro> 4963 <b> 4964 These functions and data types were introduced in the original 4965 <jvmti/> version 1.0 and have been superseded by more 4966 </b> 4967 <internallink id="Heap"><b>powerful and flexible versions</b></internallink> 4968 <b> 4969 which: 4970 </b> 4971 <ul> 4972 <li> 4973 <b> 4974 Allow access to primitive values (the value of Strings, arrays, 4975 and primitive fields) 4976 </b> 4977 </li> 4978 <li> 4979 <b> 4980 Allow the tag of the referrer to be set, thus enabling more 4981 efficient localized reference graph building 4982 </b> 4983 </li> 4984 <li> 4985 <b> 4986 Provide more extensive filtering abilities 4987 </b> 4988 </li> 4989 <li> 4990 <b> 4991 Are extensible, allowing their abilities to grow in future versions of <jvmti/> 4992 </b> 4993 </li> 4994 </ul> 4995 <p/> 4996 <b>Please use the </b> 4997 <internallink id="Heap"><b>current Heap functions</b></internallink>. 4998 <p/> 4999 <constants id="jvmtiHeapObjectFilter" label="Heap Object Filter Enumeration" kind="enum"> 5000 <constant id="JVMTI_HEAP_OBJECT_TAGGED" num="1"> 5001 Tagged objects only. 5002 </constant> 5003 <constant id="JVMTI_HEAP_OBJECT_UNTAGGED" num="2"> 5004 Untagged objects only. 5005 </constant> 5006 <constant id="JVMTI_HEAP_OBJECT_EITHER" num="3"> 5007 Either tagged or untagged objects. 5008 </constant> 5009 </constants> 5010 5011 <constants id="jvmtiHeapRootKind" label="Heap Root Kind Enumeration" kind="enum"> 5012 <constant id="JVMTI_HEAP_ROOT_JNI_GLOBAL" num="1"> 5013 JNI global reference. 5014 </constant> 5015 <constant id="JVMTI_HEAP_ROOT_SYSTEM_CLASS" num="2"> 5016 System class. 5017 </constant> 5018 <constant id="JVMTI_HEAP_ROOT_MONITOR" num="3"> 5019 Monitor. 5020 </constant> 5021 <constant id="JVMTI_HEAP_ROOT_STACK_LOCAL" num="4"> 5022 Stack local. 5023 </constant> 5024 <constant id="JVMTI_HEAP_ROOT_JNI_LOCAL" num="5"> 5025 JNI local reference. 5026 </constant> 5027 <constant id="JVMTI_HEAP_ROOT_THREAD" num="6"> 5028 Thread. 5029 </constant> 5030 <constant id="JVMTI_HEAP_ROOT_OTHER" num="7"> 5031 Other. 5032 </constant> 5033 </constants> 5034 5035 <constants id="jvmtiObjectReferenceKind" label="Object Reference Enumeration" kind="enum"> 5036 <constant id="JVMTI_REFERENCE_CLASS" num="1"> 5037 Reference from an object to its class. 5038 </constant> 5039 <constant id="JVMTI_REFERENCE_FIELD" num="2"> 5040 Reference from an object to the value of one of its instance fields. 5041 For references of this kind the <code>referrer_index</code> 5042 parameter to the <internallink id="jvmtiObjectReferenceCallback"> 5043 jvmtiObjectReferenceCallback</internallink> is the index of the 5044 the instance field. The index is based on the order of all the 5045 object's fields. This includes all fields of the directly declared 5046 static and instance fields in the class, and includes all fields (both 5047 public and private) fields declared in superclasses and superinterfaces. 5048 The index is thus calculated by summing the index of the field in the directly 5049 declared class (see <functionlink id="GetClassFields"/>), with the total 5050 number of fields (both public and private) declared in all superclasses 5051 and superinterfaces. The index starts at zero. 5052 </constant> 5053 <constant id="JVMTI_REFERENCE_ARRAY_ELEMENT" num="3"> 5054 Reference from an array to one of its elements. 5055 For references of this kind the <code>referrer_index</code> 5056 parameter to the <internallink id="jvmtiObjectReferenceCallback"> 5057 jvmtiObjectReferenceCallback</internallink> is the array index. 5058 </constant> 5059 <constant id="JVMTI_REFERENCE_CLASS_LOADER" num="4"> 5060 Reference from a class to its class loader. 5061 </constant> 5062 <constant id="JVMTI_REFERENCE_SIGNERS" num="5"> 5063 Reference from a class to its signers array. 5064 </constant> 5065 <constant id="JVMTI_REFERENCE_PROTECTION_DOMAIN" num="6"> 5066 Reference from a class to its protection domain. 5067 </constant> 5068 <constant id="JVMTI_REFERENCE_INTERFACE" num="7"> 5069 Reference from a class to one of its interfaces. 5070 </constant> 5071 <constant id="JVMTI_REFERENCE_STATIC_FIELD" num="8"> 5072 Reference from a class to the value of one of its static fields. 5073 For references of this kind the <code>referrer_index</code> 5074 parameter to the <internallink id="jvmtiObjectReferenceCallback"> 5075 jvmtiObjectReferenceCallback</internallink> is the index of the 5076 the static field. The index is based on the order of all the 5077 object's fields. This includes all fields of the directly declared 5078 static and instance fields in the class, and includes all fields (both 5079 public and private) fields declared in superclasses and superinterfaces. 5080 The index is thus calculated by summing the index of the field in the directly 5081 declared class (see <functionlink id="GetClassFields"/>), with the total 5082 number of fields (both public and private) declared in all superclasses 5083 and superinterfaces. The index starts at zero. 5084 Note: this definition differs from that in the <jvmti/> 1.0 Specification. 5085 <rationale>No known implementations used the 1.0 definition.</rationale> 5086 </constant> 5087 <constant id="JVMTI_REFERENCE_CONSTANT_POOL" num="9"> 5088 Reference from a class to a resolved entry in the constant pool. 5089 For references of this kind the <code>referrer_index</code> 5090 parameter to the <internallink id="jvmtiObjectReferenceCallback"> 5091 jvmtiObjectReferenceCallback</internallink> is the index into 5092 constant pool table of the class, starting at 1. See 5093 <vmspec chapter="4.4"/>. 5094 </constant> 5095 </constants> 5096 5097 <constants id="jvmtiIterationControl" label="Iteration Control Enumeration" kind="enum"> 5098 <constant id="JVMTI_ITERATION_CONTINUE" num="1"> 5099 Continue the iteration. 5100 If this is a reference iteration, follow the references of this object. 5101 </constant> 5102 <constant id="JVMTI_ITERATION_IGNORE" num="2"> 5103 Continue the iteration. 5104 If this is a reference iteration, ignore the references of this object. 5105 </constant> 5106 <constant id="JVMTI_ITERATION_ABORT" num="0"> 5107 Abort the iteration. 5108 </constant> 5109 </constants> 5110 </intro> 5111 5112 <callback id="jvmtiHeapObjectCallback"> 5113 <enum>jvmtiIterationControl</enum> 5114 <synopsis>Heap Object Callback</synopsis> 5115 <description> 5116 Agent supplied callback function. 5117 Describes (but does not pass in) an object in the heap. 5118 <p/> 5119 Return value should be <code>JVMTI_ITERATION_CONTINUE</code> to continue iteration, 5120 or <code>JVMTI_ITERATION_ABORT</code> to stop iteration. 5121 <p/> 5122 See the <internallink id="heapCallbacks">heap callback 5123 function restrictions</internallink>. 5124 </description> 5125 <parameters> 5126 <param id="class_tag"> 5127 <jlong/> 5128 <description> 5129 The tag of the class of object (zero if the class is not tagged). 5130 If the object represents a runtime class, 5131 the <code>class_tag</code> is the tag 5132 associated with <code>java.lang.Class</code> 5133 (zero if <code>java.lang.Class</code> is not tagged). 5134 </description> 5135 </param> 5136 <param id="size"> 5137 <jlong/> 5138 <description> 5139 Size of the object (in bytes). See <functionlink id="GetObjectSize"/>. 5140 </description> 5141 </param> 5142 <param id="tag_ptr"> 5143 <outptr><jlong/></outptr> 5144 <description> 5145 The object tag value, or zero if the object is not tagged. 5146 To set the tag value to be associated with the object 5147 the agent sets the <code>jlong</code> pointed to by the parameter. 5148 </description> 5149 </param> 5150 <param id="user_data"> 5151 <outptr><void/></outptr> 5152 <description> 5153 The user supplied data that was passed into the iteration function. 5154 </description> 5155 </param> 5156 </parameters> 5157 </callback> 5158 5159 <callback id="jvmtiHeapRootCallback"> 5160 <enum>jvmtiIterationControl</enum> 5161 <synopsis>Heap Root Object Callback</synopsis> 5162 <description> 5163 Agent supplied callback function. 5164 Describes (but does not pass in) an object that is a root for the purposes 5165 of garbage collection. 5166 <p/> 5167 Return value should be <code>JVMTI_ITERATION_CONTINUE</code> to continue iteration, 5168 <code>JVMTI_ITERATION_IGNORE</code> to continue iteration without pursuing 5169 references from referree object or <code>JVMTI_ITERATION_ABORT</code> to stop iteration. 5170 <p/> 5171 See the <internallink id="heapCallbacks">heap callback 5172 function restrictions</internallink>. 5173 </description> 5174 <parameters> 5175 <param id="root_kind"> 5176 <enum>jvmtiHeapRootKind</enum> 5177 <description> 5178 The kind of heap root. 5179 </description> 5180 </param> 5181 <param id="class_tag"> 5182 <jlong/> 5183 <description> 5184 The tag of the class of object (zero if the class is not tagged). 5185 If the object represents a runtime class, the <code>class_tag</code> is the tag 5186 associated with <code>java.lang.Class</code> 5187 (zero if <code>java.lang.Class</code> is not tagged). 5188 </description> 5189 </param> 5190 <param id="size"> 5191 <jlong/> 5192 <description> 5193 Size of the object (in bytes). See <functionlink id="GetObjectSize"/>. 5194 </description> 5195 </param> 5196 <param id="tag_ptr"> 5197 <outptr><jlong/></outptr> 5198 <description> 5199 The object tag value, or zero if the object is not tagged. 5200 To set the tag value to be associated with the object 5201 the agent sets the <code>jlong</code> pointed to by the parameter. 5202 </description> 5203 </param> 5204 <param id="user_data"> 5205 <outptr><void/></outptr> 5206 <description> 5207 The user supplied data that was passed into the iteration function. 5208 </description> 5209 </param> 5210 </parameters> 5211 </callback> 5212 5213 <callback id="jvmtiStackReferenceCallback"> 5214 <enum>jvmtiIterationControl</enum> 5215 <synopsis>Stack Reference Object Callback</synopsis> 5216 <description> 5217 Agent supplied callback function. 5218 Describes (but does not pass in) an object on the stack that is a root for 5219 the purposes of garbage collection. 5220 <p/> 5221 Return value should be <code>JVMTI_ITERATION_CONTINUE</code> to continue iteration, 5222 <code>JVMTI_ITERATION_IGNORE</code> to continue iteration without pursuing 5223 references from referree object or <code>JVMTI_ITERATION_ABORT</code> to stop iteration. 5224 <p/> 5225 See the <internallink id="heapCallbacks">heap callback 5226 function restrictions</internallink>. 5227 </description> 5228 <parameters> 5229 <param id="root_kind"> 5230 <enum>jvmtiHeapRootKind</enum> 5231 <description> 5232 The kind of root (either <code>JVMTI_HEAP_ROOT_STACK_LOCAL</code> or 5233 <code>JVMTI_HEAP_ROOT_JNI_LOCAL</code>). 5234 </description> 5235 </param> 5236 <param id="class_tag"> 5237 <jlong/> 5238 <description> 5239 The tag of the class of object (zero if the class is not tagged). 5240 If the object represents a runtime class, the <code>class_tag</code> is the tag 5241 associated with <code>java.lang.Class</code> 5242 (zero if <code>java.lang.Class</code> is not tagged). 5243 </description> 5244 </param> 5245 <param id="size"> 5246 <jlong/> 5247 <description> 5248 Size of the object (in bytes). See <functionlink id="GetObjectSize"/>. 5249 </description> 5250 </param> 5251 <param id="tag_ptr"> 5252 <outptr><jlong/></outptr> 5253 <description> 5254 The object tag value, or zero if the object is not tagged. 5255 To set the tag value to be associated with the object 5256 the agent sets the <code>jlong</code> pointed to by the parameter. 5257 </description> 5258 </param> 5259 <param id="thread_tag"> 5260 <jlong/> 5261 <description> 5262 The tag of the thread corresponding to this stack, zero if not tagged. 5263 </description> 5264 </param> 5265 <param id="depth"> 5266 <jint/> 5267 <description> 5268 The depth of the frame. 5269 </description> 5270 </param> 5271 <param id="method"> 5272 <jmethodID/> 5273 <description> 5274 The method executing in this frame. 5275 </description> 5276 </param> 5277 <param id="slot"> 5278 <jint/> 5279 <description> 5280 The slot number. 5281 </description> 5282 </param> 5283 <param id="user_data"> 5284 <outptr><void/></outptr> 5285 <description> 5286 The user supplied data that was passed into the iteration function. 5287 </description> 5288 </param> 5289 </parameters> 5290 </callback> 5291 5292 <callback id="jvmtiObjectReferenceCallback"> 5293 <enum>jvmtiIterationControl</enum> 5294 <synopsis>Object Reference Callback</synopsis> 5295 <description> 5296 Agent supplied callback function. 5297 Describes a reference from an object (the referrer) to another object 5298 (the referree). 5299 <p/> 5300 Return value should be <code>JVMTI_ITERATION_CONTINUE</code> to continue iteration, 5301 <code>JVMTI_ITERATION_IGNORE</code> to continue iteration without pursuing 5302 references from referree object or <code>JVMTI_ITERATION_ABORT</code> to stop iteration. 5303 <p/> 5304 See the <internallink id="heapCallbacks">heap callback 5305 function restrictions</internallink>. 5306 </description> 5307 <parameters> 5308 <param id="reference_kind"> 5309 <enum>jvmtiObjectReferenceKind</enum> 5310 <description> 5311 The type of reference. 5312 </description> 5313 </param> 5314 <param id="class_tag"> 5315 <jlong/> 5316 <description> 5317 The tag of the class of referree object (zero if the class is not tagged). 5318 If the referree object represents a runtime class, 5319 the <code>class_tag</code> is the tag 5320 associated with <code>java.lang.Class</code> 5321 (zero if <code>java.lang.Class</code> is not tagged). 5322 </description> 5323 </param> 5324 <param id="size"> 5325 <jlong/> 5326 <description> 5327 Size of the referree object (in bytes). 5328 See <functionlink id="GetObjectSize"/>. 5329 </description> 5330 </param> 5331 <param id="tag_ptr"> 5332 <outptr><jlong/></outptr> 5333 <description> 5334 The referree object tag value, or zero if the object is not 5335 tagged. 5336 To set the tag value to be associated with the object 5337 the agent sets the <code>jlong</code> pointed to by the parameter. 5338 </description> 5339 </param> 5340 <param id="referrer_tag"> 5341 <jlong/> 5342 <description> 5343 The tag of the referrer object, or zero if the referrer 5344 object is not tagged. 5345 </description> 5346 </param> 5347 <param id="referrer_index"> 5348 <jint/> 5349 <description> 5350 For references of type <code>JVMTI_REFERENCE_FIELD</code> or 5351 <code>JVMTI_REFERENCE_STATIC_FIELD</code> the index 5352 of the field in the referrer object. The index is based on the 5353 order of all the object's fields - see <internallink 5354 id="JVMTI_REFERENCE_FIELD">JVMTI_REFERENCE_FIELD</internallink> 5355 or <internallink 5356 id="JVMTI_REFERENCE_STATIC_FIELD">JVMTI_REFERENCE_STATIC_FIELD 5357 </internallink> for further description. 5358 <p/> 5359 For references of type <code>JVMTI_REFERENCE_ARRAY_ELEMENT</code> 5360 the array index - see <internallink id="JVMTI_REFERENCE_ARRAY_ELEMENT"> 5361 JVMTI_REFERENCE_ARRAY_ELEMENT</internallink> for further description. 5362 <p/> 5363 For references of type <code>JVMTI_REFERENCE_CONSTANT_POOL</code> 5364 the index into the constant pool of the class - see 5365 <internallink id="JVMTI_REFERENCE_CONSTANT_POOL"> 5366 JVMTI_REFERENCE_CONSTANT_POOL</internallink> for further 5367 description. 5368 <p/> 5369 For references of other kinds the <code>referrer_index</code> is 5370 <code>-1</code>. 5371 </description> 5372 </param> 5373 <param id="user_data"> 5374 <outptr><void/></outptr> 5375 <description> 5376 The user supplied data that was passed into the iteration function. 5377 </description> 5378 </param> 5379 </parameters> 5380 </callback> 5381 5382 <function id="IterateOverObjectsReachableFromObject" num="109"> 5383 <synopsis>Iterate Over Objects Reachable From Object</synopsis> 5384 <description> 5385 This function iterates over all objects that are directly 5386 and indirectly reachable from the specified object. 5387 For each object <i>A</i> (known 5388 as the referrer) with a reference to object <i>B</i> the specified 5389 callback function is called to describe the object reference. 5390 The callback is called exactly once for each reference from a referrer; 5391 this is true even if there are reference cycles or multiple paths to 5392 the referrer. 5393 There may be more than one reference between a referrer and a referree, 5394 These may be distinguished by the 5395 <datalink id="jvmtiObjectReferenceCallback.reference_kind"></datalink> and 5396 <datalink id="jvmtiObjectReferenceCallback.referrer_index"></datalink>. 5397 The callback for an object will always occur after the callback for 5398 its referrer. 5399 <p/> 5400 See <functionlink id="FollowReferences"/> for the object 5401 references which are reported. 5402 <p/> 5403 During the execution of this function the state of the heap 5404 does not change: no objects are allocated, no objects are 5405 garbage collected, and the state of objects (including 5406 held values) does not change. 5407 As a result, threads executing Java 5408 programming language code, threads attempting to resume the 5409 execution of Java programming language code, and threads 5410 attempting to execute JNI functions are typically stalled. 5411 </description> 5412 <origin>new</origin> 5413 <capabilities> 5414 <required id="can_tag_objects"></required> 5415 </capabilities> 5416 <parameters> 5417 <param id="object"> 5418 <jobject/> 5419 <description> 5420 The object 5421 </description> 5422 </param> 5423 <param id="object_reference_callback"> 5424 <ptrtype> 5425 <struct>jvmtiObjectReferenceCallback</struct> 5426 </ptrtype> 5427 <description> 5428 The callback to be called to describe each 5429 object reference. 5430 </description> 5431 </param> 5432 <param id="user_data"> 5433 <inbuf> 5434 <void/> 5435 <nullok><code>NULL</code> is passed as the user supplied data</nullok> 5436 </inbuf> 5437 <description> 5438 User supplied data to be passed to the callback. 5439 </description> 5440 </param> 5441 </parameters> 5442 <errors> 5443 </errors> 5444 </function> 5445 5446 <function id="IterateOverReachableObjects" num="110"> 5447 <synopsis>Iterate Over Reachable Objects</synopsis> 5448 <description> 5449 This function iterates over the root objects and all objects that 5450 are directly and indirectly reachable from the root objects. 5451 The root objects comprise the set of system classes, 5452 JNI globals, references from thread stacks, and other objects used as roots 5453 for the purposes of garbage collection. 5454 <p/> 5455 For each root the <paramlink id="heap_root_callback"></paramlink> 5456 or <paramlink id="stack_ref_callback"></paramlink> callback is called. 5457 An object can be a root object for more than one reason and in that case 5458 the appropriate callback is called for each reason. 5459 <p/> 5460 For each object reference the <paramlink id="object_ref_callback"></paramlink> 5461 callback function is called to describe the object reference. 5462 The callback is called exactly once for each reference from a referrer; 5463 this is true even if there are reference cycles or multiple paths to 5464 the referrer. 5465 There may be more than one reference between a referrer and a referree, 5466 These may be distinguished by the 5467 <datalink id="jvmtiObjectReferenceCallback.reference_kind"></datalink> and 5468 <datalink id="jvmtiObjectReferenceCallback.referrer_index"></datalink>. 5469 The callback for an object will always occur after the callback for 5470 its referrer. 5471 <p/> 5472 See <functionlink id="FollowReferences"/> for the object 5473 references which are reported. 5474 <p/> 5475 Roots are always reported to the profiler before any object references 5476 are reported. In other words, the <paramlink id="object_ref_callback"></paramlink> 5477 callback will not be called until the appropriate callback has been called 5478 for all roots. If the <paramlink id="object_ref_callback"></paramlink> callback is 5479 specified as <code>NULL</code> then this function returns after 5480 reporting the root objects to the profiler. 5481 <p/> 5482 During the execution of this function the state of the heap 5483 does not change: no objects are allocated, no objects are 5484 garbage collected, and the state of objects (including 5485 held values) does not change. 5486 As a result, threads executing Java 5487 programming language code, threads attempting to resume the 5488 execution of Java programming language code, and threads 5489 attempting to execute JNI functions are typically stalled. 5490 </description> 5491 <origin>new</origin> 5492 <capabilities> 5493 <required id="can_tag_objects"></required> 5494 </capabilities> 5495 <parameters> 5496 <param id="heap_root_callback"> 5497 <ptrtype> 5498 <struct>jvmtiHeapRootCallback</struct> 5499 <nullok>do not report heap roots</nullok> 5500 </ptrtype> 5501 <description> 5502 The callback function to be called for each heap root of type 5503 <code>JVMTI_HEAP_ROOT_JNI_GLOBAL</code>, 5504 <code>JVMTI_HEAP_ROOT_SYSTEM_CLASS</code>, 5505 <code>JVMTI_HEAP_ROOT_MONITOR</code>, 5506 <code>JVMTI_HEAP_ROOT_THREAD</code>, or 5507 <code>JVMTI_HEAP_ROOT_OTHER</code>. 5508 </description> 5509 </param> 5510 <param id="stack_ref_callback"> 5511 <ptrtype> 5512 <struct>jvmtiStackReferenceCallback</struct> 5513 <nullok>do not report stack references</nullok> 5514 </ptrtype> 5515 <description> 5516 The callback function to be called for each heap root of 5517 <code>JVMTI_HEAP_ROOT_STACK_LOCAL</code> or 5518 <code>JVMTI_HEAP_ROOT_JNI_LOCAL</code>. 5519 </description> 5520 </param> 5521 <param id="object_ref_callback"> 5522 <ptrtype> 5523 <struct>jvmtiObjectReferenceCallback</struct> 5524 <nullok>do not follow references from the root objects</nullok> 5525 </ptrtype> 5526 <description> 5527 The callback function to be called for each object reference. 5528 </description> 5529 </param> 5530 <param id="user_data"> 5531 <inbuf> 5532 <void/> 5533 <nullok><code>NULL</code> is passed as the user supplied data</nullok> 5534 </inbuf> 5535 <description> 5536 User supplied data to be passed to the callback. 5537 </description> 5538 </param> 5539 </parameters> 5540 <errors> 5541 </errors> 5542 </function> 5543 5544 <function id="IterateOverHeap" num="111"> 5545 <synopsis>Iterate Over Heap</synopsis> 5546 <description> 5547 Iterate over all objects in the heap. This includes both reachable and 5548 unreachable objects. 5549 <p/> 5550 The <paramlink id="object_filter"></paramlink> parameter indicates the 5551 objects for which the callback function is called. If this parameter 5552 is <code>JVMTI_HEAP_OBJECT_TAGGED</code> then the callback will only be 5553 called for every object that is tagged. If the parameter is 5554 <code>JVMTI_HEAP_OBJECT_UNTAGGED</code> then the callback will only be 5555 for objects that are not tagged. If the parameter 5556 is <code>JVMTI_HEAP_OBJECT_EITHER</code> then the callback will be 5557 called for every object in the heap, irrespective of whether it is 5558 tagged or not. 5559 <p/> 5560 During the execution of this function the state of the heap 5561 does not change: no objects are allocated, no objects are 5562 garbage collected, and the state of objects (including 5563 held values) does not change. 5564 As a result, threads executing Java 5565 programming language code, threads attempting to resume the 5566 execution of Java programming language code, and threads 5567 attempting to execute JNI functions are typically stalled. 5568 </description> 5569 <origin>new</origin> 5570 <capabilities> 5571 <required id="can_tag_objects"></required> 5572 </capabilities> 5573 <parameters> 5574 <param id="object_filter"> 5575 <enum>jvmtiHeapObjectFilter</enum> 5576 <description> 5577 Indicates the objects for which the callback function is called. 5578 </description> 5579 </param> 5580 <param id="heap_object_callback"> 5581 <ptrtype> 5582 <struct>jvmtiHeapObjectCallback</struct> 5583 </ptrtype> 5584 <description> 5585 The iterator function to be called for each 5586 object matching the <paramlink id="object_filter"/>. 5587 </description> 5588 </param> 5589 <param id="user_data"> 5590 <inbuf> 5591 <void/> 5592 <nullok><code>NULL</code> is passed as the user supplied data</nullok> 5593 </inbuf> 5594 <description> 5595 User supplied data to be passed to the callback. 5596 </description> 5597 </param> 5598 </parameters> 5599 <errors> 5600 </errors> 5601 </function> 5602 5603 <function id="IterateOverInstancesOfClass" num="112"> 5604 <synopsis>Iterate Over Instances Of Class</synopsis> 5605 <description> 5606 Iterate over all objects in the heap that are instances of the specified class. 5607 This includes direct instances of the specified class and 5608 instances of all subclasses of the specified class. 5609 This includes both reachable and unreachable objects. 5610 <p/> 5611 The <paramlink id="object_filter"></paramlink> parameter indicates the 5612 objects for which the callback function is called. If this parameter 5613 is <code>JVMTI_HEAP_OBJECT_TAGGED</code> then the callback will only be 5614 called for every object that is tagged. If the parameter is 5615 <code>JVMTI_HEAP_OBJECT_UNTAGGED</code> then the callback will only be 5616 called for objects that are not tagged. If the parameter 5617 is <code>JVMTI_HEAP_OBJECT_EITHER</code> then the callback will be 5618 called for every object in the heap, irrespective of whether it is 5619 tagged or not. 5620 <p/> 5621 During the execution of this function the state of the heap 5622 does not change: no objects are allocated, no objects are 5623 garbage collected, and the state of objects (including 5624 held values) does not change. 5625 As a result, threads executing Java 5626 programming language code, threads attempting to resume the 5627 execution of Java programming language code, and threads 5628 attempting to execute JNI functions are typically stalled. 5629 </description> 5630 <origin>new</origin> 5631 <capabilities> 5632 <required id="can_tag_objects"></required> 5633 </capabilities> 5634 <parameters> 5635 <param id="klass"> 5636 <jclass/> 5637 <description> 5638 Iterate over objects of this class only. 5639 </description> 5640 </param> 5641 <param id="object_filter"> 5642 <enum>jvmtiHeapObjectFilter</enum> 5643 <description> 5644 Indicates the objects for which the callback function is called. 5645 </description> 5646 </param> 5647 <param id="heap_object_callback"> 5648 <ptrtype> 5649 <struct>jvmtiHeapObjectCallback</struct> 5650 </ptrtype> 5651 <description> 5652 The iterator function to be called for each 5653 <paramlink id="klass"/> instance matching 5654 the <paramlink id="object_filter"/>. 5655 </description> 5656 </param> 5657 <param id="user_data"> 5658 <inbuf> 5659 <void/> 5660 <nullok><code>NULL</code> is passed as the user supplied data</nullok> 5661 </inbuf> 5662 <description> 5663 User supplied data to be passed to the callback. 5664 </description> 5665 </param> 5666 </parameters> 5667 <errors> 5668 </errors> 5669 </function> 5670 5671 </category> 5672 5673 <category id="local" label="Local Variable"> 5674 5675 <intro> 5676 These functions are used to retrieve or set the value of a local variable. 5677 The variable is identified by the depth of the frame containing its 5678 value and the variable's slot number within that frame. 5679 The mapping of variables to 5680 slot numbers can be obtained with the function 5681 <functionlink id="GetLocalVariableTable"></functionlink>. 5682 </intro> 5683 5684 <function id="GetLocalObject" num="21"> 5685 <synopsis>Get Local Variable - Object</synopsis> 5686 <description> 5687 This function can be used to retrieve the value of a local 5688 variable whose type is <code>Object</code> or a subclass of <code>Object</code>. 5689 </description> 5690 <origin>jvmdi</origin> 5691 <capabilities> 5692 <required id="can_access_local_variables"></required> 5693 </capabilities> 5694 <parameters> 5695 <param id="thread"> 5696 <jthread null="current" frame="frame"/> 5697 <description> 5698 The thread of the frame containing the variable's value. 5699 </description> 5700 </param> 5701 <param id="depth"> 5702 <jframeID thread="thread"/> 5703 <description> 5704 The depth of the frame containing the variable's value. 5705 </description> 5706 </param> 5707 <param id="slot"> 5708 <jint/> 5709 <description> 5710 The variable's slot number. 5711 </description> 5712 </param> 5713 <param id="value_ptr"> 5714 <outptr><jobject/></outptr> 5715 <description> 5716 On return, points to the variable's value. 5717 </description> 5718 </param> 5719 </parameters> 5720 <errors> 5721 <error id="JVMTI_ERROR_INVALID_SLOT"> 5722 Invalid <code>slot</code>. 5723 </error> 5724 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 5725 The variable type is not 5726 <code>Object</code> or a subclass of <code>Object</code>. 5727 </error> 5728 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 5729 Not a visible frame 5730 </error> 5731 </errors> 5732 </function> 5733 5734 <function id="GetLocalInstance" num="155" since="1.2"> 5735 <synopsis>Get Local Instance</synopsis> 5736 <description> 5737 This function can be used to retrieve the value of the local object 5738 variable at slot 0 (the "<code>this</code>" object) from non-static 5739 frames. This function can retrieve the "<code>this</code>" object from 5740 native method frames, whereas <code>GetLocalObject()</code> would 5741 return <code>JVMTI_ERROR_OPAQUE_FRAME</code> in those cases. 5742 </description> 5743 <origin>new</origin> 5744 <capabilities> 5745 <required id="can_access_local_variables"></required> 5746 </capabilities> 5747 <parameters> 5748 <param id="thread"> 5749 <jthread null="current" frame="frame"/> 5750 <description> 5751 The thread of the frame containing the variable's value. 5752 </description> 5753 </param> 5754 <param id="depth"> 5755 <jframeID thread="thread"/> 5756 <description> 5757 The depth of the frame containing the variable's value. 5758 </description> 5759 </param> 5760 <param id="value_ptr"> 5761 <outptr><jobject/></outptr> 5762 <description> 5763 On return, points to the variable's value. 5764 </description> 5765 </param> 5766 </parameters> 5767 <errors> 5768 <error id="JVMTI_ERROR_INVALID_SLOT"> 5769 If the specified frame is a static method frame. 5770 </error> 5771 </errors> 5772 </function> 5773 <function id="GetLocalInt" num="22"> 5774 <synopsis>Get Local Variable - Int</synopsis> 5775 <description> 5776 This function can be used to retrieve the value of a local 5777 variable whose type is <code>int</code>, 5778 <code>short</code>, <code>char</code>, <code>byte</code>, or 5779 <code>boolean</code>. 5780 </description> 5781 <origin>jvmdi</origin> 5782 <capabilities> 5783 <required id="can_access_local_variables"></required> 5784 </capabilities> 5785 <parameters> 5786 <param id="thread"> 5787 <jthread null="current" frame="frame"/> 5788 <description> 5789 The thread of the frame containing the variable's value. 5790 </description> 5791 </param> 5792 <param id="depth"> 5793 <jframeID thread="thread"/> 5794 <description> 5795 The depth of the frame containing the variable's value. 5796 </description> 5797 </param> 5798 <param id="slot"> 5799 <jint/> 5800 <description> 5801 The variable's slot number. 5802 </description> 5803 </param> 5804 <param id="value_ptr"> 5805 <outptr><jint/></outptr> 5806 <description> 5807 On return, points to the variable's value. 5808 </description> 5809 </param> 5810 </parameters> 5811 <errors> 5812 <error id="JVMTI_ERROR_INVALID_SLOT"> 5813 Invalid <code>slot</code>. 5814 </error> 5815 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 5816 The variable type is not 5817 <code>int</code>, <code>short</code>, 5818 <code>char</code>, <code>byte</code>, or 5819 <code>boolean</code>. 5820 </error> 5821 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 5822 Not a visible frame 5823 </error> 5824 </errors> 5825 </function> 5826 5827 <function id="GetLocalLong" num="23"> 5828 <synopsis>Get Local Variable - Long</synopsis> 5829 <description> 5830 This function can be used to retrieve the value of a local 5831 variable whose type is <code>long</code>. 5832 </description> 5833 <origin>jvmdi</origin> 5834 <capabilities> 5835 <required id="can_access_local_variables"></required> 5836 </capabilities> 5837 <parameters> 5838 <param id="thread"> 5839 <jthread null="current" frame="frame"/> 5840 <description> 5841 The thread of the frame containing the variable's value. 5842 </description> 5843 </param> 5844 <param id="depth"> 5845 <jframeID thread="thread"/> 5846 <description> 5847 The depth of the frame containing the variable's value. 5848 </description> 5849 </param> 5850 <param id="slot"> 5851 <jint/> 5852 <description> 5853 The variable's slot number. 5854 </description> 5855 </param> 5856 <param id="value_ptr"> 5857 <outptr><jlong/></outptr> 5858 <description> 5859 On return, points to the variable's value. 5860 </description> 5861 </param> 5862 </parameters> 5863 <errors> 5864 <error id="JVMTI_ERROR_INVALID_SLOT"> 5865 Invalid <code>slot</code>. 5866 </error> 5867 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 5868 The variable type is not <code>long</code>. 5869 </error> 5870 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 5871 Not a visible frame 5872 </error> 5873 </errors> 5874 </function> 5875 5876 <function id="GetLocalFloat" num="24"> 5877 <synopsis>Get Local Variable - Float</synopsis> 5878 <description> 5879 This function can be used to retrieve the value of a local 5880 variable whose type is <code>float</code>. 5881 </description> 5882 <origin>jvmdi</origin> 5883 <capabilities> 5884 <required id="can_access_local_variables"></required> 5885 </capabilities> 5886 <parameters> 5887 <param id="thread"> 5888 <jthread null="current" frame="frame"/> 5889 <description> 5890 The thread of the frame containing the variable's value. 5891 </description> 5892 </param> 5893 <param id="depth"> 5894 <jframeID thread="thread"/> 5895 <description> 5896 The depth of the frame containing the variable's value. 5897 </description> 5898 </param> 5899 <param id="slot"> 5900 <jint/> 5901 <description> 5902 The variable's slot number. 5903 </description> 5904 </param> 5905 <param id="value_ptr"> 5906 <outptr><jfloat/></outptr> 5907 <description> 5908 On return, points to the variable's value. 5909 </description> 5910 </param> 5911 </parameters> 5912 <errors> 5913 <error id="JVMTI_ERROR_INVALID_SLOT"> 5914 Invalid <code>slot</code>. 5915 </error> 5916 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 5917 The variable type is not <code>float</code>. 5918 </error> 5919 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 5920 Not a visible frame 5921 </error> 5922 </errors> 5923 </function> 5924 5925 <function id="GetLocalDouble" num="25"> 5926 <synopsis>Get Local Variable - Double</synopsis> 5927 <description> 5928 This function can be used to retrieve the value of a local 5929 variable whose type is <code>long</code>. 5930 </description> 5931 <origin>jvmdi</origin> 5932 <capabilities> 5933 <required id="can_access_local_variables"></required> 5934 </capabilities> 5935 <parameters> 5936 <param id="thread"> 5937 <jthread null="current" frame="frame"/> 5938 <description> 5939 The thread of the frame containing the variable's value. 5940 </description> 5941 </param> 5942 <param id="depth"> 5943 <jframeID thread="thread"/> 5944 <description> 5945 The depth of the frame containing the variable's value. 5946 </description> 5947 </param> 5948 <param id="slot"> 5949 <jint/> 5950 <description> 5951 The variable's slot number. 5952 </description> 5953 </param> 5954 <param id="value_ptr"> 5955 <outptr><jdouble/></outptr> 5956 <description> 5957 On return, points to the variable's value. 5958 </description> 5959 </param> 5960 </parameters> 5961 <errors> 5962 <error id="JVMTI_ERROR_INVALID_SLOT"> 5963 Invalid <code>slot</code>. 5964 </error> 5965 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 5966 The variable type is not <code>double</code>. 5967 </error> 5968 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 5969 Not a visible frame 5970 </error> 5971 </errors> 5972 </function> 5973 5974 <function id="SetLocalObject" num="26"> 5975 <synopsis>Set Local Variable - Object</synopsis> 5976 <description> 5977 This function can be used to set the value of a local 5978 variable whose type is <code>Object</code> or a subclass of <code>Object</code>. 5979 </description> 5980 <origin>jvmdi</origin> 5981 <capabilities> 5982 <required id="can_access_local_variables"></required> 5983 </capabilities> 5984 <parameters> 5985 <param id="thread"> 5986 <jthread null="current" frame="frame"/> 5987 <description> 5988 The thread of the frame containing the variable's value. 5989 </description> 5990 </param> 5991 <param id="depth"> 5992 <jframeID thread="thread"/> 5993 <description> 5994 The depth of the frame containing the variable's value. 5995 </description> 5996 </param> 5997 <param id="slot"> 5998 <jint/> 5999 <description> 6000 The variable's slot number. 6001 </description> 6002 </param> 6003 <param id="value"> 6004 <jobject/> 6005 <description> 6006 The new value for the variable. 6007 </description> 6008 </param> 6009 </parameters> 6010 <errors> 6011 <error id="JVMTI_ERROR_INVALID_SLOT"> 6012 Invalid <code>slot</code>. 6013 </error> 6014 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 6015 The variable type is not 6016 <code>Object</code> or a subclass of <code>Object</code>. 6017 </error> 6018 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 6019 The supplied <paramlink id="value"/> is not compatible 6020 with the variable type. 6021 </error> 6022 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 6023 Not a visible frame 6024 </error> 6025 </errors> 6026 </function> 6027 6028 <function id="SetLocalInt" num="27"> 6029 <synopsis>Set Local Variable - Int</synopsis> 6030 <description> 6031 This function can be used to set the value of a local 6032 variable whose type is <code>int</code>, 6033 <code>short</code>, <code>char</code>, <code>byte</code>, or 6034 <code>boolean</code>. 6035 </description> 6036 <origin>jvmdi</origin> 6037 <capabilities> 6038 <required id="can_access_local_variables"></required> 6039 </capabilities> 6040 <parameters> 6041 <param id="thread"> 6042 <jthread null="current" frame="frame"/> 6043 <description> 6044 The thread of the frame containing the variable's value. 6045 </description> 6046 </param> 6047 <param id="depth"> 6048 <jframeID thread="thread"/> 6049 <description> 6050 The depth of the frame containing the variable's value. 6051 </description> 6052 </param> 6053 <param id="slot"> 6054 <jint/> 6055 <description> 6056 The variable's slot number. 6057 </description> 6058 </param> 6059 <param id="value"> 6060 <jint/> 6061 <description> 6062 The new value for the variable. 6063 </description> 6064 </param> 6065 </parameters> 6066 <errors> 6067 <error id="JVMTI_ERROR_INVALID_SLOT"> 6068 Invalid <code>slot</code>. 6069 </error> 6070 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 6071 The variable type is not 6072 <code>int</code>, <code>short</code>, 6073 <code>char</code>, <code>byte</code>, or 6074 <code>boolean</code>. 6075 </error> 6076 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 6077 Not a visible frame 6078 </error> 6079 </errors> 6080 </function> 6081 6082 <function id="SetLocalLong" num="28"> 6083 <synopsis>Set Local Variable - Long</synopsis> 6084 <description> 6085 This function can be used to set the value of a local 6086 variable whose type is <code>long</code>. 6087 </description> 6088 <origin>jvmdi</origin> 6089 <capabilities> 6090 <required id="can_access_local_variables"></required> 6091 </capabilities> 6092 <parameters> 6093 <param id="thread"> 6094 <jthread null="current" frame="frame"/> 6095 <description> 6096 The thread of the frame containing the variable's value. 6097 </description> 6098 </param> 6099 <param id="depth"> 6100 <jframeID thread="thread"/> 6101 <description> 6102 The depth of the frame containing the variable's value. 6103 </description> 6104 </param> 6105 <param id="slot"> 6106 <jint/> 6107 <description> 6108 The variable's slot number. 6109 </description> 6110 </param> 6111 <param id="value"> 6112 <jlong/> 6113 <description> 6114 The new value for the variable. 6115 </description> 6116 </param> 6117 </parameters> 6118 <errors> 6119 <error id="JVMTI_ERROR_INVALID_SLOT"> 6120 Invalid <code>slot</code>. 6121 </error> 6122 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 6123 The variable type is not <code>long</code>. 6124 </error> 6125 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 6126 Not a visible frame 6127 </error> 6128 </errors> 6129 </function> 6130 6131 <function id="SetLocalFloat" num="29"> 6132 <synopsis>Set Local Variable - Float</synopsis> 6133 <description> 6134 This function can be used to set the value of a local 6135 variable whose type is <code>float</code>. 6136 </description> 6137 <origin>jvmdi</origin> 6138 <capabilities> 6139 <required id="can_access_local_variables"></required> 6140 </capabilities> 6141 <parameters> 6142 <param id="thread"> 6143 <jthread null="current" frame="frame"/> 6144 <description> 6145 The thread of the frame containing the variable's value. 6146 </description> 6147 </param> 6148 <param id="depth"> 6149 <jframeID thread="thread"/> 6150 <description> 6151 The depth of the frame containing the variable's value. 6152 </description> 6153 </param> 6154 <param id="slot"> 6155 <jint/> 6156 <description> 6157 The variable's slot number. 6158 </description> 6159 </param> 6160 <param id="value"> 6161 <jfloat/> 6162 <description> 6163 The new value for the variable. 6164 </description> 6165 </param> 6166 </parameters> 6167 <errors> 6168 <error id="JVMTI_ERROR_INVALID_SLOT"> 6169 Invalid <code>slot</code>. 6170 </error> 6171 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 6172 The variable type is not <code>float</code>. 6173 </error> 6174 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 6175 Not a visible frame 6176 </error> 6177 </errors> 6178 </function> 6179 6180 <function id="SetLocalDouble" num="30"> 6181 <synopsis>Set Local Variable - Double</synopsis> 6182 <description> 6183 This function can be used to set the value of a local 6184 variable whose type is <code>double</code>. 6185 </description> 6186 <origin>jvmdi</origin> 6187 <capabilities> 6188 <required id="can_access_local_variables"></required> 6189 </capabilities> 6190 <parameters> 6191 <param id="thread"> 6192 <jthread null="current" frame="frame"/> 6193 <description> 6194 The thread of the frame containing the variable's value. 6195 </description> 6196 </param> 6197 <param id="depth"> 6198 <jframeID thread="thread"/> 6199 <description> 6200 The depth of the frame containing the variable's value. 6201 </description> 6202 </param> 6203 <param id="slot"> 6204 <jint/> 6205 <description> 6206 The variable's slot number. 6207 </description> 6208 </param> 6209 <param id="value"> 6210 <jdouble/> 6211 <description> 6212 The new value for the variable. 6213 </description> 6214 </param> 6215 </parameters> 6216 <errors> 6217 <error id="JVMTI_ERROR_INVALID_SLOT"> 6218 Invalid <code>slot</code>. 6219 </error> 6220 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 6221 The variable type is not <code>double</code>. 6222 </error> 6223 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 6224 Not a visible frame 6225 </error> 6226 </errors> 6227 </function> 6228 </category> 6229 6230 <category id="breakpointCategory" label="Breakpoint"> 6231 6232 <intro> 6233 </intro> 6234 6235 <function id="SetBreakpoint" num="38"> 6236 <synopsis>Set Breakpoint</synopsis> 6237 <description> 6238 Set a breakpoint at the instruction indicated by 6239 <code>method</code> and <code>location</code>. 6240 An instruction can only have one breakpoint. 6241 <p/> 6242 Whenever the designated instruction is about to be executed, a 6243 <eventlink id="Breakpoint"></eventlink> event is generated. 6244 </description> 6245 <origin>jvmdi</origin> 6246 <capabilities> 6247 <required id="can_generate_breakpoint_events"></required> 6248 </capabilities> 6249 <parameters> 6250 <param id="klass"> 6251 <jclass method="method"/> 6252 <description> 6253 The class in which to set the breakpoint 6254 </description> 6255 </param> 6256 <param id="method"> 6257 <jmethodID class="klass"/> 6258 <description> 6259 The method in which to set the breakpoint 6260 </description> 6261 </param> 6262 <param id="location"> 6263 <jlocation/> 6264 <description> 6265 the index of the instruction at which to set the breakpoint 6266 6267 </description> 6268 </param> 6269 </parameters> 6270 <errors> 6271 <error id="JVMTI_ERROR_DUPLICATE"> 6272 The designated bytecode already has a breakpoint. 6273 </error> 6274 </errors> 6275 </function> 6276 6277 <function id="ClearBreakpoint" num="39"> 6278 <synopsis>Clear Breakpoint</synopsis> 6279 <description> 6280 Clear the breakpoint at the bytecode indicated by 6281 <code>method</code> and <code>location</code>. 6282 </description> 6283 <origin>jvmdi</origin> 6284 <capabilities> 6285 <required id="can_generate_breakpoint_events"></required> 6286 </capabilities> 6287 <parameters> 6288 <param id="klass"> 6289 <jclass method="method"/> 6290 <description> 6291 The class in which to clear the breakpoint 6292 </description> 6293 </param> 6294 <param id="method"> 6295 <jmethodID class="klass"/> 6296 <description> 6297 The method in which to clear the breakpoint 6298 </description> 6299 </param> 6300 <param id="location"> 6301 <jlocation/> 6302 <description> 6303 the index of the instruction at which to clear the breakpoint 6304 </description> 6305 </param> 6306 </parameters> 6307 <errors> 6308 <error id="JVMTI_ERROR_NOT_FOUND"> 6309 There's no breakpoint at the designated bytecode. 6310 </error> 6311 </errors> 6312 </function> 6313 6314 </category> 6315 6316 <category id="fieldWatch" label="Watched Field"> 6317 6318 <intro> 6319 </intro> 6320 6321 <function id="SetFieldAccessWatch" num="41"> 6322 <synopsis>Set Field Access Watch</synopsis> 6323 <description> 6324 Generate a <eventlink id="FieldAccess"></eventlink> event 6325 when the field specified 6326 by <code>klass</code> and 6327 <code>field</code> is about to be accessed. 6328 An event will be generated for each access of the field 6329 until it is canceled with 6330 <functionlink id="ClearFieldAccessWatch"></functionlink>. 6331 Field accesses from Java programming language code or from JNI code are watched, 6332 fields modified by other means are not watched. 6333 Note that <jvmti/> users should be aware that their own field accesses 6334 will trigger the watch. 6335 A field can only have one field access watch set. 6336 Modification of a field is not considered an access--use 6337 <functionlink id="SetFieldModificationWatch"></functionlink> 6338 to monitor modifications. 6339 </description> 6340 <origin>jvmdi</origin> 6341 <capabilities> 6342 <required id="can_generate_field_access_events"></required> 6343 </capabilities> 6344 <parameters> 6345 <param id="klass"> 6346 <jclass field="field"/> 6347 <description> 6348 The class containing the field to watch 6349 </description> 6350 </param> 6351 <param id="field"> 6352 <jfieldID class="klass"/> 6353 <description> 6354 The field to watch 6355 6356 </description> 6357 </param> 6358 </parameters> 6359 <errors> 6360 <error id="JVMTI_ERROR_DUPLICATE"> 6361 The designated field is already being watched for accesses. 6362 </error> 6363 </errors> 6364 </function> 6365 6366 <function id="ClearFieldAccessWatch" num="42"> 6367 <synopsis>Clear Field Access Watch</synopsis> 6368 <description> 6369 Cancel a field access watch previously set by 6370 <functionlink id="SetFieldAccessWatch"></functionlink>, on the 6371 field specified 6372 by <code>klass</code> and 6373 <code>field</code>. 6374 </description> 6375 <origin>jvmdi</origin> 6376 <capabilities> 6377 <required id="can_generate_field_access_events"></required> 6378 </capabilities> 6379 <parameters> 6380 <param id="klass"> 6381 <jclass field="field"/> 6382 <description> 6383 The class containing the field to watch 6384 </description> 6385 </param> 6386 <param id="field"> 6387 <jfieldID class="klass"/> 6388 <description> 6389 The field to watch 6390 6391 </description> 6392 </param> 6393 </parameters> 6394 <errors> 6395 <error id="JVMTI_ERROR_NOT_FOUND"> 6396 The designated field is not being watched for accesses. 6397 </error> 6398 </errors> 6399 </function> 6400 6401 <function id="SetFieldModificationWatch" num="43"> 6402 <synopsis>Set Field Modification Watch</synopsis> 6403 <description> 6404 Generate a <eventlink id="FieldModification"></eventlink> event 6405 when the field specified 6406 by <code>klass</code> and 6407 <code>field</code> is about to be modified. 6408 An event will be generated for each modification of the field 6409 until it is canceled with 6410 <functionlink id="ClearFieldModificationWatch"></functionlink>. 6411 Field modifications from Java programming language code or from JNI code are watched, 6412 fields modified by other means are not watched. 6413 Note that <jvmti/> users should be aware that their own field modifications 6414 will trigger the watch. 6415 A field can only have one field modification watch set. 6416 </description> 6417 <origin>jvmdi</origin> 6418 <capabilities> 6419 <required id="can_generate_field_modification_events"></required> 6420 </capabilities> 6421 <parameters> 6422 <param id="klass"> 6423 <jclass field="field"/> 6424 <description> 6425 The class containing the field to watch 6426 </description> 6427 </param> 6428 <param id="field"> 6429 <jfieldID class="klass"/> 6430 <description> 6431 The field to watch 6432 6433 </description> 6434 </param> 6435 </parameters> 6436 <errors> 6437 <error id="JVMTI_ERROR_DUPLICATE"> 6438 The designated field is already being watched for modifications. 6439 </error> 6440 </errors> 6441 </function> 6442 6443 <function id="ClearFieldModificationWatch" num="44"> 6444 <synopsis>Clear Field Modification Watch</synopsis> 6445 <description> 6446 6447 Cancel a field modification watch previously set by 6448 <functionlink id="SetFieldModificationWatch"></functionlink>, on the 6449 field specified 6450 by <code>klass</code> and 6451 <code>field</code>. 6452 </description> 6453 <origin>jvmdi</origin> 6454 <capabilities> 6455 <required id="can_generate_field_modification_events"></required> 6456 </capabilities> 6457 <parameters> 6458 <param id="klass"> 6459 <jclass field="field"/> 6460 <description> 6461 The class containing the field to watch 6462 </description> 6463 </param> 6464 <param id="field"> 6465 <jfieldID class="klass"/> 6466 <description> 6467 The field to watch 6468 6469 </description> 6470 </param> 6471 </parameters> 6472 <errors> 6473 <error id="JVMTI_ERROR_NOT_FOUND"> 6474 The designated field is not being watched for modifications. 6475 </error> 6476 </errors> 6477 </function> 6478 </category> 6479 6480 <category id="module" label="Module"> 6481 6482 <intro> 6483 </intro> 6484 6485 <function id="GetAllModules" num="3" since="9"> 6486 <synopsis>Get All Modules</synopsis> 6487 <description> 6488 Return an array of all modules loaded in the virtual machine. 6489 The array includes the unnamed module for each class loader. 6490 The number of modules in the array is returned via 6491 <code>module_count_ptr</code>, and the array itself via 6492 <code>modules_ptr</code>. 6493 <p/> 6494 </description> 6495 <origin>new</origin> 6496 <capabilities> 6497 </capabilities> 6498 <parameters> 6499 <param id="module_count_ptr"> 6500 <outptr><jint/></outptr> 6501 <description> 6502 On return, points to the number of returned modules. 6503 </description> 6504 </param> 6505 <param id="modules_ptr"> 6506 <allocbuf outcount="module_count_ptr"><jobject/></allocbuf> 6507 <description> 6508 On return, points to an array of references, one 6509 for each module. 6510 </description> 6511 </param> 6512 </parameters> 6513 <errors> 6514 </errors> 6515 </function> 6516 6517 <function id="GetNamedModule" num="40" since="9"> 6518 <synopsis>Get Named Module</synopsis> 6519 <description> 6520 Return the <code>java.lang.Module</code> object for a named 6521 module defined to a class loader that contains a given package. 6522 The module is returned via <code>module_ptr</code>. 6523 <p/> 6524 If a named module is defined to the class loader and it 6525 contains the package then that named module is returned, 6526 otherwise <code>NULL</code> is returned. 6527 <p/> 6528 </description> 6529 <origin>new</origin> 6530 <capabilities> 6531 </capabilities> 6532 <parameters> 6533 <param id="class_loader"> 6534 <ptrtype> 6535 <jobject/> 6536 <nullok>the bootstrap loader is assumed</nullok> 6537 </ptrtype> 6538 <description> 6539 A class loader. 6540 If the <code>class_loader</code> is not <code>NULL</code> 6541 or a subclass of <code>java.lang.ClassLoader</code> 6542 this function returns 6543 <errorlink id="JVMTI_ERROR_ILLEGAL_ARGUMENT"></errorlink>. 6544 </description> 6545 </param> 6546 <param id="package_name"> 6547 <inbuf><char/></inbuf> 6548 <description> 6549 The name of the package, encoded as a 6550 <internallink id="mUTF">modified UTF-8</internallink> string. 6551 The package name is in internal form (JVMS 4.2.1); 6552 identifiers are separated by forward slashes rather than periods. 6553 </description> 6554 </param> 6555 <param id="module_ptr"> 6556 <outptr><jobject/></outptr> 6557 <description> 6558 On return, points to a <code>java.lang.Module</code> object 6559 or points to <code>NULL</code>. 6560 </description> 6561 </param> 6562 </parameters> 6563 <errors> 6564 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 6565 If class loader is not <code>NULL</code> and is not a class loader object. 6566 </error> 6567 </errors> 6568 </function> 6569 6570 <function id="AddModuleReads" num="94" since="9"> 6571 <synopsis>Add Module Reads</synopsis> 6572 <description> 6573 Update a module to read another module. This function is a no-op 6574 when <paramlink id="module"></paramlink> is an unnamed module. 6575 This function facilitates the instrumentation of code 6576 in named modules where that instrumentation requires 6577 expanding the set of modules that a module reads. 6578 </description> 6579 <origin>new</origin> 6580 <capabilities> 6581 </capabilities> 6582 <parameters> 6583 <param id="module"> 6584 <ptrtype><jobject/></ptrtype> 6585 <description> 6586 The module to update. 6587 </description> 6588 </param> 6589 <param id="to_module"> 6590 <ptrtype><jobject/></ptrtype> 6591 <description> 6592 The additional module to read. 6593 </description> 6594 </param> 6595 </parameters> 6596 <errors> 6597 <error id="JVMTI_ERROR_INVALID_MODULE"> 6598 If <paramlink id="module"></paramlink> is not a module object. 6599 </error> 6600 <error id="JVMTI_ERROR_INVALID_MODULE"> 6601 If <paramlink id="to_module"></paramlink> is not a module object. 6602 </error> 6603 <error id="JVMTI_ERROR_UNMODIFIABLE_MODULE"> 6604 if the module cannot be modified. 6605 See <functionlink id="IsModifiableModule"/>. 6606 </error> 6607 </errors> 6608 </function> 6609 6610 <function id="AddModuleExports" num="95" since="9"> 6611 <synopsis>Add Module Exports</synopsis> 6612 <description> 6613 Update a module to export a package to another module. 6614 This function is a no-op when <paramlink id="module"></paramlink> 6615 is an unnamed module or an open module. 6616 This function facilitates the instrumentation of code 6617 in named modules where that instrumentation requires 6618 expanding the set of packages that a module exports. 6619 </description> 6620 <origin>new</origin> 6621 <capabilities> 6622 </capabilities> 6623 <parameters> 6624 <param id="module"> 6625 <ptrtype><jobject/></ptrtype> 6626 <description> 6627 The module to update. 6628 </description> 6629 </param> 6630 <param id="pkg_name"> 6631 <inbuf><char/></inbuf> 6632 <description> 6633 The exported package name. 6634 </description> 6635 </param> 6636 <param id="to_module"> 6637 <ptrtype><jobject/></ptrtype> 6638 <description> 6639 The module the package is exported to. 6640 If the <code>to_module</code> is not a subclass of 6641 <code>java.lang.Module</code> this function returns 6642 <errorlink id="JVMTI_ERROR_INVALID_MODULE"></errorlink>. 6643 </description> 6644 </param> 6645 </parameters> 6646 <errors> 6647 <error id="JVMTI_ERROR_INVALID_MODULE"> 6648 If <paramlink id="module"></paramlink> is not a module object. 6649 </error> 6650 <error id="JVMTI_ERROR_INVALID_MODULE"> 6651 If <paramlink id="to_module"></paramlink> is not a module object. 6652 </error> 6653 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 6654 If the package <paramlink id="pkg_name"></paramlink> 6655 does not belong to the module. 6656 </error> 6657 <error id="JVMTI_ERROR_UNMODIFIABLE_MODULE"> 6658 if the module cannot be modified. 6659 See <functionlink id="IsModifiableModule"/>. 6660 </error> 6661 </errors> 6662 </function> 6663 6664 <function id="AddModuleOpens" num="96" since="9"> 6665 <synopsis>Add Module Opens</synopsis> 6666 <description> 6667 Update a module to open a package to another module. 6668 This function is a no-op when <paramlink id="module"></paramlink> 6669 is an unnamed module or an open module. 6670 This function facilitates the instrumentation of code 6671 in modules where that instrumentation requires 6672 expanding the set of packages that a module opens to 6673 other modules. 6674 </description> 6675 <origin>new</origin> 6676 <capabilities> 6677 </capabilities> 6678 <parameters> 6679 <param id="module"> 6680 <ptrtype><jobject/></ptrtype> 6681 <description> 6682 The module to update. 6683 </description> 6684 </param> 6685 <param id="pkg_name"> 6686 <inbuf><char/></inbuf> 6687 <description> 6688 The package name of the package to open. 6689 </description> 6690 </param> 6691 <param id="to_module"> 6692 <ptrtype><jobject/></ptrtype> 6693 <description> 6694 The module with the package to open. 6695 If the <code>to_module</code> is not a subclass of 6696 <code>java.lang.Module</code> this function returns 6697 <errorlink id="JVMTI_ERROR_INVALID_MODULE"></errorlink>. 6698 </description> 6699 </param> 6700 </parameters> 6701 <errors> 6702 <error id="JVMTI_ERROR_INVALID_MODULE"> 6703 If <paramlink id="module"></paramlink> is not a module object. 6704 </error> 6705 <error id="JVMTI_ERROR_INVALID_MODULE"> 6706 If <paramlink id="to_module"></paramlink> is not a module object. 6707 </error> 6708 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 6709 If the package <paramlink id="pkg_name"></paramlink> 6710 does not belong to the module. 6711 </error> 6712 <error id="JVMTI_ERROR_UNMODIFIABLE_MODULE"> 6713 if the module cannot be modified. 6714 See <functionlink id="IsModifiableModule"/>. 6715 </error> 6716 </errors> 6717 </function> 6718 6719 <function id="AddModuleUses" num="97" since="9"> 6720 <synopsis>Add Module Uses</synopsis> 6721 <description> 6722 Updates a module to add a service to the set of services that 6723 a module uses. This function is a no-op when the module 6724 is an unnamed module. 6725 This function facilitates the instrumentation of code 6726 in named modules where that instrumentation requires 6727 expanding the set of services that a module is using. 6728 </description> 6729 <origin>new</origin> 6730 <capabilities> 6731 </capabilities> 6732 <parameters> 6733 <param id="module"> 6734 <ptrtype><jobject/></ptrtype> 6735 <description> 6736 The module to update. 6737 </description> 6738 </param> 6739 <param id="service"> 6740 <ptrtype><jclass/></ptrtype> 6741 <description> 6742 The service to use. 6743 </description> 6744 </param> 6745 </parameters> 6746 <errors> 6747 <error id="JVMTI_ERROR_INVALID_MODULE"> 6748 If <paramlink id="module"></paramlink> is not a module object. 6749 </error> 6750 <error id="JVMTI_ERROR_INVALID_CLASS"> 6751 If <paramlink id="service"></paramlink> is not a class object. 6752 </error> 6753 <error id="JVMTI_ERROR_UNMODIFIABLE_MODULE"> 6754 if the module cannot be modified. 6755 See <functionlink id="IsModifiableModule"/>. 6756 </error> 6757 </errors> 6758 </function> 6759 6760 <function id="AddModuleProvides" num="98" since="9"> 6761 <synopsis>Add Module Provides</synopsis> 6762 <description> 6763 Updates a module to add a service to the set of services that 6764 a module provides. This function is a no-op when the module 6765 is an unnamed module. 6766 This function facilitates the instrumentation of code 6767 in named modules where that instrumentation requires 6768 changes to the services that are provided. 6769 </description> 6770 <origin>new</origin> 6771 <capabilities> 6772 </capabilities> 6773 <parameters> 6774 <param id="module"> 6775 <ptrtype><jobject/></ptrtype> 6776 <description> 6777 The module to update. 6778 </description> 6779 </param> 6780 <param id="service"> 6781 <ptrtype><jclass/></ptrtype> 6782 <description> 6783 The service to provide. 6784 </description> 6785 </param> 6786 <param id="impl_class"> 6787 <ptrtype><jclass/></ptrtype> 6788 <description> 6789 The implementation class for the provided service. 6790 </description> 6791 </param> 6792 </parameters> 6793 <errors> 6794 <error id="JVMTI_ERROR_INVALID_MODULE"> 6795 If <paramlink id="module"></paramlink> is not a module object. 6796 </error> 6797 <error id="JVMTI_ERROR_INVALID_CLASS"> 6798 If <paramlink id="service"></paramlink> is not a class object. 6799 </error> 6800 <error id="JVMTI_ERROR_INVALID_CLASS"> 6801 If <paramlink id="impl_class"></paramlink> is not a class object. 6802 </error> 6803 <error id="JVMTI_ERROR_UNMODIFIABLE_MODULE"> 6804 if the module cannot be modified. 6805 See <functionlink id="IsModifiableModule"/>. 6806 </error> 6807 </errors> 6808 </function> 6809 6810 <function id="IsModifiableModule" num="99" since="9"> 6811 <synopsis>Is Modifiable Module</synopsis> 6812 <description> 6813 Determines whether a module is modifiable. 6814 If a module is modifiable then this module can be updated with 6815 <functionlink id="AddModuleReads"/>, <functionlink id="AddModuleExports"/>, 6816 <functionlink id="AddModuleOpens"/>, <functionlink id="AddModuleUses"/>, 6817 and <functionlink id="AddModuleProvides"/>. If a module is not modifiable 6818 then the module can not be updated with these functions. The result of 6819 this function is always <code>JNI_TRUE</code> when called to determine 6820 if an unnamed module is modifiable. 6821 </description> 6822 <origin>new</origin> 6823 <capabilities> 6824 </capabilities> 6825 <parameters> 6826 <param id="module"> 6827 <ptrtype><jobject/></ptrtype> 6828 <description> 6829 The module to query. 6830 </description> 6831 </param> 6832 <param id="is_modifiable_module_ptr"> 6833 <outptr><jboolean/></outptr> 6834 <description> 6835 On return, points to the boolean result of this function. 6836 </description> 6837 </param> 6838 </parameters> 6839 <errors> 6840 <error id="JVMTI_ERROR_INVALID_MODULE"> 6841 If <paramlink id="module"></paramlink> is not a module object. 6842 </error> 6843 </errors> 6844 </function> 6845 6846 </category> 6847 6848 <category id="class" label="Class"> 6849 6850 <intro> 6851 </intro> 6852 6853 <function id="GetLoadedClasses" jkernel="yes" num="78"> 6854 <synopsis>Get Loaded Classes</synopsis> 6855 <description> 6856 Return an array of all classes loaded in the virtual machine. 6857 The number of classes in the array is returned via 6858 <code>class_count_ptr</code>, and the array itself via 6859 <code>classes_ptr</code>. 6860 <p/> 6861 Array classes of all types (including arrays of primitive types) are 6862 included in the returned list. Primitive classes (for example, 6863 <code>java.lang.Integer.TYPE</code>) are <i>not</i> included in this list. 6864 </description> 6865 <origin>jvmdi</origin> 6866 <capabilities> 6867 </capabilities> 6868 <parameters> 6869 <param id="class_count_ptr"> 6870 <outptr><jint/></outptr> 6871 <description> 6872 On return, points to the number of classes. 6873 </description> 6874 </param> 6875 <param id="classes_ptr"> 6876 <allocbuf outcount="class_count_ptr"><jclass/></allocbuf> 6877 <description> 6878 On return, points to an array of references, one 6879 for each class. 6880 </description> 6881 </param> 6882 </parameters> 6883 <errors> 6884 </errors> 6885 </function> 6886 6887 <function id="GetClassLoaderClasses" jkernel="yes" num="79"> 6888 <synopsis>Get Classloader Classes</synopsis> 6889 <description> 6890 Returns an array of those classes for which this class loader has 6891 been recorded as an initiating loader. Each 6892 class in the returned array was created by this class loader, 6893 either by defining it directly or by delegation to another class loader. 6894 See <vmspec chapter="5.3"/>. 6895 <p/> 6896 The number of classes in the array is returned via 6897 <code>class_count_ptr</code>, and the array itself via 6898 <code>classes_ptr</code>. 6899 </description> 6900 <origin>jvmdi</origin> 6901 <capabilities> 6902 </capabilities> 6903 <parameters> 6904 <param id="initiating_loader"> 6905 <ptrtype> 6906 <jobject/> 6907 <nullok>the classes initiated by the bootstrap loader will be returned</nullok> 6908 </ptrtype> 6909 <description> 6910 An initiating class loader. 6911 </description> 6912 </param> 6913 <param id="class_count_ptr"> 6914 <outptr><jint/></outptr> 6915 <description> 6916 On return, points to the number of classes. 6917 </description> 6918 </param> 6919 <param id="classes_ptr"> 6920 <allocbuf outcount="class_count_ptr"><jclass/></allocbuf> 6921 <description> 6922 On return, points to an array of references, one 6923 for each class. 6924 </description> 6925 </param> 6926 </parameters> 6927 <errors> 6928 </errors> 6929 </function> 6930 6931 <function id="GetClassSignature" phase="start" num="48"> 6932 <synopsis>Get Class Signature</synopsis> 6933 <description> 6934 For the class indicated by <code>klass</code>, return the 6935 <externallink id="jni/types.html#type-signatures">JNI 6936 type signature</externallink> 6937 and the generic signature of the class. 6938 For example, <code>java.util.List</code> is <code>"Ljava/util/List;"</code> 6939 and <code>int[]</code> is <code>"[I"</code> 6940 The returned name for primitive classes 6941 is the type signature character of the corresponding primitive type. 6942 For example, <code>java.lang.Integer.TYPE</code> is <code>"I"</code>. 6943 </description> 6944 <origin>jvmdiClone</origin> 6945 <capabilities> 6946 </capabilities> 6947 <parameters> 6948 <param id="klass"> 6949 <jclass/> 6950 <description> 6951 The class to query. 6952 </description> 6953 </param> 6954 <param id="signature_ptr"> 6955 <allocbuf> 6956 <char/> 6957 <nullok>the signature is not returned</nullok> 6958 </allocbuf> 6959 <description> 6960 On return, points to the JNI type signature of the class, encoded as a 6961 <internallink id="mUTF">modified UTF-8</internallink> string. 6962 </description> 6963 </param> 6964 <param id="generic_ptr"> 6965 <allocbuf> 6966 <char/> 6967 <nullok>the generic signature is not returned</nullok> 6968 </allocbuf> 6969 <description> 6970 On return, points to the generic signature of the class, encoded as a 6971 <internallink id="mUTF">modified UTF-8</internallink> string. 6972 If there is no generic signature attribute for the class, then, 6973 on return, points to <code>NULL</code>. 6974 </description> 6975 </param> 6976 </parameters> 6977 <errors> 6978 </errors> 6979 </function> 6980 6981 <function id="GetClassStatus" phase="start" num="49"> 6982 <synopsis>Get Class Status</synopsis> 6983 <description> 6984 Get the status of the class. Zero or more of the following bits can be 6985 set. 6986 <constants id="jvmtiClassStatus" label="Class Status Flags" kind="bits"> 6987 <constant id="JVMTI_CLASS_STATUS_VERIFIED" num="1"> 6988 Class bytecodes have been verified 6989 </constant> 6990 <constant id="JVMTI_CLASS_STATUS_PREPARED" num="2"> 6991 Class preparation is complete 6992 </constant> 6993 <constant id="JVMTI_CLASS_STATUS_INITIALIZED" num="4"> 6994 Class initialization is complete. Static initializer has been run. 6995 </constant> 6996 <constant id="JVMTI_CLASS_STATUS_ERROR" num="8"> 6997 Error during initialization makes class unusable 6998 </constant> 6999 <constant id="JVMTI_CLASS_STATUS_ARRAY" num="16"> 7000 Class is an array. If set, all other bits are zero. 7001 </constant> 7002 <constant id="JVMTI_CLASS_STATUS_PRIMITIVE" num="32"> 7003 Class is a primitive class (for example, <code>java.lang.Integer.TYPE</code>). 7004 If set, all other bits are zero. 7005 </constant> 7006 </constants> 7007 </description> 7008 <origin>jvmdi</origin> 7009 <capabilities> 7010 </capabilities> 7011 <parameters> 7012 <param id="klass"> 7013 <jclass/> 7014 <description> 7015 The class to query. 7016 </description> 7017 </param> 7018 <param id="status_ptr"> 7019 <outptr><jint/></outptr> 7020 <description> 7021 On return, points to the current state of this class as one or 7022 more of the <internallink id="jvmtiClassStatus">class status flags</internallink>. 7023 </description> 7024 </param> 7025 </parameters> 7026 <errors> 7027 </errors> 7028 </function> 7029 7030 <function id="GetSourceFileName" phase="start" num="50"> 7031 <synopsis>Get Source File Name</synopsis> 7032 <description> 7033 For the class indicated by <code>klass</code>, return the source file 7034 name via <code>source_name_ptr</code>. The returned string 7035 is a file name only and never contains a directory name. 7036 <p/> 7037 For primitive classes (for example, <code>java.lang.Integer.TYPE</code>) 7038 and for arrays this function returns 7039 <errorlink id="JVMTI_ERROR_ABSENT_INFORMATION"></errorlink>. 7040 </description> 7041 <origin>jvmdi</origin> 7042 <capabilities> 7043 <required id="can_get_source_file_name"></required> 7044 </capabilities> 7045 <parameters> 7046 <param id="klass"> 7047 <jclass/> 7048 <description> 7049 The class to query. 7050 </description> 7051 </param> 7052 <param id="source_name_ptr"> 7053 <allocbuf><char/></allocbuf> 7054 <description> 7055 On return, points to the class's source file name, encoded as a 7056 <internallink id="mUTF">modified UTF-8</internallink> string. 7057 </description> 7058 </param> 7059 </parameters> 7060 <errors> 7061 <error id="JVMTI_ERROR_ABSENT_INFORMATION"> 7062 Class information does not include a source file name. This includes 7063 cases where the class is an array class or primitive class. 7064 </error> 7065 </errors> 7066 </function> 7067 7068 <function id="GetClassModifiers" phase="start" num="51"> 7069 <synopsis>Get Class Modifiers</synopsis> 7070 <description> 7071 For the class indicated by <code>klass</code>, return the access 7072 flags 7073 via <code>modifiers_ptr</code>. 7074 Access flags are defined in <vmspec chapter="4"/>. 7075 <p/> 7076 If the class is an array class, then its public, private, and protected 7077 modifiers are the same as those of its component type. For arrays of 7078 primitives, this component type is represented by one of the primitive 7079 classes (for example, <code>java.lang.Integer.TYPE</code>). 7080 <p/> 7081 If the class is a primitive class, its public modifier is always true, 7082 and its protected and private modifiers are always false. 7083 <p/> 7084 If the class is an array class or a primitive class then its final 7085 modifier is always true and its interface modifier is always false. 7086 The values of its other modifiers are not determined by this specification. 7087 7088 </description> 7089 <origin>jvmdi</origin> 7090 <capabilities> 7091 </capabilities> 7092 <parameters> 7093 <param id="klass"> 7094 <jclass/> 7095 <description> 7096 The class to query. 7097 </description> 7098 </param> 7099 <param id="modifiers_ptr"> 7100 <outptr><jint/></outptr> 7101 <description> 7102 On return, points to the current access flags of this class. 7103 7104 </description> 7105 </param> 7106 </parameters> 7107 <errors> 7108 </errors> 7109 </function> 7110 7111 <function id="GetClassMethods" phase="start" num="52"> 7112 <synopsis>Get Class Methods</synopsis> 7113 <description> 7114 For the class indicated by <code>klass</code>, return a count of 7115 methods via <code>method_count_ptr</code> and a list of 7116 method IDs via <code>methods_ptr</code>. The method list contains 7117 constructors and static initializers as well as true methods. 7118 Only directly declared methods are returned (not inherited methods). 7119 An empty method list is returned for array classes and primitive classes 7120 (for example, <code>java.lang.Integer.TYPE</code>). 7121 </description> 7122 <origin>jvmdi</origin> 7123 <capabilities> 7124 <capability id="can_maintain_original_method_order"/> 7125 </capabilities> 7126 <parameters> 7127 <param id="klass"> 7128 <jclass/> 7129 <description> 7130 The class to query. 7131 </description> 7132 </param> 7133 <param id="method_count_ptr"> 7134 <outptr><jint/></outptr> 7135 <description> 7136 On return, points to the number of methods declared in this class. 7137 </description> 7138 </param> 7139 <param id="methods_ptr"> 7140 <allocbuf outcount="method_count_ptr"><jmethodID class="klass"/></allocbuf> 7141 <description> 7142 On return, points to the method ID array. 7143 </description> 7144 </param> 7145 </parameters> 7146 <errors> 7147 <error id="JVMTI_ERROR_CLASS_NOT_PREPARED"> 7148 <paramlink id="klass"></paramlink> is not prepared. 7149 </error> 7150 </errors> 7151 </function> 7152 7153 <function id="GetClassFields" phase="start" num="53"> 7154 <synopsis>Get Class Fields</synopsis> 7155 <description> 7156 For the class indicated by <code>klass</code>, return a count of fields 7157 via <code>field_count_ptr</code> and a list of field IDs via 7158 <code>fields_ptr</code>. 7159 Only directly declared fields are returned (not inherited fields). 7160 Fields are returned in the order they occur in the class file. 7161 An empty field list is returned for array classes and primitive classes 7162 (for example, <code>java.lang.Integer.TYPE</code>). 7163 Use JNI to determine the length of an array. 7164 </description> 7165 <origin>jvmdi</origin> 7166 <capabilities> 7167 </capabilities> 7168 <parameters> 7169 <param id="klass"> 7170 <jclass/> 7171 <description> 7172 The class to query. 7173 </description> 7174 </param> 7175 <param id="field_count_ptr"> 7176 <outptr><jint/></outptr> 7177 <description> 7178 On return, points to the number of fields declared in this class. 7179 </description> 7180 </param> 7181 <param id="fields_ptr"> 7182 <allocbuf outcount="field_count_ptr"><jfieldID/></allocbuf> 7183 <description> 7184 On return, points to the field ID array. 7185 </description> 7186 </param> 7187 </parameters> 7188 <errors> 7189 <error id="JVMTI_ERROR_CLASS_NOT_PREPARED"> 7190 <paramlink id="klass"></paramlink> is not prepared. 7191 </error> 7192 </errors> 7193 </function> 7194 7195 <function id="GetImplementedInterfaces" phase="start" num="54"> 7196 <synopsis>Get Implemented Interfaces</synopsis> 7197 <description> 7198 Return the direct super-interfaces of this class. For a class, this 7199 function returns the interfaces declared in its <code>implements</code> 7200 clause. For an interface, this function returns the interfaces declared in 7201 its <code>extends</code> clause. 7202 An empty interface list is returned for array classes and primitive classes 7203 (for example, <code>java.lang.Integer.TYPE</code>). 7204 </description> 7205 <origin>jvmdi</origin> 7206 <capabilities> 7207 </capabilities> 7208 <parameters> 7209 <param id="klass"> 7210 <jclass/> 7211 <description> 7212 The class to query. 7213 </description> 7214 </param> 7215 <param id="interface_count_ptr"> 7216 <outptr><jint/></outptr> 7217 <description> 7218 On return, points to the number of interfaces. 7219 </description> 7220 </param> 7221 <param id="interfaces_ptr"> 7222 <allocbuf outcount="interface_count_ptr"><jclass/></allocbuf> 7223 <description> 7224 On return, points to the interface array. 7225 </description> 7226 </param> 7227 </parameters> 7228 <errors> 7229 <error id="JVMTI_ERROR_CLASS_NOT_PREPARED"> 7230 <paramlink id="klass"></paramlink> is not prepared. 7231 </error> 7232 </errors> 7233 </function> 7234 7235 <function id="GetClassVersionNumbers" phase="start" num="145" since="1.1"> 7236 <synopsis>Get Class Version Numbers</synopsis> 7237 <description> 7238 For the class indicated by <code>klass</code>, 7239 return the minor and major version numbers, 7240 as defined in 7241 <vmspec chapter="4"/>. 7242 </description> 7243 <origin>new</origin> 7244 <capabilities> 7245 </capabilities> 7246 <parameters> 7247 <param id="klass"> 7248 <jclass/> 7249 <description> 7250 The class to query. 7251 </description> 7252 </param> 7253 <param id="minor_version_ptr"> 7254 <outptr><jint/></outptr> 7255 <description> 7256 On return, points to the value of the 7257 <code>minor_version</code> item of the 7258 Class File Format. 7259 Note: to be consistent with the Class File Format, 7260 the minor version number is the first parameter. 7261 </description> 7262 </param> 7263 <param id="major_version_ptr"> 7264 <outptr><jint/></outptr> 7265 <description> 7266 On return, points to the value of the 7267 <code>major_version</code> item of the 7268 Class File Format. 7269 </description> 7270 </param> 7271 </parameters> 7272 <errors> 7273 <error id="JVMTI_ERROR_ABSENT_INFORMATION"> 7274 The class is a primitive or array class. 7275 </error> 7276 </errors> 7277 </function> 7278 7279 <function id="GetConstantPool" phase="start" num="146" since="1.1"> 7280 <synopsis>Get Constant Pool</synopsis> 7281 <description> 7282 For the class indicated by <code>klass</code>, 7283 return the raw bytes of the constant pool in the format of the 7284 <code>constant_pool</code> item of 7285 <vmspec chapter="4"/>. 7286 The format of the constant pool may differ between versions 7287 of the Class File Format, so, the 7288 <functionlink id="GetClassVersionNumbers">minor and major 7289 class version numbers</functionlink> should be checked for 7290 compatibility. 7291 <p/> 7292 The returned constant pool might not have the same layout or 7293 contents as the constant pool in the defining class file. 7294 The constant pool returned by GetConstantPool() may have 7295 more or fewer entries than the defining constant pool. 7296 Entries may be in a different order. 7297 The constant pool returned by GetConstantPool() will match the 7298 constant pool used by 7299 <functionlink id="GetBytecodes">GetBytecodes()</functionlink>. 7300 That is, the bytecodes returned by GetBytecodes() will have 7301 constant pool indices which refer to constant pool entries returned 7302 by GetConstantPool(). 7303 Note that since <functionlink id="RetransformClasses"/> 7304 and <functionlink id="RedefineClasses"/> can change 7305 the constant pool, the constant pool returned by this function 7306 can change accordingly. Thus, the correspondence between 7307 GetConstantPool() and GetBytecodes() does not hold if there 7308 is an intervening class retransformation or redefinition. 7309 The value of a constant pool entry used by a given bytecode will 7310 match that of the defining class file (even if the indices don't match). 7311 Constant pool entries which are not used directly or indirectly by 7312 bytecodes (for example, UTF-8 strings associated with annotations) are 7313 not required to exist in the returned constant pool. 7314 </description> 7315 <origin>new</origin> 7316 <capabilities> 7317 <required id="can_get_constant_pool"></required> 7318 </capabilities> 7319 <parameters> 7320 <param id="klass"> 7321 <jclass/> 7322 <description> 7323 The class to query. 7324 </description> 7325 </param> 7326 <param id="constant_pool_count_ptr"> 7327 <outptr><jint/></outptr> 7328 <description> 7329 On return, points to the number of entries 7330 in the constant pool table plus one. 7331 This corresponds to the <code>constant_pool_count</code> 7332 item of the Class File Format. 7333 </description> 7334 </param> 7335 <param id="constant_pool_byte_count_ptr"> 7336 <outptr><jint/></outptr> 7337 <description> 7338 On return, points to the number of bytes 7339 in the returned raw constant pool. 7340 </description> 7341 </param> 7342 <param id="constant_pool_bytes_ptr"> 7343 <allocbuf outcount="constant_pool_byte_count_ptr"><uchar/></allocbuf> 7344 <description> 7345 On return, points to the raw constant pool, that is the bytes 7346 defined by the <code>constant_pool</code> item of the 7347 Class File Format 7348 </description> 7349 </param> 7350 </parameters> 7351 <errors> 7352 <error id="JVMTI_ERROR_ABSENT_INFORMATION"> 7353 The class is a primitive or array class. 7354 </error> 7355 </errors> 7356 </function> 7357 7358 <function id="IsInterface" phase="start" num="55"> 7359 <synopsis>Is Interface</synopsis> 7360 <description> 7361 Determines whether a class object reference represents an interface. 7362 The <code>jboolean</code> result is 7363 <code>JNI_TRUE</code> if the "class" is actually an interface, 7364 <code>JNI_FALSE</code> otherwise. 7365 </description> 7366 <origin>jvmdi</origin> 7367 <capabilities> 7368 </capabilities> 7369 <parameters> 7370 <param id="klass"> 7371 <jclass/> 7372 <description> 7373 The class to query. 7374 </description> 7375 </param> 7376 <param id="is_interface_ptr"> 7377 <outptr><jboolean/></outptr> 7378 <description> 7379 On return, points to the boolean result of this function. 7380 7381 </description> 7382 </param> 7383 </parameters> 7384 <errors> 7385 </errors> 7386 </function> 7387 7388 <function id="IsArrayClass" phase="start" num="56"> 7389 <synopsis>Is Array Class</synopsis> 7390 <description> 7391 Determines whether a class object reference represents an array. 7392 The <code>jboolean</code> result is 7393 <code>JNI_TRUE</code> if the class is an array, 7394 <code>JNI_FALSE</code> otherwise. 7395 </description> 7396 <origin>jvmdi</origin> 7397 <capabilities> 7398 </capabilities> 7399 <parameters> 7400 <param id="klass"> 7401 <jclass/> 7402 <description> 7403 The class to query. 7404 </description> 7405 </param> 7406 <param id="is_array_class_ptr"> 7407 <outptr><jboolean/></outptr> 7408 <description> 7409 On return, points to the boolean result of this function. 7410 7411 </description> 7412 </param> 7413 </parameters> 7414 <errors> 7415 </errors> 7416 </function> 7417 7418 <function id="IsModifiableClass" jkernel="yes" phase="start" num="45" since="1.1"> 7419 <synopsis>Is Modifiable Class</synopsis> 7420 <description> 7421 Determines whether a class is modifiable. 7422 If a class is modifiable (<paramlink id="is_modifiable_class_ptr"/> 7423 returns <code>JNI_TRUE</code>) the class can be 7424 redefined with <functionlink id="RedefineClasses"/> (assuming 7425 the agent possesses the 7426 <fieldlink id="can_redefine_classes" struct="jvmtiCapabilities"/> 7427 capability) or 7428 retransformed with <functionlink id="RetransformClasses"/> (assuming 7429 the agent possesses the 7430 <fieldlink id="can_retransform_classes" struct="jvmtiCapabilities"/> 7431 capability). 7432 If a class is not modifiable (<paramlink id="is_modifiable_class_ptr"/> 7433 returns <code>JNI_FALSE</code>) the class can be neither 7434 redefined nor retransformed. 7435 <p/> 7436 Primitive classes (for example, <code>java.lang.Integer.TYPE</code>), 7437 array classes, and some implementation defined classes are never modifiable. 7438 <p/> 7439 </description> 7440 <origin>new</origin> 7441 <capabilities> 7442 <capability id="can_redefine_any_class"> 7443 If possessed then all classes (except primitive, array, and some implementation defined 7444 classes) are modifiable with <functionlink id="RedefineClasses"/>. 7445 </capability> 7446 <capability id="can_retransform_any_class"> 7447 If possessed then all classes (except primitive, array, and some implementation defined 7448 classes) are modifiable with <functionlink id="RetransformClasses"/>. 7449 </capability> 7450 <capability id="can_redefine_classes"> 7451 No effect on the result of the function. 7452 But must additionally be possessed to modify the class with 7453 <functionlink id="RedefineClasses"/>. 7454 </capability> 7455 <capability id="can_retransform_classes"> 7456 No effect on the result of the function. 7457 But must additionally be possessed to modify the class with 7458 <functionlink id="RetransformClasses"/>. 7459 </capability> 7460 </capabilities> 7461 <parameters> 7462 <param id="klass"> 7463 <jclass/> 7464 <description> 7465 The class to query. 7466 </description> 7467 </param> 7468 <param id="is_modifiable_class_ptr"> 7469 <outptr><jboolean/></outptr> 7470 <description> 7471 On return, points to the boolean result of this function. 7472 </description> 7473 </param> 7474 </parameters> 7475 <errors> 7476 </errors> 7477 </function> 7478 7479 <function id="GetClassLoader" phase="start" num="57"> 7480 <synopsis>Get Class Loader</synopsis> 7481 <description> 7482 For the class indicated by <code>klass</code>, return via 7483 <code>classloader_ptr</code> a reference to the class loader for the 7484 class. 7485 </description> 7486 <origin>jvmdi</origin> 7487 <capabilities> 7488 </capabilities> 7489 <parameters> 7490 <param id="klass"> 7491 <jclass/> 7492 <description> 7493 The class to query. 7494 </description> 7495 </param> 7496 <param id="classloader_ptr"> 7497 <outptr><jobject/></outptr> 7498 <description> 7499 On return, points to the class loader that loaded 7500 this class. 7501 If the class was not created by a class loader 7502 or if the class loader is the bootstrap class loader, 7503 points to <code>NULL</code>. 7504 </description> 7505 </param> 7506 </parameters> 7507 <errors> 7508 </errors> 7509 7510 </function> 7511 7512 <function id="GetSourceDebugExtension" phase="start" num="90"> 7513 <synopsis>Get Source Debug Extension</synopsis> 7514 <description> 7515 For the class indicated by <code>klass</code>, return the debug 7516 extension via <code>source_debug_extension_ptr</code>. 7517 The returned string 7518 contains exactly the debug extension information present in the 7519 class file of <code>klass</code>. 7520 </description> 7521 <origin>jvmdi</origin> 7522 <capabilities> 7523 <required id="can_get_source_debug_extension"></required> 7524 </capabilities> 7525 <parameters> 7526 <param id="klass"> 7527 <jclass/> 7528 <description> 7529 The class to query. 7530 </description> 7531 </param> 7532 <param id="source_debug_extension_ptr"> 7533 <allocbuf><char/></allocbuf> 7534 <description> 7535 On return, points to the class's debug extension, encoded as a 7536 <internallink id="mUTF">modified UTF-8</internallink> string. 7537 </description> 7538 </param> 7539 </parameters> 7540 <errors> 7541 <error id="JVMTI_ERROR_ABSENT_INFORMATION"> 7542 Class information does not include a debug extension. 7543 </error> 7544 </errors> 7545 </function> 7546 7547 <function id="RetransformClasses" jkernel="yes" num="152" since="1.1"> 7548 <synopsis>Retransform Classes</synopsis> 7549 <description> 7550 This function facilitates the 7551 <internallink id="bci">bytecode instrumentation</internallink> 7552 of already loaded classes. 7553 To replace the class definition without reference to the existing 7554 bytecodes, as one might do when recompiling from source for 7555 fix-and-continue debugging, <functionlink id="RedefineClasses"/> 7556 function should be used instead. 7557 <p/> 7558 When classes are initially loaded or when they are 7559 <functionlink id="RedefineClasses">redefined</functionlink>, 7560 the initial class file bytes can be transformed with the 7561 <eventlink id="ClassFileLoadHook"/> event. 7562 This function reruns the transformation process 7563 (whether or not a transformation has previously occurred). 7564 This retransformation follows these steps: 7565 <ul> 7566 <li>starting from the initial class file bytes 7567 </li> 7568 <li>for each <fieldlink id="can_retransform_classes" 7569 struct="jvmtiCapabilities">retransformation 7570 incapable</fieldlink> 7571 agent which received a 7572 <code>ClassFileLoadHook</code> event during the previous 7573 load or redefine, the bytes it returned 7574 (via the <code>new_class_data</code> parameter) 7575 are reused as the output of the transformation; 7576 note that this is equivalent to reapplying 7577 the previous transformation, unaltered. except that 7578 the <code>ClassFileLoadHook</code> event 7579 is <b>not</b> sent to these agents 7580 </li> 7581 <li>for each <fieldlink id="can_retransform_classes" 7582 struct="jvmtiCapabilities">retransformation 7583 capable</fieldlink> 7584 agent, the <code>ClassFileLoadHook</code> event is sent, 7585 allowing a new transformation to be applied 7586 </li> 7587 <li>the transformed class file bytes are installed as the new 7588 definition of the class 7589 </li> 7590 </ul> 7591 See the <eventlink id="ClassFileLoadHook"/> event for more details. 7592 <p/> 7593 The initial class file bytes represent the bytes passed to 7594 <code>ClassLoader.defineClass</code> 7595 or <code>RedefineClasses</code> (before any transformations 7596 were applied), however they may not exactly match them. 7597 The constant pool may differ in ways described in 7598 <functionlink id="GetConstantPool"/>. 7599 Constant pool indices in the bytecodes of methods will correspond. 7600 Some attributes may not be present. 7601 Where order is not meaningful, for example the order of methods, 7602 order may not be preserved. 7603 <p/> 7604 Retransformation can cause new versions of methods to be installed. 7605 Old method versions may become 7606 <internallink id="obsoleteMethods">obsolete</internallink> 7607 The new method version will be used on new invokes. 7608 If a method has active stack frames, those active frames continue to 7609 run the bytecodes of the original method version. 7610 <p/> 7611 This function does not cause any initialization except that which 7612 would occur under the customary JVM semantics. 7613 In other words, retransforming a class does not cause its initializers to be 7614 run. The values of static fields will remain as they were 7615 prior to the call. 7616 <p/> 7617 Threads need not be suspended. 7618 <p/> 7619 All breakpoints in the class are cleared. 7620 <p/> 7621 All attributes are updated. 7622 <p/> 7623 Instances of the retransformed class are not affected -- fields retain their 7624 previous values. 7625 <functionlink id="GetTag">Tags</functionlink> on the instances are 7626 also unaffected. 7627 <p/> 7628 In response to this call, no events other than the 7629 <eventlink id="ClassFileLoadHook"/> event 7630 will be sent. 7631 <p/> 7632 The retransformation may change method bodies, the constant pool and attributes 7633 (unless explicitly prohibited). 7634 The retransformation must not add, remove or rename fields or methods, change the 7635 signatures of methods, change modifiers, or change inheritance. 7636 The retransformation must not change the <code>NestHost</code>, 7637 <code>NestMembers</code>, or <code>Record</code> attributes. 7638 These restrictions may be lifted in future versions. 7639 See the error return description below for information on error codes 7640 returned if an unsupported retransformation is attempted. 7641 The class file bytes are not verified or installed until they have passed 7642 through the chain of <eventlink id="ClassFileLoadHook"/> events, thus the 7643 returned error code reflects the result of the transformations. 7644 If any error code is returned other than <code>JVMTI_ERROR_NONE</code>, 7645 none of the classes to be retransformed will have a new definition installed. 7646 When this function returns (with the error code of <code>JVMTI_ERROR_NONE</code>) 7647 all of the classes to be retransformed will have their new definitions installed. 7648 </description> 7649 <origin>new</origin> 7650 <capabilities> 7651 <required id="can_retransform_classes"></required> 7652 <capability id="can_retransform_any_class"></capability> 7653 </capabilities> 7654 <parameters> 7655 <param id="class_count"> 7656 <jint min="0"/> 7657 <description> 7658 The number of classes to be retransformed. 7659 </description> 7660 </param> 7661 <param id="classes"> 7662 <inbuf incount="class_count"><jclass/></inbuf> 7663 <description> 7664 The array of classes to be retransformed. 7665 </description> 7666 </param> 7667 </parameters> 7668 <errors> 7669 <error id="JVMTI_ERROR_UNMODIFIABLE_CLASS"> 7670 One of the <paramlink id="classes"/> cannot be modified. 7671 See <functionlink id="IsModifiableClass"/>. 7672 </error> 7673 <error id="JVMTI_ERROR_INVALID_CLASS"> 7674 One of the <paramlink id="classes"/> is not a valid class. 7675 </error> 7676 <error id="JVMTI_ERROR_UNSUPPORTED_VERSION"> 7677 A retransformed class file has a version number not supported by this VM. 7678 </error> 7679 <error id="JVMTI_ERROR_INVALID_CLASS_FORMAT"> 7680 A retransformed class file is malformed (The VM would return a <code>ClassFormatError</code>). 7681 </error> 7682 <error id="JVMTI_ERROR_CIRCULAR_CLASS_DEFINITION"> 7683 The retransformed class file definitions would lead to a circular definition 7684 (the VM would return a <code>ClassCircularityError</code>). 7685 </error> 7686 <error id="JVMTI_ERROR_FAILS_VERIFICATION"> 7687 The retransformed class file bytes fail verification. 7688 </error> 7689 <error id="JVMTI_ERROR_NAMES_DONT_MATCH"> 7690 The class name defined in a retransformed class file is 7691 different from the name in the old class object. 7692 </error> 7693 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_ADDED"> 7694 A retransformed class file would require adding a method. 7695 </error> 7696 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED"> 7697 A retransformed class file changes a field. 7698 </error> 7699 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED"> 7700 A direct superclass is different for a retransformed class file, 7701 or the set of directly implemented 7702 interfaces is different. 7703 </error> 7704 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_DELETED"> 7705 A retransformed class file does not declare a method 7706 declared in the old class version. 7707 </error> 7708 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_ATTRIBUTE_CHANGED"> 7709 A retransformed class file has unsupported differences in class attributes. 7710 </error> 7711 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED"> 7712 A retransformed class file has different class modifiers. 7713 </error> 7714 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED"> 7715 A method in the retransformed class file has different modifiers 7716 than its counterpart in the old class version. 7717 </error> 7718 </errors> 7719 </function> 7720 7721 <function id="RedefineClasses" jkernel="yes" num="87"> 7722 <synopsis>Redefine Classes</synopsis> 7723 <typedef id="jvmtiClassDefinition" label="Class redefinition description"> 7724 <field id="klass"> 7725 <jclass/> 7726 <description> 7727 Class object for this class 7728 </description> 7729 </field> 7730 <field id="class_byte_count"> 7731 <jint/> 7732 <description> 7733 Number of bytes defining class (below) 7734 </description> 7735 </field> 7736 <field id="class_bytes"> 7737 <inbuf incount="class_byte_count"><uchar/></inbuf> 7738 <description> 7739 Bytes defining class (in <vmspec chapter="4"/>) 7740 </description> 7741 </field> 7742 </typedef> 7743 <description> 7744 All classes given are redefined according to the definitions 7745 supplied. 7746 This function is used to replace the definition of a class 7747 with a new definition, as might be needed in fix-and-continue 7748 debugging. 7749 Where the existing class file bytes are to be transformed, for 7750 example in 7751 <internallink id="bci">bytecode instrumentation</internallink>, 7752 <functionlink id="RetransformClasses"/> should be used. 7753 <p/> 7754 Redefinition can cause new versions of methods to be installed. 7755 Old method versions may become 7756 <internallink id="obsoleteMethods">obsolete</internallink> 7757 The new method version will be used on new invokes. 7758 If a method has active stack frames, those active frames continue to 7759 run the bytecodes of the original method version. 7760 If resetting of stack frames is desired, use 7761 <functionlink id="PopFrame"></functionlink> 7762 to pop frames with obsolete method versions. 7763 <p/> 7764 This function does not cause any initialization except that which 7765 would occur under the customary JVM semantics. 7766 In other words, redefining a class does not cause its initializers to be 7767 run. The values of static fields will remain as they were 7768 prior to the call. 7769 <p/> 7770 Threads need not be suspended. 7771 <p/> 7772 All breakpoints in the class are cleared. 7773 <p/> 7774 All attributes are updated. 7775 <p/> 7776 Instances of the redefined class are not affected -- fields retain their 7777 previous values. 7778 <functionlink id="GetTag">Tags</functionlink> on the instances are 7779 also unaffected. 7780 <p/> 7781 In response to this call, the <jvmti/> event 7782 <eventlink id="ClassFileLoadHook">Class File Load Hook</eventlink> 7783 will be sent (if enabled), but no other <jvmti/> events will be sent. 7784 <p/> 7785 The redefinition may change method bodies, the constant pool and attributes 7786 (unless explicitly prohibited). 7787 The redefinition must not add, remove or rename fields or methods, change the 7788 signatures of methods, change modifiers, or change inheritance. 7789 The redefinition must not change the <code>NestHost</code>, 7790 <code>NestMembers</code>, or <code>Record</code> attributes. 7791 These restrictions may be lifted in future versions. 7792 See the error return description below for information on error codes 7793 returned if an unsupported redefinition is attempted. 7794 The class file bytes are not verified or installed until they have passed 7795 through the chain of <eventlink id="ClassFileLoadHook"/> events, thus the 7796 returned error code reflects the result of the transformations applied 7797 to the bytes passed into <paramlink id="class_definitions"/>. 7798 If any error code is returned other than <code>JVMTI_ERROR_NONE</code>, 7799 none of the classes to be redefined will have a new definition installed. 7800 When this function returns (with the error code of <code>JVMTI_ERROR_NONE</code>) 7801 all of the classes to be redefined will have their new definitions installed. 7802 </description> 7803 <origin>jvmdi</origin> 7804 <capabilities> 7805 <required id="can_redefine_classes"></required> 7806 <capability id="can_redefine_any_class"></capability> 7807 </capabilities> 7808 <parameters> 7809 <param id="class_count"> 7810 <jint min="0"/> 7811 <description> 7812 The number of classes specified in <code>class_definitions</code> 7813 </description> 7814 </param> 7815 <param id="class_definitions"> 7816 <inbuf incount="class_count"><struct>jvmtiClassDefinition</struct></inbuf> 7817 <description> 7818 The array of new class definitions 7819 </description> 7820 </param> 7821 </parameters> 7822 <errors> 7823 <error id="JVMTI_ERROR_NULL_POINTER"> 7824 One of <code>class_bytes</code> is <code>NULL</code>. 7825 </error> 7826 <error id="JVMTI_ERROR_UNMODIFIABLE_CLASS"> 7827 An element of <code>class_definitions</code> cannot be modified. 7828 See <functionlink id="IsModifiableClass"/>. 7829 </error> 7830 <error id="JVMTI_ERROR_INVALID_CLASS"> 7831 An element of <code>class_definitions</code> is not a valid class. 7832 </error> 7833 <error id="JVMTI_ERROR_UNSUPPORTED_VERSION"> 7834 A new class file has a version number not supported by this VM. 7835 </error> 7836 <error id="JVMTI_ERROR_INVALID_CLASS_FORMAT"> 7837 A new class file is malformed (The VM would return a <code>ClassFormatError</code>). 7838 </error> 7839 <error id="JVMTI_ERROR_CIRCULAR_CLASS_DEFINITION"> 7840 The new class file definitions would lead to a circular definition 7841 (the VM would return a <code>ClassCircularityError</code>). 7842 </error> 7843 <error id="JVMTI_ERROR_FAILS_VERIFICATION"> 7844 The class bytes fail verification. 7845 </error> 7846 <error id="JVMTI_ERROR_NAMES_DONT_MATCH"> 7847 The class name defined in a new class file is 7848 different from the name in the old class object. 7849 </error> 7850 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_ADDED"> 7851 A new class file would require adding a method. 7852 </error> 7853 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED"> 7854 A new class version changes a field. 7855 </error> 7856 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED"> 7857 A direct superclass is different for a new class 7858 version, or the set of directly implemented 7859 interfaces is different. 7860 </error> 7861 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_DELETED"> 7862 A new class version does not declare a method 7863 declared in the old class version. 7864 </error> 7865 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_ATTRIBUTE_CHANGED"> 7866 A new class version has unsupported differences in class attributes. 7867 </error> 7868 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED"> 7869 A new class version has different modifiers. 7870 </error> 7871 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED"> 7872 A method in the new class version has different modifiers 7873 than its counterpart in the old class version. 7874 </error> 7875 <error id="JVMTI_ERROR_UNMODIFIABLE_MODULE"> 7876 A module cannot be modified. 7877 See <functionlink id="IsModifiableModule"/>. 7878 </error> 7879 </errors> 7880 </function> 7881 7882 </category> 7883 7884 <category id="object" label="Object"> 7885 7886 <function id="GetObjectSize" jkernel="yes" phase="start" num="154"> 7887 <synopsis>Get Object Size</synopsis> 7888 <description> 7889 For the object indicated by <code>object</code>, 7890 return via <code>size_ptr</code> the size of the object. 7891 This size is an implementation-specific approximation of 7892 the amount of storage consumed by this object. 7893 It may include some or all of the object's overhead, and thus 7894 is useful for comparison within an implementation but not 7895 between implementations. 7896 The estimate may change during a single invocation of the JVM. 7897 </description> 7898 <origin>new</origin> 7899 <capabilities> 7900 </capabilities> 7901 <parameters> 7902 <param id="object"> 7903 <jobject/> 7904 <description> 7905 The object to query. 7906 </description> 7907 </param> 7908 <param id="size_ptr"> 7909 <outptr><jlong/></outptr> 7910 <description> 7911 On return, points to the object's size in bytes. 7912 </description> 7913 </param> 7914 </parameters> 7915 <errors> 7916 </errors> 7917 </function> 7918 7919 <function id="GetObjectHashCode" phase="start" num="58"> 7920 <synopsis>Get Object Hash Code</synopsis> 7921 <description> 7922 For the object indicated by <code>object</code>, 7923 return via <code>hash_code_ptr</code> a hash code. 7924 This hash code could be used to maintain a hash table of object references, 7925 however, on some implementations this can cause significant performance 7926 impacts--in most cases 7927 <internallink id="Heap">tags</internallink> 7928 will be a more efficient means of associating information with objects. 7929 This function guarantees 7930 the same hash code value for a particular object throughout its life 7931 </description> 7932 <origin>jvmdi</origin> 7933 <capabilities> 7934 </capabilities> 7935 <parameters> 7936 <param id="object"> 7937 <jobject/> 7938 <description> 7939 The object to query. 7940 </description> 7941 </param> 7942 <param id="hash_code_ptr"> 7943 <outptr><jint/></outptr> 7944 <description> 7945 On return, points to the object's hash code. 7946 </description> 7947 </param> 7948 </parameters> 7949 <errors> 7950 </errors> 7951 </function> 7952 7953 <function id="GetObjectMonitorUsage" num="59"> 7954 <synopsis>Get Object Monitor Usage</synopsis> 7955 <typedef id="jvmtiMonitorUsage" label="Object monitor usage information"> 7956 <field id="owner"> 7957 <jthread/> 7958 <description> 7959 The thread owning this monitor, or <code>NULL</code> if unused 7960 </description> 7961 </field> 7962 <field id="entry_count"> 7963 <jint/> 7964 <description> 7965 The number of times the owning thread has entered the monitor 7966 </description> 7967 </field> 7968 <field id="waiter_count"> 7969 <jint/> 7970 <description> 7971 The number of threads waiting to own this monitor 7972 </description> 7973 </field> 7974 <field id="waiters"> 7975 <allocfieldbuf><jthread/></allocfieldbuf> 7976 <description> 7977 The <code>waiter_count</code> waiting threads 7978 </description> 7979 </field> 7980 <field id="notify_waiter_count"> 7981 <jint/> 7982 <description> 7983 The number of threads waiting to be notified by this monitor 7984 </description> 7985 </field> 7986 <field id="notify_waiters"> 7987 <allocfieldbuf><jthread/></allocfieldbuf> 7988 <description> 7989 The <code>notify_waiter_count</code> threads waiting to be notified 7990 </description> 7991 </field> 7992 </typedef> 7993 <description> 7994 Get information about the object's monitor. 7995 The fields of the <functionlink id="jvmtiMonitorUsage"></functionlink> structure 7996 are filled in with information about usage of the monitor. 7997 <todo> 7998 Decide and then clarify suspend requirements. 7999 </todo> 8000 </description> 8001 <origin>jvmdi</origin> 8002 <capabilities> 8003 <required id="can_get_monitor_info"></required> 8004 </capabilities> 8005 <parameters> 8006 <param id="object"> 8007 <jobject/> 8008 <description> 8009 The object to query. 8010 </description> 8011 </param> 8012 <param id="info_ptr"> 8013 <outptr><struct>jvmtiMonitorUsage</struct></outptr> 8014 <description> 8015 On return, filled with monitor information for the 8016 specified object. 8017 </description> 8018 </param> 8019 </parameters> 8020 <errors> 8021 </errors> 8022 </function> 8023 8024 <elide> 8025 <function id="GetObjectMonitors" num="116"> 8026 <synopsis>Get Object Monitors</synopsis> 8027 <description> 8028 Return the list of object monitors. 8029 <p/> 8030 Note: details about each monitor can be examined with 8031 <functionlink id="GetObjectMonitorUsage"></functionlink>. 8032 </description> 8033 <origin>new</origin> 8034 <capabilities> 8035 <required id="can_get_monitor_info"></required> 8036 </capabilities> 8037 <parameters> 8038 <param id="monitorCnt"> 8039 <outptr><jint/></outptr> 8040 <description> 8041 On return, pointer to the number 8042 of monitors returned in <code>monitors_ptr</code>. 8043 </description> 8044 </param> 8045 <param id="monitors_ptr"> 8046 <allocbuf outcount="monitorCnt"><jobject/></allocbuf> 8047 <description> 8048 On return, pointer to the monitor list. 8049 </description> 8050 </param> 8051 </parameters> 8052 <errors> 8053 </errors> 8054 </function> 8055 </elide> 8056 8057 </category> 8058 8059 <category id="fieldCategory" label="Field"> 8060 8061 <intro> 8062 </intro> 8063 8064 <function id="GetFieldName" phase="start" num="60"> 8065 <synopsis>Get Field Name (and Signature)</synopsis> 8066 <description> 8067 For the field indicated by <paramlink id="klass"/> and <paramlink id="field"/>, 8068 return the field name via <paramlink id="name_ptr"/> and field signature via 8069 <paramlink id="signature_ptr"/>. 8070 <p/> 8071 Field signatures are defined in the 8072 <externallink id="jni/index.html">JNI Specification</externallink> 8073 and are referred to as <code>field descriptors</code> in 8074 <vmspec chapter="4.3.2"/>. 8075 </description> 8076 <origin>jvmdiClone</origin> 8077 <capabilities> 8078 </capabilities> 8079 <parameters> 8080 <param id="klass"> 8081 <jclass field="field"/> 8082 <description> 8083 The class of the field to query. 8084 </description> 8085 </param> 8086 <param id="field"> 8087 <jfieldID class="klass"/> 8088 <description> 8089 The field to query. 8090 </description> 8091 </param> 8092 <param id="name_ptr"> 8093 <allocbuf> 8094 <char/> 8095 <nullok>the name is not returned</nullok> 8096 </allocbuf> 8097 <description> 8098 On return, points to the field name, encoded as a 8099 <internallink id="mUTF">modified UTF-8</internallink> string. 8100 </description> 8101 </param> 8102 <param id="signature_ptr"> 8103 <allocbuf> 8104 <char/> 8105 <nullok>the signature is not returned</nullok> 8106 </allocbuf> 8107 <description> 8108 On return, points to the field signature, encoded as a 8109 <internallink id="mUTF">modified UTF-8</internallink> string. 8110 </description> 8111 </param> 8112 <param id="generic_ptr"> 8113 <allocbuf> 8114 <char/> 8115 <nullok>the generic signature is not returned</nullok> 8116 </allocbuf> 8117 <description> 8118 On return, points to the generic signature of the field, encoded as a 8119 <internallink id="mUTF">modified UTF-8</internallink> string. 8120 If there is no generic signature attribute for the field, then, 8121 on return, points to <code>NULL</code>. 8122 </description> 8123 </param> 8124 </parameters> 8125 <errors> 8126 </errors> 8127 </function> 8128 8129 <function id="GetFieldDeclaringClass" phase="start" num="61"> 8130 <synopsis>Get Field Declaring Class</synopsis> 8131 <description> 8132 For the field indicated by <code>klass</code> and <code>field</code> 8133 return the class that defined it via <code>declaring_class_ptr</code>. 8134 The declaring class will either be <code>klass</code>, a superclass, or 8135 an implemented interface. 8136 </description> 8137 <origin>jvmdi</origin> 8138 <capabilities> 8139 </capabilities> 8140 <parameters> 8141 <param id="klass"> 8142 <jclass field="field"/> 8143 <description> 8144 The class to query. 8145 </description> 8146 </param> 8147 <param id="field"> 8148 <jfieldID class="klass"/> 8149 <description> 8150 The field to query. 8151 </description> 8152 </param> 8153 <param id="declaring_class_ptr"> 8154 <outptr><jclass/></outptr> 8155 <description> 8156 On return, points to the declaring class 8157 </description> 8158 </param> 8159 </parameters> 8160 <errors> 8161 </errors> 8162 </function> 8163 8164 <function id="GetFieldModifiers" phase="start" num="62"> 8165 <synopsis>Get Field Modifiers</synopsis> 8166 <description> 8167 For the field indicated by <code>klass</code> and <code>field</code> 8168 return the access flags via <code>modifiers_ptr</code>. 8169 Access flags are defined in <vmspec chapter="4"/>. 8170 </description> 8171 <origin>jvmdi</origin> 8172 <capabilities> 8173 </capabilities> 8174 <parameters> 8175 <param id="klass"> 8176 <jclass field="field"/> 8177 <description> 8178 The class to query. 8179 </description> 8180 </param> 8181 <param id="field"> 8182 <jfieldID class="klass"/> 8183 <description> 8184 The field to query. 8185 </description> 8186 </param> 8187 <param id="modifiers_ptr"> 8188 <outptr><jint/></outptr> 8189 <description> 8190 On return, points to the access flags. 8191 </description> 8192 </param> 8193 </parameters> 8194 <errors> 8195 </errors> 8196 </function> 8197 8198 <function id="IsFieldSynthetic" phase="start" num="63"> 8199 <synopsis>Is Field Synthetic</synopsis> 8200 <description> 8201 For the field indicated by <code>klass</code> and <code>field</code>, return a 8202 value indicating whether the field is synthetic via <code>is_synthetic_ptr</code>. 8203 Synthetic fields are generated by the compiler but not present in the 8204 original source code. 8205 </description> 8206 <origin>jvmdi</origin> 8207 <capabilities> 8208 <required id="can_get_synthetic_attribute"></required> 8209 </capabilities> 8210 <parameters> 8211 <param id="klass"> 8212 <jclass field="field"/> 8213 <description> 8214 The class of the field to query. 8215 </description> 8216 </param> 8217 <param id="field"> 8218 <jfieldID class="klass"/> 8219 <description> 8220 The field to query. 8221 </description> 8222 </param> 8223 <param id="is_synthetic_ptr"> 8224 <outptr><jboolean/></outptr> 8225 <description> 8226 On return, points to the boolean result of this function. 8227 </description> 8228 </param> 8229 </parameters> 8230 <errors> 8231 </errors> 8232 </function> 8233 8234 </category> 8235 8236 <category id="method" label="Method"> 8237 8238 <intro> 8239 These functions provide information about a method (represented as a 8240 <typelink id="jmethodID"/>) and set how methods are processed. 8241 </intro> 8242 8243 <intro id="obsoleteMethods" label="Obsolete Methods"> 8244 The functions <functionlink id="RetransformClasses"/> and 8245 <functionlink id="RedefineClasses"/> can cause new versions 8246 of methods to be installed. 8247 An original version of a method is considered equivalent 8248 to the new version if: 8249 <ul> 8250 <li>their bytecodes are the same except for indices into the 8251 constant pool and </li> 8252 <li>the referenced constants are equal.</li> 8253 </ul> 8254 An original method version which is not equivalent to the 8255 new method version is called obsolete and is assigned a new method ID; 8256 the original method ID now refers to the new method version. 8257 A method ID can be tested for obsolescence with 8258 <functionlink id="IsMethodObsolete"/>. 8259 </intro> 8260 8261 <function id="GetMethodName" phase="start" num="64"> 8262 <synopsis>Get Method Name (and Signature)</synopsis> 8263 <description> 8264 For the method indicated by <code>method</code>, 8265 return the method name via <code>name_ptr</code> and method signature via 8266 <code>signature_ptr</code>. 8267 <p/> 8268 Method signatures are defined in the 8269 <externallink id="jni/index.html">JNI Specification</externallink> 8270 and are referred to as <code>method descriptors</code> in 8271 <vmspec chapter="4.3.3"/>. 8272 Note this is different 8273 than method signatures as defined in the <i>Java Language Specification</i>. 8274 </description> 8275 <origin>jvmdiClone</origin> 8276 <capabilities> 8277 </capabilities> 8278 <parameters> 8279 <param id="method"> 8280 <jmethodID/> 8281 <description> 8282 The method to query. 8283 </description> 8284 </param> 8285 <param id="name_ptr"> 8286 <allocbuf> 8287 <char/> 8288 <nullok>the name is not returned</nullok> 8289 </allocbuf> 8290 <description> 8291 On return, points to the method name, encoded as a 8292 <internallink id="mUTF">modified UTF-8</internallink> string. 8293 </description> 8294 </param> 8295 <param id="signature_ptr"> 8296 <allocbuf> 8297 <char/> 8298 <nullok>the signature is not returned</nullok> 8299 </allocbuf> 8300 <description> 8301 On return, points to the method signature, encoded as a 8302 <internallink id="mUTF">modified UTF-8</internallink> string. 8303 </description> 8304 </param> 8305 <param id="generic_ptr"> 8306 <allocbuf> 8307 <char/> 8308 <nullok>the generic signature is not returned</nullok> 8309 </allocbuf> 8310 <description> 8311 On return, points to the generic signature of the method, encoded as a 8312 <internallink id="mUTF">modified UTF-8</internallink> string. 8313 If there is no generic signature attribute for the method, then, 8314 on return, points to <code>NULL</code>. 8315 </description> 8316 </param> 8317 </parameters> 8318 <errors> 8319 </errors> 8320 </function> 8321 8322 <function id="GetMethodDeclaringClass" phase="start" num="65"> 8323 <synopsis>Get Method Declaring Class</synopsis> 8324 <description> 8325 For the method indicated by <code>method</code>, 8326 return the class that defined it via <code>declaring_class_ptr</code>. 8327 </description> 8328 <origin>jvmdi</origin> 8329 <capabilities> 8330 </capabilities> 8331 <parameters> 8332 <param id="klass"> 8333 <jclass method="method"/> 8334 <description> 8335 The class to query. 8336 </description> 8337 </param> 8338 <param id="method"> 8339 <jmethodID class="klass"/> 8340 <description> 8341 The method to query. 8342 </description> 8343 </param> 8344 <param id="declaring_class_ptr"> 8345 <outptr><jclass/></outptr> 8346 <description> 8347 On return, points to the declaring class 8348 </description> 8349 </param> 8350 </parameters> 8351 <errors> 8352 </errors> 8353 </function> 8354 8355 <function id="GetMethodModifiers" phase="start" num="66"> 8356 <synopsis>Get Method Modifiers</synopsis> 8357 <description> 8358 For the method indicated by <code>method</code>, 8359 return the access flags via <code>modifiers_ptr</code>. 8360 Access flags are defined in <vmspec chapter="4"/>. 8361 </description> 8362 <origin>jvmdi</origin> 8363 <capabilities> 8364 </capabilities> 8365 <parameters> 8366 <param id="klass"> 8367 <jclass method="method"/> 8368 <description> 8369 The class to query. 8370 </description> 8371 </param> 8372 <param id="method"> 8373 <jmethodID class="klass"/> 8374 <description> 8375 The method to query. 8376 </description> 8377 </param> 8378 <param id="modifiers_ptr"> 8379 <outptr><jint/></outptr> 8380 <description> 8381 On return, points to the access flags. 8382 </description> 8383 </param> 8384 </parameters> 8385 <errors> 8386 </errors> 8387 </function> 8388 8389 <function id="GetMaxLocals" phase="start" num="68"> 8390 <synopsis>Get Max Locals</synopsis> 8391 <description> 8392 For the method indicated by <code>method</code>, 8393 return the number of local variable slots used by the method, 8394 including the local variables used to pass parameters to the 8395 method on its invocation. 8396 <p/> 8397 See <code>max_locals</code> in <vmspec chapter="4.7.3"/>. 8398 </description> 8399 <origin>jvmdi</origin> 8400 <capabilities> 8401 </capabilities> 8402 <parameters> 8403 <param id="klass"> 8404 <jclass method="method"/> 8405 <description> 8406 The class to query. 8407 </description> 8408 </param> 8409 <param id="method"> 8410 <jmethodID class="klass" native="error"/> 8411 <description> 8412 The method to query. 8413 </description> 8414 </param> 8415 <param id="max_ptr"> 8416 <outptr><jint/></outptr> 8417 <description> 8418 On return, points to the maximum number of local slots 8419 </description> 8420 </param> 8421 </parameters> 8422 <errors> 8423 </errors> 8424 </function> 8425 8426 <function id="GetArgumentsSize" phase="start" num="69"> 8427 <synopsis>Get Arguments Size</synopsis> 8428 <description> 8429 For the method indicated by <code>method</code>, 8430 return via <code>max_ptr</code> the number of local variable slots used 8431 by the method's arguments. 8432 Note that two-word arguments use two slots. 8433 </description> 8434 <origin>jvmdi</origin> 8435 <capabilities> 8436 </capabilities> 8437 <parameters> 8438 <param id="klass"> 8439 <jclass method="method"/> 8440 <description> 8441 The class to query. 8442 </description> 8443 </param> 8444 <param id="method"> 8445 <jmethodID class="klass" native="error"/> 8446 <description> 8447 The method to query. 8448 </description> 8449 </param> 8450 <param id="size_ptr"> 8451 <outptr><jint/></outptr> 8452 <description> 8453 On return, points to the number of argument slots 8454 </description> 8455 </param> 8456 </parameters> 8457 <errors> 8458 </errors> 8459 </function> 8460 8461 <function id="GetLineNumberTable" phase="start" num="70"> 8462 <synopsis>Get Line Number Table</synopsis> 8463 <typedef id="jvmtiLineNumberEntry" label="Line number table entry"> 8464 <field id="start_location"> 8465 <jlocation/> 8466 <description> 8467 the <datalink id="jlocation"></datalink> where the line begins 8468 </description> 8469 </field> 8470 <field id="line_number"> 8471 <jint/> 8472 <description> 8473 the line number 8474 </description> 8475 </field> 8476 </typedef> 8477 <description> 8478 For the method indicated by <code>method</code>, 8479 return a table of source line number entries. The size of the table is 8480 returned via <code>entry_count_ptr</code> and the table itself is 8481 returned via <code>table_ptr</code>. 8482 </description> 8483 <origin>jvmdi</origin> 8484 <capabilities> 8485 <required id="can_get_line_numbers"></required> 8486 </capabilities> 8487 <parameters> 8488 <param id="klass"> 8489 <jclass method="method"/> 8490 <description> 8491 The class to query. 8492 </description> 8493 </param> 8494 <param id="method"> 8495 <jmethodID class="klass" native="error"/> 8496 <description> 8497 The method to query. 8498 </description> 8499 </param> 8500 <param id="entry_count_ptr"> 8501 <outptr><jint/></outptr> 8502 <description> 8503 On return, points to the number of entries in the table 8504 </description> 8505 </param> 8506 <param id="table_ptr"> 8507 <allocbuf outcount="entry_count_ptr"><struct>jvmtiLineNumberEntry</struct></allocbuf> 8508 <description> 8509 On return, points to the line number table pointer. 8510 </description> 8511 </param> 8512 </parameters> 8513 <errors> 8514 <error id="JVMTI_ERROR_ABSENT_INFORMATION"> 8515 Class information does not include line numbers. 8516 </error> 8517 </errors> 8518 </function> 8519 8520 <function id="GetMethodLocation" phase="start" num="71"> 8521 <synopsis>Get Method Location</synopsis> 8522 <description> 8523 For the method indicated by <code>method</code>, 8524 return the beginning and ending addresses through 8525 <code>start_location_ptr</code> and <code>end_location_ptr</code>. In a 8526 conventional bytecode indexing scheme, 8527 <code>start_location_ptr</code> will always point to zero 8528 and <code>end_location_ptr</code> 8529 will always point to the bytecode count minus one. 8530 </description> 8531 <origin>jvmdi</origin> 8532 <capabilities> 8533 </capabilities> 8534 <parameters> 8535 <param id="klass"> 8536 <jclass method="method"/> 8537 <description> 8538 The class to query. 8539 </description> 8540 </param> 8541 <param id="method"> 8542 <jmethodID class="klass" native="error"/> 8543 <description> 8544 The method to query. 8545 </description> 8546 </param> 8547 <param id="start_location_ptr"> 8548 <outptr><jlocation/></outptr> 8549 <description> 8550 On return, points to the first location, or 8551 <code>-1</code> if location information is not available. 8552 If the information is available and 8553 <functionlink id="GetJLocationFormat"></functionlink> 8554 returns <datalink id="JVMTI_JLOCATION_JVMBCI"></datalink> 8555 then this will always be zero. 8556 </description> 8557 </param> 8558 <param id="end_location_ptr"> 8559 <outptr><jlocation/></outptr> 8560 <description> 8561 On return, points to the last location, 8562 or <code>-1</code> if location information is not available. 8563 </description> 8564 </param> 8565 </parameters> 8566 <errors> 8567 <error id="JVMTI_ERROR_ABSENT_INFORMATION"> 8568 Class information does not include method sizes. 8569 </error> 8570 </errors> 8571 </function> 8572 8573 <function id="GetLocalVariableTable" num="72"> 8574 <synopsis>Get Local Variable Table</synopsis> 8575 <typedef id="jvmtiLocalVariableEntry" label="Local variable table entry"> 8576 <field id="start_location"> 8577 <jlocation/> 8578 <description> 8579 The code array index where the local variable is first valid 8580 (that is, where it must have a value). 8581 </description> 8582 </field> 8583 <field id="length"> 8584 <jint/> 8585 <description> 8586 The length of the valid section for this local variable. 8587 The last code array index where the local variable is valid 8588 is <code>start_location + length</code>. 8589 </description> 8590 </field> 8591 <field id="name"> 8592 <allocfieldbuf><char/></allocfieldbuf> 8593 <description> 8594 The local variable name, encoded as a 8595 <internallink id="mUTF">modified UTF-8</internallink> string. 8596 </description> 8597 </field> 8598 <field id="signature"> 8599 <allocfieldbuf><char/></allocfieldbuf> 8600 <description> 8601 The local variable's type signature, encoded as a 8602 <internallink id="mUTF">modified UTF-8</internallink> string. 8603 The signature format is the same as that defined in 8604 <vmspec chapter="4.3.2"/>. 8605 </description> 8606 </field> 8607 <field id="generic_signature"> 8608 <allocfieldbuf><char/></allocfieldbuf> 8609 <description> 8610 The local variable's generic signature, encoded as a 8611 <internallink id="mUTF">modified UTF-8</internallink> string. 8612 The value of this field will be <code>NULL</code> for any local 8613 variable which does not have a generic type. 8614 </description> 8615 </field> 8616 <field id="slot"> 8617 <jint/> 8618 <description> 8619 The local variable's slot. See <internallink id="local">Local Variables</internallink>. 8620 </description> 8621 </field> 8622 </typedef> 8623 <description> 8624 Return local variable information. 8625 </description> 8626 <origin>jvmdiClone</origin> 8627 <capabilities> 8628 <required id="can_access_local_variables"></required> 8629 </capabilities> 8630 <parameters> 8631 <param id="method"> 8632 <jmethodID native="error"/> 8633 <description> 8634 The method to query. 8635 </description> 8636 </param> 8637 <param id="entry_count_ptr"> 8638 <outptr><jint/></outptr> 8639 <description> 8640 On return, points to the number of entries in the table 8641 </description> 8642 </param> 8643 <param id="table_ptr"> 8644 <allocbuf outcount="entry_count_ptr"><struct>jvmtiLocalVariableEntry</struct></allocbuf> 8645 <description> 8646 On return, points to an array of local variable table entries. 8647 </description> 8648 </param> 8649 </parameters> 8650 <errors> 8651 <error id="JVMTI_ERROR_ABSENT_INFORMATION"> 8652 Class information does not include local variable 8653 information. 8654 </error> 8655 </errors> 8656 </function> 8657 8658 <function id="GetBytecodes" phase="start" num="75"> 8659 <synopsis>Get Bytecodes</synopsis> 8660 <description> 8661 For the method indicated by <code>method</code>, 8662 return the bytecodes that implement the method. The number of 8663 bytecodes is returned via <code>bytecode_count_ptr</code>. The bytecodes 8664 themselves are returned via <code>bytecodes_ptr</code>. 8665 </description> 8666 <origin>jvmdi</origin> 8667 <capabilities> 8668 <required id="can_get_bytecodes"></required> 8669 </capabilities> 8670 <parameters> 8671 <param id="klass"> 8672 <jclass method="method"/> 8673 <description> 8674 The class to query. 8675 </description> 8676 </param> 8677 <param id="method"> 8678 <jmethodID class="klass" native="error"/> 8679 <description> 8680 The method to query. 8681 </description> 8682 </param> 8683 <param id="bytecode_count_ptr"> 8684 <outptr><jint/></outptr> 8685 <description> 8686 On return, points to the length of the bytecode array 8687 </description> 8688 </param> 8689 <param id="bytecodes_ptr"> 8690 <allocbuf outcount="bytecode_count_ptr"><uchar/></allocbuf> 8691 <description> 8692 On return, points to the pointer to the bytecode array 8693 </description> 8694 </param> 8695 </parameters> 8696 <errors> 8697 </errors> 8698 </function> 8699 8700 <function id="IsMethodNative" phase="start" num="76"> 8701 <synopsis>Is Method Native</synopsis> 8702 <description> 8703 For the method indicated by <code>method</code>, return a 8704 value indicating whether the method is native via <code>is_native_ptr</code> 8705 </description> 8706 <origin>jvmdi</origin> 8707 <capabilities> 8708 </capabilities> 8709 <parameters> 8710 <param id="klass"> 8711 <jclass method="method"/> 8712 <description> 8713 The class to query. 8714 </description> 8715 </param> 8716 <param id="method"> 8717 <jmethodID class="klass"/> 8718 <description> 8719 The method to query. 8720 </description> 8721 </param> 8722 <param id="is_native_ptr"> 8723 <outptr><jboolean/></outptr> 8724 <description> 8725 On return, points to the boolean result of this function. 8726 </description> 8727 </param> 8728 </parameters> 8729 <errors> 8730 </errors> 8731 </function> 8732 8733 <function id="IsMethodSynthetic" phase="start" num="77"> 8734 <synopsis>Is Method Synthetic</synopsis> 8735 <description> 8736 For the method indicated by <code>method</code>, return a 8737 value indicating whether the method is synthetic via <code>is_synthetic_ptr</code>. 8738 Synthetic methods are generated by the compiler but not present in the 8739 original source code. 8740 </description> 8741 <origin>jvmdi</origin> 8742 <capabilities> 8743 <required id="can_get_synthetic_attribute"></required> 8744 </capabilities> 8745 <parameters> 8746 <param id="klass"> 8747 <jclass method="method"/> 8748 <description> 8749 The class to query. 8750 </description> 8751 </param> 8752 <param id="method"> 8753 <jmethodID class="klass"/> 8754 <description> 8755 The method to query. 8756 </description> 8757 </param> 8758 <param id="is_synthetic_ptr"> 8759 <outptr><jboolean/></outptr> 8760 <description> 8761 On return, points to the boolean result of this function. 8762 </description> 8763 </param> 8764 </parameters> 8765 <errors> 8766 </errors> 8767 </function> 8768 8769 <function id="IsMethodObsolete" phase="start" num="91"> 8770 <synopsis>Is Method Obsolete</synopsis> 8771 <description> 8772 Determine if a method ID refers to an 8773 <internallink id="obsoleteMethods">obsolete</internallink> 8774 method version. 8775 </description> 8776 <origin>jvmdi</origin> 8777 <capabilities> 8778 </capabilities> 8779 <parameters> 8780 <param id="klass"> 8781 <jclass method="method"/> 8782 <description> 8783 The class to query. 8784 </description> 8785 </param> 8786 <param id="method"> 8787 <jmethodID class="klass"/> 8788 <description> 8789 The method ID to query. 8790 </description> 8791 </param> 8792 <param id="is_obsolete_ptr"> 8793 <outptr><jboolean/></outptr> 8794 <description> 8795 On return, points to the boolean result of this function. 8796 </description> 8797 </param> 8798 </parameters> 8799 <errors> 8800 </errors> 8801 </function> 8802 8803 <function id="SetNativeMethodPrefix" jkernel="yes" phase="any" num="73" since="1.1"> 8804 <synopsis>Set Native Method Prefix</synopsis> 8805 <description> 8806 This function modifies the failure handling of 8807 native method resolution by allowing retry 8808 with a prefix applied to the name. 8809 When used with the 8810 <eventlink id="ClassFileLoadHook">ClassFileLoadHook 8811 event</eventlink>, it enables native methods to be 8812 <internallink id="bci">instrumented</internallink>. 8813 <p/> 8814 Since native methods cannot be directly instrumented 8815 (they have no bytecodes), they must be wrapped with 8816 a non-native method which can be instrumented. 8817 For example, if we had: 8818 <example> 8819native boolean foo(int x);</example> 8820 <p/> 8821 We could transform the class file (with the 8822 ClassFileLoadHook event) so that this becomes: 8823 <example> 8824boolean foo(int x) { 8825 <i>... record entry to foo ...</i> 8826 return wrapped_foo(x); 8827} 8828 8829native boolean wrapped_foo(int x);</example> 8830 <p/> 8831 Where foo becomes a wrapper for the actual native method 8832 with the appended prefix "wrapped_". Note that 8833 "wrapped_" would be a poor choice of prefix since it 8834 might conceivably form the name of an existing method 8835 thus something like "$$$MyAgentWrapped$$$_" would be 8836 better but would make these examples less readable. 8837 <p/> 8838 The wrapper will allow data to be collected on the native 8839 method call, but now the problem becomes linking up the 8840 wrapped method with the native implementation. 8841 That is, the method <code>wrapped_foo</code> needs to be 8842 resolved to the native implementation of <code>foo</code>, 8843 which might be: 8844 <example> 8845Java_somePackage_someClass_foo(JNIEnv* env, jint x)</example> 8846 <p/> 8847 This function allows the prefix to be specified and the 8848 proper resolution to occur. 8849 Specifically, when the standard resolution fails, the 8850 resolution is retried taking the prefix into consideration. 8851 There are two ways that resolution occurs, explicit 8852 resolution with the JNI function <code>RegisterNatives</code> 8853 and the normal automatic resolution. For 8854 <code>RegisterNatives</code>, the VM will attempt this 8855 association: 8856 <example> 8857method(foo) -> nativeImplementation(foo)</example> 8858 <p/> 8859 When this fails, the resolution will be retried with 8860 the specified prefix prepended to the method name, 8861 yielding the correct resolution: 8862 <example> 8863method(wrapped_foo) -> nativeImplementation(foo)</example> 8864 <p/> 8865 For automatic resolution, the VM will attempt: 8866 <example> 8867method(wrapped_foo) -> nativeImplementation(wrapped_foo)</example> 8868 <p/> 8869 When this fails, the resolution will be retried with 8870 the specified prefix deleted from the implementation name, 8871 yielding the correct resolution: 8872 <example> 8873method(wrapped_foo) -> nativeImplementation(foo)</example> 8874 <p/> 8875 Note that since the prefix is only used when standard 8876 resolution fails, native methods can be wrapped selectively. 8877 <p/> 8878 Since each <jvmti/> environment is independent and 8879 can do its own transformation of the bytecodes, more 8880 than one layer of wrappers may be applied. Thus each 8881 environment needs its own prefix. Since transformations 8882 are applied in order, the prefixes, if applied, will 8883 be applied in the same order. 8884 The order of transformation application is described in 8885 the <eventlink id="ClassFileLoadHook"/> event. 8886 Thus if three environments applied 8887 wrappers, <code>foo</code> might become 8888 <code>$env3_$env2_$env1_foo</code>. But if, say, 8889 the second environment did not apply a wrapper to 8890 <code>foo</code> it would be just 8891 <code>$env3_$env1_foo</code>. To be able to 8892 efficiently determine the sequence of prefixes, 8893 an intermediate prefix is only applied if its non-native 8894 wrapper exists. Thus, in the last example, even though 8895 <code>$env1_foo</code> is not a native method, the 8896 <code>$env1_</code> prefix is applied since 8897 <code>$env1_foo</code> exists. 8898 <p/> 8899 Since the prefixes are used at resolution time 8900 and since resolution may be arbitrarily delayed, a 8901 native method prefix must remain set as long as there 8902 are corresponding prefixed native methods. 8903 </description> 8904 <origin>new</origin> 8905 <capabilities> 8906 <required id="can_set_native_method_prefix"></required> 8907 </capabilities> 8908 <parameters> 8909 <param id="prefix"> 8910 <inbuf> 8911 <char/> 8912 <nullok> 8913 any existing prefix in this environment is cancelled 8914 </nullok> 8915 </inbuf> 8916 <description> 8917 The prefix to apply, encoded as a 8918 <internallink id="mUTF">modified UTF-8</internallink> string. 8919 </description> 8920 </param> 8921 </parameters> 8922 <errors> 8923 </errors> 8924 </function> 8925 8926 <function id="SetNativeMethodPrefixes" jkernel="yes" phase="any" num="74" since="1.1"> 8927 <synopsis>Set Native Method Prefixes</synopsis> 8928 <description> 8929 For a normal agent, <functionlink id="SetNativeMethodPrefix"/> 8930 will provide all needed native method prefixing. 8931 For a meta-agent that performs multiple independent class 8932 file transformations (for example as a proxy for another 8933 layer of agents) this function allows each transformation 8934 to have its own prefix. 8935 The prefixes are applied in the order supplied and are 8936 processed in the same manner as described for the 8937 application of prefixes from multiple <jvmti/> environments 8938 in <functionlink id="SetNativeMethodPrefix"/>. 8939 <p/> 8940 Any previous prefixes are replaced. Thus, calling this 8941 function with a <paramlink id="prefix_count"/> of <code>0</code> 8942 disables prefixing in this environment. 8943 <p/> 8944 <functionlink id="SetNativeMethodPrefix"/> and this function 8945 are the two ways to set the prefixes. 8946 Calling <code>SetNativeMethodPrefix</code> with 8947 a prefix is the same as calling this function with 8948 <paramlink id="prefix_count"/> of <code>1</code>. 8949 Calling <code>SetNativeMethodPrefix</code> with 8950 <code>NULL</code> is the same as calling this function with 8951 <paramlink id="prefix_count"/> of <code>0</code>. 8952 </description> 8953 <origin>new</origin> 8954 <capabilities> 8955 <required id="can_set_native_method_prefix"></required> 8956 </capabilities> 8957 <parameters> 8958 <param id="prefix_count"> 8959 <jint min="0"/> 8960 <description> 8961 The number of prefixes to apply. 8962 </description> 8963 </param> 8964 <param id="prefixes"> 8965 <agentbuf> 8966 <char/> 8967 </agentbuf> 8968 <description> 8969 The prefixes to apply for this environment, each encoded as a 8970 <internallink id="mUTF">modified UTF-8</internallink> string. 8971 </description> 8972 </param> 8973 </parameters> 8974 <errors> 8975 </errors> 8976 </function> 8977 8978 </category> 8979 8980 <category id="RawMonitors" label="Raw Monitor"> 8981 8982 <function id="CreateRawMonitor" phase="onload" callbacksafe="safe" num="31"> 8983 <synopsis>Create Raw Monitor</synopsis> 8984 <description> 8985 Create a raw monitor. 8986 </description> 8987 <origin>jvmdi</origin> 8988 <capabilities> 8989 </capabilities> 8990 <parameters> 8991 <param id="name"> 8992 <inbuf><char/></inbuf> 8993 <description> 8994 A name to identify the monitor, encoded as a 8995 <internallink id="mUTF">modified UTF-8</internallink> string. 8996 </description> 8997 </param> 8998 <param id="monitor_ptr"> 8999 <outptr><jrawMonitorID/></outptr> 9000 <description> 9001 On return, points to the created monitor. 9002 </description> 9003 </param> 9004 </parameters> 9005 <errors> 9006 </errors> 9007 </function> 9008 9009 <function id="DestroyRawMonitor" phase="onload" callbacksafe="safe" num="32"> 9010 <synopsis>Destroy Raw Monitor</synopsis> 9011 <description> 9012 Destroy the raw monitor. 9013 If the monitor being destroyed has been entered by this thread, it will be 9014 exited before it is destroyed. 9015 If the monitor being destroyed has been entered by another thread, 9016 an error will be returned and the monitor will not be destroyed. 9017 </description> 9018 <origin>jvmdi</origin> 9019 <capabilities> 9020 </capabilities> 9021 <parameters> 9022 <param id="monitor"> 9023 <jrawMonitorID/> 9024 <description> 9025 The monitor 9026 </description> 9027 </param> 9028 </parameters> 9029 <errors> 9030 <error id="JVMTI_ERROR_NOT_MONITOR_OWNER"> 9031 Not monitor owner 9032 </error> 9033 </errors> 9034 </function> 9035 9036 <function id="RawMonitorEnter" phase="any" callbacksafe="safe" impl="innative notrace" num="33"> 9037 <synopsis>Raw Monitor Enter</synopsis> 9038 <description> 9039 Gain exclusive ownership of a raw monitor. 9040 The same thread may enter a monitor more then once. 9041 The thread must 9042 <functionlink id="RawMonitorExit">exit</functionlink> 9043 the monitor the same number of times as it is entered. 9044 If a monitor is entered during <code>OnLoad</code> (before attached threads exist) 9045 and has not exited when attached threads come into existence, the enter 9046 is considered to have occurred on the main thread. 9047 </description> 9048 <origin>jvmdi</origin> 9049 <capabilities> 9050 </capabilities> 9051 <parameters> 9052 <param id="monitor"> 9053 <jrawMonitorID/> 9054 <description> 9055 The monitor 9056 </description> 9057 </param> 9058 </parameters> 9059 <errors> 9060 </errors> 9061 </function> 9062 9063 <function id="RawMonitorExit" phase="any" callbacksafe="safe" impl="innative notrace" num="34"> 9064 <synopsis>Raw Monitor Exit</synopsis> 9065 <description> 9066 Release exclusive ownership of a raw monitor. 9067 </description> 9068 <origin>jvmdi</origin> 9069 <capabilities> 9070 </capabilities> 9071 <parameters> 9072 <param id="monitor"> 9073 <jrawMonitorID/> 9074 <description> 9075 The monitor 9076 </description> 9077 </param> 9078 </parameters> 9079 <errors> 9080 <error id="JVMTI_ERROR_NOT_MONITOR_OWNER"> 9081 Not monitor owner 9082 </error> 9083 </errors> 9084 </function> 9085 9086 <function id="RawMonitorWait" phase="any" callbacksafe="safe" impl="innative notrace" num="35"> 9087 <synopsis>Raw Monitor Wait</synopsis> 9088 <description> 9089 Wait for notification of the raw monitor. 9090 <p/> 9091 Causes the current thread to wait until either another thread calls 9092 <functionlink id="RawMonitorNotify"/> or 9093 <functionlink id="RawMonitorNotifyAll"/> 9094 for the specified raw monitor, or the specified 9095 <paramlink id="millis">timeout</paramlink> 9096 has elapsed. 9097 </description> 9098 <origin>jvmdi</origin> 9099 <capabilities> 9100 </capabilities> 9101 <parameters> 9102 <param id="monitor"> 9103 <jrawMonitorID/> 9104 <description> 9105 The monitor 9106 </description> 9107 </param> 9108 <param id="millis"> 9109 <jlong/> 9110 <description> 9111 The timeout, in milliseconds. If the timeout is 9112 zero, then real time is not taken into consideration 9113 and the thread simply waits until notified. 9114 </description> 9115 </param> 9116 </parameters> 9117 <errors> 9118 <error id="JVMTI_ERROR_NOT_MONITOR_OWNER"> 9119 Not monitor owner 9120 </error> 9121 <error id="JVMTI_ERROR_INTERRUPT"> 9122 Wait was interrupted, try again 9123 </error> 9124 </errors> 9125 </function> 9126 9127 <function id="RawMonitorNotify" phase="any" callbacksafe="safe" impl="notrace" num="36"> 9128 <synopsis>Raw Monitor Notify</synopsis> 9129 <description> 9130 Notify a single thread waiting on the raw monitor. 9131 </description> 9132 <origin>jvmdi</origin> 9133 <capabilities> 9134 </capabilities> 9135 <parameters> 9136 <param id="monitor"> 9137 <jrawMonitorID/> 9138 <description> 9139 The monitor 9140 </description> 9141 </param> 9142 </parameters> 9143 <errors> 9144 <error id="JVMTI_ERROR_NOT_MONITOR_OWNER"> 9145 Not monitor owner 9146 </error> 9147 </errors> 9148 </function> 9149 9150 <function id="RawMonitorNotifyAll" phase="any" callbacksafe="safe" impl="notrace" num="37"> 9151 <synopsis>Raw Monitor Notify All</synopsis> 9152 <description> 9153 Notify all threads waiting on the raw monitor. 9154 </description> 9155 <origin>jvmdi</origin> 9156 <capabilities> 9157 </capabilities> 9158 <parameters> 9159 <param id="monitor"> 9160 <jrawMonitorID/> 9161 <description> 9162 The monitor 9163 </description> 9164 </param> 9165 </parameters> 9166 <errors> 9167 <error id="JVMTI_ERROR_NOT_MONITOR_OWNER"> 9168 Not monitor owner 9169 </error> 9170 </errors> 9171 </function> 9172 9173 <elide> 9174 <function id="GetRawMonitorUse" num="118"> 9175 <synopsis>Get Raw Monitor Use</synopsis> 9176 <description> 9177 The fields of the <functionlink id="jvmtiMonitorUsage"></functionlink> structure 9178 are filled in with information about usage of the raw monitor. 9179 </description> 9180 <origin>new</origin> 9181 <capabilities> 9182 <required id="can_get_raw_monitor_usage"></required> 9183 </capabilities> 9184 <parameters> 9185 <param id="monitor"> 9186 <jrawMonitorID/> 9187 <description> 9188 the raw monitor to query. 9189 </description> 9190 </param> 9191 <param id="info_ptr"> 9192 <outptr><struct>jvmtiMonitorUsage</struct></outptr> 9193 <description> 9194 On return, filled with monitor information for the 9195 specified raw monitor. 9196 </description> 9197 </param> 9198 </parameters> 9199 <errors> 9200 </errors> 9201 </function> 9202 9203 <function id="GetRawMonitors" num="119"> 9204 <synopsis>Get Raw Monitors</synopsis> 9205 <description> 9206 Return the list of raw monitors. 9207 <p/> 9208 Note: details about each monitor can be examined with 9209 <functionlink id="GetRawMonitorUse"></functionlink>. 9210 </description> 9211 <origin>new</origin> 9212 <capabilities> 9213 <required id="can_get_raw_monitor_usage"></required> 9214 </capabilities> 9215 <parameters> 9216 <param id="monitorCnt"> 9217 <outptr><jint/></outptr> 9218 <description> 9219 On return, pointer to the number 9220 of monitors returned in <code>monitors_ptr</code>. 9221 </description> 9222 </param> 9223 <param id="monitors_ptr"> 9224 <allocbuf outcount="monitorCnt"><jrawMonitorID/></allocbuf> 9225 <description> 9226 On return, pointer to the monitor list. 9227 </description> 9228 </param> 9229 </parameters> 9230 <errors> 9231 </errors> 9232 </function> 9233 </elide> 9234 </category> 9235 9236 <category id="jniIntercept" label="JNI Function Interception"> 9237 9238 <intro> 9239 Provides the ability to intercept and resend 9240 Java Native Interface (JNI) function calls 9241 by manipulating the JNI function table. 9242 See <externallink id="jni/functions.html">JNI 9243 Functions</externallink> in the <i>Java Native Interface Specification</i>. 9244 <p/> 9245 The following example illustrates intercepting the 9246 <code>NewGlobalRef</code> JNI call in order to count reference 9247 creation. 9248 <example> 9249JNIEnv original_jni_Functions; 9250JNIEnv redirected_jni_Functions; 9251int my_global_ref_count = 0; 9252 9253jobject 9254MyNewGlobalRef(JNIEnv *jni_env, jobject lobj) { 9255 ++my_global_ref_count; 9256 return originalJNIFunctions->NewGlobalRef(env, lobj); 9257} 9258 9259void 9260myInit() { 9261 jvmtiError err; 9262 9263 err = (*jvmti_env)->GetJNIFunctionTable(jvmti_env, &original_jni_Functions); 9264 if (err != JVMTI_ERROR_NONE) { 9265 die(); 9266 } 9267 err = (*jvmti_env)->GetJNIFunctionTable(jvmti_env, &redirected_jni_Functions); 9268 if (err != JVMTI_ERROR_NONE) { 9269 die(); 9270 } 9271 redirectedJNIFunctions->NewGlobalRef = MyNewGlobalRef; 9272 err = (*jvmti_env)->SetJNIFunctionTable(jvmti_env, redirected_jni_Functions); 9273 if (err != JVMTI_ERROR_NONE) { 9274 die(); 9275 } 9276} 9277 </example> 9278 Sometime after <code>myInit</code> is called the user's JNI 9279 code is executed which makes the call to create a new global 9280 reference. Instead of going to the normal JNI implementation 9281 the call goes to <code>myNewGlobalRef</code>. Note that a 9282 copy of the original function table is kept so that the normal 9283 JNI function can be called after the data is collected. 9284 Note also that any JNI functions which are not overwritten 9285 will behave normally. 9286 <todo> 9287 check that the example compiles and executes. 9288 </todo> 9289 </intro> 9290 9291 <function id="SetJNIFunctionTable" phase="start" num="120"> 9292 <synopsis>Set JNI Function Table</synopsis> 9293 <description> 9294 Set the JNI function table 9295 in all current and future JNI environments. 9296 As a result, all future JNI calls are directed to the specified functions. 9297 Use <functionlink id="GetJNIFunctionTable"></functionlink> to get the 9298 function table to pass to this function. 9299 For this function to take effect the the updated table entries must be 9300 used by the JNI clients. 9301 Since the table is defined <code>const</code> some compilers may optimize 9302 away the access to the table, thus preventing this function from taking 9303 effect. 9304 The table is copied--changes to the local copy of the 9305 table have no effect. 9306 This function affects only the function table, all other aspects of the environment are 9307 unaffected. 9308 See the examples <internallink id="jniIntercept">above</internallink>. 9309 </description> 9310 <origin>new</origin> 9311 <capabilities> 9312 </capabilities> 9313 <parameters> 9314 <param id="function_table"> 9315 <inptr> 9316 <struct>jniNativeInterface</struct> 9317 </inptr> 9318 <description> 9319 Points to the new JNI function table. 9320 </description> 9321 </param> 9322 </parameters> 9323 <errors> 9324 </errors> 9325 </function> 9326 9327 <function id="GetJNIFunctionTable" phase="start" num="121"> 9328 <synopsis>Get JNI Function Table</synopsis> 9329 <description> 9330 Get the JNI function table. 9331 The JNI function table is copied into allocated memory. 9332 If <functionlink id="SetJNIFunctionTable"></functionlink> 9333 has been called, the modified (not the original) function 9334 table is returned. 9335 Only the function table is copied, no other aspects of the environment 9336 are copied. 9337 See the examples <internallink id="jniIntercept">above</internallink>. 9338 </description> 9339 <origin>new</origin> 9340 <capabilities> 9341 </capabilities> 9342 <parameters> 9343 <param id="function_table"> 9344 <allocbuf> 9345 <struct>jniNativeInterface</struct> 9346 </allocbuf> 9347 <description> 9348 On return, <code>*function_table</code> 9349 points a newly allocated copy of the JNI function table. 9350 </description> 9351 </param> 9352 </parameters> 9353 <errors> 9354 </errors> 9355 </function> 9356 9357 </category> 9358 9359 <category id="eventManagement" label="Event Management"> 9360 9361 <function id="SetEventCallbacks" jkernel="yes" phase="onload" num="122"> 9362 <synopsis>Set Event Callbacks</synopsis> 9363 <description> 9364 Set the functions to be called for each event. 9365 The callbacks are specified by supplying a replacement function table. 9366 The function table is copied--changes to the local copy of the 9367 table have no effect. 9368 This is an atomic action, all callbacks are set at once. 9369 No events are sent before this function is called. 9370 When an entry is <code>NULL</code> or when the event is beyond 9371 <paramlink id="size_of_callbacks"></paramlink> no event is sent. 9372 Details on events are 9373 described <internallink id="EventSection">later</internallink> in this document. 9374 An event must be enabled and have a callback in order to be 9375 sent--the order in which this function and 9376 <functionlink id="SetEventNotificationMode"></functionlink> 9377 are called does not affect the result. 9378 </description> 9379 <origin>new</origin> 9380 <capabilities> 9381 </capabilities> 9382 <parameters> 9383 <param id="callbacks"> 9384 <inptr> 9385 <struct>jvmtiEventCallbacks</struct> 9386 <nullok>remove the existing callbacks</nullok> 9387 </inptr> 9388 <description> 9389 The new event callbacks. 9390 </description> 9391 </param> 9392 <param id="size_of_callbacks"> 9393 <jint min="0"/> 9394 <description> 9395 <code>sizeof(jvmtiEventCallbacks)</code>--for version 9396 compatibility. 9397 </description> 9398 </param> 9399 </parameters> 9400 <errors> 9401 </errors> 9402 </function> 9403 9404 <function id="SetEventNotificationMode" jkernel="yes" phase="onload" num="2"> 9405 <synopsis>Set Event Notification Mode</synopsis> 9406 <description> 9407 Control the generation of events. 9408 <constants id="jvmtiEventMode" label="Event Enable/Disable" kind="enum"> 9409 <constant id="JVMTI_ENABLE" num="1"> 9410 If <paramlink id="mode"></paramlink> is <code>JVMTI_ENABLE</code>, 9411 the event <paramlink id="event_type"></paramlink> will be enabled 9412 </constant> 9413 <constant id="JVMTI_DISABLE" num="0"> 9414 If <paramlink id="mode"></paramlink> is <code>JVMTI_DISABLE</code>, 9415 the event <paramlink id="event_type"></paramlink> will be disabled 9416 </constant> 9417 </constants> 9418 If <code>event_thread</code> is <code>NULL</code>, 9419 the event is enabled or disabled globally; otherwise, it is 9420 enabled or disabled for a particular thread. 9421 An event is generated for 9422 a particular thread if it is enabled either at the thread or global 9423 levels. 9424 <p/> 9425 See <internallink id="EventIndex">below</internallink> for information on specific events. 9426 <p/> 9427 The following events cannot be controlled at the thread 9428 level through this function. 9429 <ul> 9430 <li><eventlink id="VMInit"></eventlink></li> 9431 <li><eventlink id="VMStart"></eventlink></li> 9432 <li><eventlink id="VMDeath"></eventlink></li> 9433 <li><eventlink id="ThreadStart"></eventlink></li> 9434 <li><eventlink id="CompiledMethodLoad"></eventlink></li> 9435 <li><eventlink id="CompiledMethodUnload"></eventlink></li> 9436 <li><eventlink id="DynamicCodeGenerated"></eventlink></li> 9437 <li><eventlink id="DataDumpRequest"></eventlink></li> 9438 </ul> 9439 <p/> 9440 Initially, no events are enabled at either the thread level 9441 or the global level. 9442 <p/> 9443 Any needed capabilities (see Event Enabling Capabilities below) must be possessed 9444 before calling this function. 9445 <p/> 9446 Details on events are 9447 described <internallink id="EventSection">below</internallink>. 9448 </description> 9449 <origin>jvmdiClone</origin> 9450 <eventcapabilities></eventcapabilities> 9451 <parameters> 9452 <param id="mode"> 9453 <enum>jvmtiEventMode</enum> 9454 <description> 9455 <code>JVMTI_ENABLE</code> or <code>JVMTI_DISABLE</code> 9456 </description> 9457 </param> 9458 <param id="event_type"> 9459 <enum>jvmtiEvent</enum> 9460 <description> 9461 the event to control 9462 </description> 9463 </param> 9464 <param id="event_thread"> 9465 <ptrtype> 9466 <jthread impl="noconvert"/> 9467 <nullok>event is controlled at the global level</nullok> 9468 </ptrtype> 9469 <description> 9470 The thread to control 9471 </description> 9472 </param> 9473 <param id="..."> 9474 <varargs/> 9475 <description> 9476 for future expansion 9477 </description> 9478 </param> 9479 </parameters> 9480 <errors> 9481 <error id="JVMTI_ERROR_INVALID_THREAD"> 9482 <paramlink id="event_thread"/> is non-<code>NULL</code> and is not a valid thread. 9483 </error> 9484 <error id="JVMTI_ERROR_THREAD_NOT_ALIVE"> 9485 <paramlink id="event_thread"/> is non-<code>NULL</code> and is not live (has not been started or is now dead). 9486 </error> 9487 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 9488 thread level control was attempted on events which do not 9489 permit thread level control. 9490 </error> 9491 <error id="JVMTI_ERROR_MUST_POSSESS_CAPABILITY"> 9492 The Required Event Enabling Capability is not possessed. 9493 </error> 9494 </errors> 9495 </function> 9496 9497 <function id="GenerateEvents" num="123"> 9498 <synopsis>Generate Events</synopsis> 9499 <description> 9500 Generate events to represent the current state of the VM. 9501 For example, if <paramlink id="event_type"/> is 9502 <code>JVMTI_EVENT_COMPILED_METHOD_LOAD</code>, 9503 a <eventlink id="CompiledMethodLoad"></eventlink> event will be 9504 sent for each currently compiled method. 9505 Methods that were loaded and now have been unloaded are not sent. 9506 The history of what events have previously been sent does not 9507 effect what events are sent by this function--for example, 9508 all currently compiled methods 9509 will be sent each time this function is called. 9510 <p/> 9511 This function is useful when 9512 events may have been missed due to the agent attaching after program 9513 execution begins; this function generates the missed events. 9514 <p/> 9515 Attempts to execute Java programming language code or 9516 JNI functions may be paused until this function returns - 9517 so neither should be called from the thread sending the event. 9518 This function returns only after the missed events have been 9519 sent, processed and have returned. 9520 The event may be sent on a different thread than the thread 9521 on which the event occurred. 9522 The callback for the event must be set with 9523 <functionlink id="SetEventCallbacks"></functionlink> 9524 and the event must be enabled with 9525 <functionlink id="SetEventNotificationMode"></functionlink> 9526 or the events will not occur. 9527 If the VM no longer has the information to generate some or 9528 all of the requested events, the events are simply not sent - 9529 no error is returned. 9530 <p/> 9531 Only the following events are supported: 9532 <ul> 9533 <li><eventlink id="CompiledMethodLoad"></eventlink></li> 9534 <li><eventlink id="DynamicCodeGenerated"></eventlink></li> 9535 </ul> 9536 </description> 9537 <origin>new</origin> 9538 <capabilities> 9539 <capability id="can_generate_compiled_method_load_events"></capability> 9540 </capabilities> 9541 <parameters> 9542 <param id="event_type"> 9543 <enum>jvmtiEvent</enum> 9544 <description> 9545 The type of event to generate. Must be one of these: 9546 <ul> 9547 <li><eventlink id="CompiledMethodLoad"><code>JVMTI_EVENT_COMPILED_METHOD_LOAD</code></eventlink></li> 9548 <li><eventlink id="DynamicCodeGenerated"><code>JVMTI_EVENT_DYNAMIC_CODE_GENERATED</code></eventlink></li> 9549 </ul> 9550 </description> 9551 </param> 9552 </parameters> 9553 <errors> 9554 <error id="JVMTI_ERROR_MUST_POSSESS_CAPABILITY"> 9555 <paramlink id="event_type"/> is 9556 <eventlink id="CompiledMethodLoad"><code>JVMTI_EVENT_COMPILED_METHOD_LOAD</code></eventlink> 9557 and <fieldlink id="can_generate_compiled_method_load_events" struct="jvmtiCapabilities"></fieldlink> 9558 is <code>false</code>. 9559 </error> 9560 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 9561 <paramlink id="event_type"/> is other than 9562 <eventlink id="CompiledMethodLoad"><code>JVMTI_EVENT_COMPILED_METHOD_LOAD</code></eventlink> 9563 or <eventlink id="DynamicCodeGenerated"><code>JVMTI_EVENT_DYNAMIC_CODE_GENERATED</code></eventlink>. 9564 </error> 9565 </errors> 9566 </function> 9567 9568 </category> 9569 9570 <category id="extension" label="Extension Mechanism"> 9571 9572 <intro> 9573 These functions 9574 allow a <jvmti/> implementation to provide functions and events 9575 beyond those defined in this specification. 9576 <p/> 9577 Both extension functions and extension events have parameters 9578 each of which has a 'type' and 'kind' chosen from the following tables: 9579 9580 <constants id="jvmtiParamTypes" label="Extension Function/Event Parameter Types" kind="enum"> 9581 <constant id="JVMTI_TYPE_JBYTE" num="101"> 9582 Java programming language primitive type - <code>byte</code>. 9583 JNI type <code>jbyte</code>. 9584 </constant> 9585 <constant id="JVMTI_TYPE_JCHAR" num="102"> 9586 Java programming language primitive type - <code>char</code>. 9587 JNI type <code>jchar</code>. 9588 </constant> 9589 <constant id="JVMTI_TYPE_JSHORT" num="103"> 9590 Java programming language primitive type - <code>short</code>. 9591 JNI type <code>jshort</code>. 9592 </constant> 9593 <constant id="JVMTI_TYPE_JINT" num="104"> 9594 Java programming language primitive type - <code>int</code>. 9595 JNI type <datalink id="jint"></datalink>. 9596 </constant> 9597 <constant id="JVMTI_TYPE_JLONG" num="105"> 9598 Java programming language primitive type - <code>long</code>. 9599 JNI type <datalink id="jlong"></datalink>. 9600 </constant> 9601 <constant id="JVMTI_TYPE_JFLOAT" num="106"> 9602 Java programming language primitive type - <code>float</code>. 9603 JNI type <datalink id="jfloat"></datalink>. 9604 </constant> 9605 <constant id="JVMTI_TYPE_JDOUBLE" num="107"> 9606 Java programming language primitive type - <code>double</code>. 9607 JNI type <datalink id="jdouble"></datalink>. 9608 </constant> 9609 <constant id="JVMTI_TYPE_JBOOLEAN" num="108"> 9610 Java programming language primitive type - <code>boolean</code>. 9611 JNI type <datalink id="jboolean"></datalink>. 9612 </constant> 9613 <constant id="JVMTI_TYPE_JOBJECT" num="109"> 9614 Java programming language object type - <code>java.lang.Object</code>. 9615 JNI type <datalink id="jobject"></datalink>. 9616 Returned values are JNI local references and must be managed. 9617 </constant> 9618 <constant id="JVMTI_TYPE_JTHREAD" num="110"> 9619 Java programming language object type - <code>java.lang.Thread</code>. 9620 <jvmti/> type <datalink id="jthread"></datalink>. 9621 Returned values are JNI local references and must be managed. 9622 </constant> 9623 <constant id="JVMTI_TYPE_JCLASS" num="111"> 9624 Java programming language object type - <code>java.lang.Class</code>. 9625 JNI type <datalink id="jclass"></datalink>. 9626 Returned values are JNI local references and must be managed. 9627 </constant> 9628 <constant id="JVMTI_TYPE_JVALUE" num="112"> 9629 Union of all Java programming language primitive and object types - 9630 JNI type <datalink id="jvalue"></datalink>. 9631 Returned values which represent object types are JNI local references and must be managed. 9632 </constant> 9633 <constant id="JVMTI_TYPE_JFIELDID" num="113"> 9634 Java programming language field identifier - 9635 JNI type <datalink id="jfieldID"></datalink>. 9636 </constant> 9637 <constant id="JVMTI_TYPE_JMETHODID" num="114"> 9638 Java programming language method identifier - 9639 JNI type <datalink id="jmethodID"></datalink>. 9640 </constant> 9641 <constant id="JVMTI_TYPE_CCHAR" num="115"> 9642 C programming language type - <code>char</code>. 9643 </constant> 9644 <constant id="JVMTI_TYPE_CVOID" num="116"> 9645 C programming language type - <code>void</code>. 9646 </constant> 9647 <constant id="JVMTI_TYPE_JNIENV" num="117"> 9648 JNI environment - <code>JNIEnv</code>. 9649 Should be used with the correct <datalink id="jvmtiParamKind"/> to make it a pointer type. 9650 </constant> 9651 </constants> 9652 9653 <constants id="jvmtiParamKind" label="Extension Function/Event Parameter Kinds" kind="enum"> 9654 <constant id="JVMTI_KIND_IN" num="91"> 9655 Ingoing argument - <code>foo</code>. 9656 </constant> 9657 <constant id="JVMTI_KIND_IN_PTR" num="92"> 9658 Ingoing pointer argument - <code>const foo*</code>. 9659 </constant> 9660 <constant id="JVMTI_KIND_IN_BUF" num="93"> 9661 Ingoing array argument - <code>const foo*</code>. 9662 </constant> 9663 <constant id="JVMTI_KIND_ALLOC_BUF" num="94"> 9664 Outgoing allocated array argument - <code>foo**</code>. 9665 Free with <code>Deallocate</code>. 9666 </constant> 9667 <constant id="JVMTI_KIND_ALLOC_ALLOC_BUF" num="95"> 9668 Outgoing allocated array of allocated arrays argument - <code>foo***</code>. 9669 Free with <code>Deallocate</code>. 9670 </constant> 9671 <constant id="JVMTI_KIND_OUT" num="96"> 9672 Outgoing argument - <code>foo*</code>. 9673 </constant> 9674 <constant id="JVMTI_KIND_OUT_BUF" num="97"> 9675 Outgoing array argument (pre-allocated by agent) - <code>foo*</code>. 9676 Do not <code>Deallocate</code>. 9677 </constant> 9678 </constants> 9679 9680 </intro> 9681 9682 <typedef id="jvmtiParamInfo" label="Extension Function/Event Parameter Info"> 9683 <field id="name"> 9684 <allocfieldbuf><char/></allocfieldbuf> 9685 <description> 9686 The parameter name, encoded as a 9687 <internallink id="mUTF">modified UTF-8</internallink> string 9688 </description> 9689 </field> 9690 <field id="kind"> 9691 <enum>jvmtiParamKind</enum> 9692 <description> 9693 The kind of the parameter - type modifiers 9694 </description> 9695 </field> 9696 <field id="base_type"> 9697 <enum>jvmtiParamTypes</enum> 9698 <description> 9699 The base type of the parameter - modified by <code>kind</code> 9700 </description> 9701 </field> 9702 <field id="null_ok"> 9703 <jboolean/> 9704 <description> 9705 Is a <code>NULL</code> argument permitted? Applies only to pointer and object types. 9706 </description> 9707 </field> 9708 </typedef> 9709 9710 <callback id="jvmtiExtensionFunction"> 9711 <enum>jvmtiError</enum> 9712 <synopsis>Extension Function</synopsis> 9713 <description> 9714 This is the implementation-specific extension function. 9715 </description> 9716 <parameters> 9717 <param id="jvmti_env"> 9718 <outptr> 9719 <struct>jvmtiEnv</struct> 9720 </outptr> 9721 <description> 9722 The <jvmti/> environment is the only fixed parameter for extension functions. 9723 </description> 9724 </param> 9725 <param id="..."> 9726 <varargs/> 9727 <description> 9728 The extension function-specific parameters 9729 </description> 9730 </param> 9731 </parameters> 9732 </callback> 9733 9734 <function id="GetExtensionFunctions" phase="onload" num="124"> 9735 <synopsis>Get Extension Functions</synopsis> 9736 9737 <typedef id="jvmtiExtensionFunctionInfo" label="Extension Function Info"> 9738 <field id="func"> 9739 <ptrtype> 9740 <struct>jvmtiExtensionFunction</struct> 9741 </ptrtype> 9742 <description> 9743 The actual function to call 9744 </description> 9745 </field> 9746 <field id="id"> 9747 <allocfieldbuf><char/></allocfieldbuf> 9748 <description> 9749 The identifier for the extension function, encoded as a 9750 <internallink id="mUTF">modified UTF-8</internallink> string. 9751 Uses package name conventions. 9752 For example, <code>com.sun.hotspot.bar</code> 9753 </description> 9754 </field> 9755 <field id="short_description"> 9756 <allocfieldbuf><char/></allocfieldbuf> 9757 <description> 9758 A one sentence description of the function, encoded as a 9759 <internallink id="mUTF">modified UTF-8</internallink> string. 9760 </description> 9761 </field> 9762 <field id="param_count"> 9763 <jint/> 9764 <description> 9765 The number of parameters excluding <code>jvmtiEnv *jvmti_env</code> 9766 </description> 9767 </field> 9768 <field id="params"> 9769 <allocfieldbuf outcount="param_count"> 9770 <struct>jvmtiParamInfo</struct> 9771 </allocfieldbuf> 9772 <description> 9773 Array of 9774 <fieldlink id="param_count" struct="jvmtiExtensionFunctionInfo"></fieldlink> 9775 parameters (<code>jvmtiEnv *jvmti_env</code> excluded) 9776 </description> 9777 </field> 9778 <field id="error_count"> 9779 <jint/> 9780 <description> 9781 The number of possible error returns (excluding universal errors) 9782 </description> 9783 </field> 9784 <field id="errors"> 9785 <allocfieldbuf outcount="error_count"> 9786 <enum>jvmtiError</enum> 9787 </allocfieldbuf> 9788 <description> 9789 Array of <fieldlink id="error_count" struct="jvmtiExtensionFunctionInfo"></fieldlink> 9790 possible errors 9791 </description> 9792 </field> 9793 </typedef> 9794 9795 <description> 9796 Returns the set of extension functions. 9797 </description> 9798 <origin>new</origin> 9799 <capabilities> 9800 </capabilities> 9801 <parameters> 9802 <param id="extension_count_ptr"> 9803 <outptr><jint/></outptr> 9804 <description> 9805 On return, points to the number of extension functions 9806 </description> 9807 </param> 9808 <param id="extensions"> 9809 <allocbuf outcount="extension_count_ptr"><struct>jvmtiExtensionFunctionInfo</struct></allocbuf> 9810 <description> 9811 Returns an array of extension function info, one per function 9812 </description> 9813 </param> 9814 </parameters> 9815 <errors> 9816 </errors> 9817 </function> 9818 9819 <function id="GetExtensionEvents" phase="onload" num="125"> 9820 <synopsis>Get Extension Events</synopsis> 9821 9822 <typedef id="jvmtiExtensionEventInfo" label="Extension Event Info"> 9823 <field id="extension_event_index"> 9824 <jint/> 9825 <description> 9826 The identifying index of the event 9827 </description> 9828 </field> 9829 <field id="id"> 9830 <allocfieldbuf><char/></allocfieldbuf> 9831 <description> 9832 The identifier for the extension event, encoded as a 9833 <internallink id="mUTF">modified UTF-8</internallink> string. 9834 Uses package name conventions. 9835 For example, <code>com.sun.hotspot.bar</code> 9836 </description> 9837 </field> 9838 <field id="short_description"> 9839 <allocfieldbuf><char/></allocfieldbuf> 9840 <description> 9841 A one sentence description of the event, encoded as a 9842 <internallink id="mUTF">modified UTF-8</internallink> string. 9843 </description> 9844 </field> 9845 <field id="param_count"> 9846 <jint/> 9847 <description> 9848 The number of parameters excluding <code>jvmtiEnv *jvmti_env</code> 9849 </description> 9850 </field> 9851 <field id="params"> 9852 <allocfieldbuf outcount="param_count"> 9853 <struct>jvmtiParamInfo</struct> 9854 </allocfieldbuf> 9855 <description> 9856 Array of 9857 <fieldlink id="param_count" struct="jvmtiExtensionEventInfo"></fieldlink> 9858 parameters (<code>jvmtiEnv *jvmti_env</code> excluded) 9859 </description> 9860 </field> 9861 </typedef> 9862 9863 <description> 9864 Returns the set of extension events. 9865 </description> 9866 <origin>new</origin> 9867 <capabilities> 9868 </capabilities> 9869 <parameters> 9870 <param id="extension_count_ptr"> 9871 <outptr><jint/></outptr> 9872 <description> 9873 On return, points to the number of extension events 9874 </description> 9875 </param> 9876 <param id="extensions"> 9877 <allocbuf outcount="extension_count_ptr"><struct>jvmtiExtensionEventInfo</struct></allocbuf> 9878 <description> 9879 Returns an array of extension event info, one per event 9880 </description> 9881 </param> 9882 </parameters> 9883 <errors> 9884 </errors> 9885 </function> 9886 9887 <callback id="jvmtiExtensionEvent"> 9888 <void/> 9889 <synopsis>Extension Event</synopsis> 9890 <description> 9891 This is the implementation-specific event. 9892 The event handler is set with 9893 <functionlink id="SetExtensionEventCallback"/>. 9894 <p/> 9895 Event handlers for extension events must be declared varargs to match this definition. 9896 Failure to do so could result in calling convention mismatch and undefined behavior 9897 on some platforms. 9898 <p/> 9899 For example, if the <code>jvmtiParamInfo</code> 9900 returned by <functionlink id="GetExtensionEvents"/> indicates that 9901 there is a <code>jint</code> parameter, the event handler should be 9902 declared: 9903<example> 9904 void JNICALL myHandler(jvmtiEnv* jvmti_env, jint myInt, ...) 9905</example> 9906 Note the terminal "<code>...</code>" which indicates varargs. 9907 </description> 9908 <parameters> 9909 <param id="jvmti_env"> 9910 <outptr> 9911 <struct>jvmtiEnv</struct> 9912 </outptr> 9913 <description> 9914 The <jvmti/> environment is the only fixed parameter for extension events. 9915 </description> 9916 </param> 9917 <param id="..."> 9918 <varargs/> 9919 <description> 9920 The extension event-specific parameters 9921 </description> 9922 </param> 9923 </parameters> 9924 </callback> 9925 9926 <function id="SetExtensionEventCallback" phase="onload" num="126"> 9927 <synopsis>Set Extension Event Callback</synopsis> 9928 9929 <description> 9930 Sets the callback function for an extension event and 9931 enables the event. Or, if the callback is <code>NULL</code>, disables 9932 the event. Note that unlike standard events, setting 9933 the callback and enabling the event are a single operation. 9934 </description> 9935 <origin>new</origin> 9936 <capabilities> 9937 </capabilities> 9938 <parameters> 9939 <param id="extension_event_index"> 9940 <jint/> 9941 <description> 9942 Identifies which callback to set. 9943 This index is the 9944 <fieldlink id="extension_event_index" struct="jvmtiExtensionEventInfo"></fieldlink> 9945 field of 9946 <datalink id="jvmtiExtensionEventInfo"/>. 9947 </description> 9948 </param> 9949 <param id="callback"> 9950 <ptrtype> 9951 <struct>jvmtiExtensionEvent</struct> 9952 <nullok>disable the event</nullok> 9953 </ptrtype> 9954 <description> 9955 If <code>callback</code> is non-<code>NULL</code>, 9956 set <code>callback</code> to be the event callback function 9957 and enable the event. 9958 </description> 9959 </param> 9960 </parameters> 9961 <errors> 9962 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 9963 <paramlink id="extension_event_index"/> is not an 9964 <fieldlink id="extension_event_index" 9965 struct="jvmtiExtensionEventInfo"/> 9966 returned by 9967 <functionlink id="GetExtensionEvents"/> 9968 </error> 9969 </errors> 9970 </function> 9971 9972 </category> 9973 9974 <category id="capability" label="Capability"> 9975 9976 <intro> 9977 The capabilities functions allow you to change the 9978 functionality available to <jvmti/>--that is, 9979 which <jvmti/> 9980 functions can be called, what events can be generated, 9981 and what functionality these events and functions can 9982 provide. 9983 <p/> 9984 The "Capabilities" section of each function and event describe which 9985 capabilities, if any, they are associated with. "Required Functionality" 9986 means it is available for use and no capabilities must be added to use it. 9987 "Optional Functionality" means the agent must possess the capability 9988 before it can be used. 9989 To possess a capability, the agent must 9990 <functionlink id="AddCapabilities">add the capability</functionlink>. 9991 "Optional Features" describe capabilities which, 9992 if added, extend the feature set. 9993 <p/> 9994 The potentially available capabilities of each <jvmti/> implementation are different. 9995 Depending on the implementation, a capability: 9996 <ul> 9997 <li>may never be added</li> 9998 <li>may be added in either the <code>OnLoad</code> or live phase in any environment</li> 9999 <li>may be added only during the <code>OnLoad</code> phase</li> 10000 <li>may be possessed by only one environment at a time</li> 10001 <li>may be possessed by only one environment at a time, 10002 and only during the <code>OnLoad</code> phase</li> 10003 <li>and so on ...</li> 10004 </ul> 10005 Frequently, the addition of a capability may incur a cost in execution speed, start up 10006 time, and/or memory footprint. Note that the overhead of using a capability 10007 is completely different than the overhead of possessing a capability. 10008 Take single stepping as an example. When single stepping is on (that 10009 is, when the event is enabled and thus actively sending events) 10010 the overhead of sending and processing an event 10011 on each instruction is huge in any implementation. 10012 However, the overhead of possessing the capability may be small or large, 10013 depending on the implementation. Also, when and if a capability is potentially 10014 available depends on the implementation. Some examples: 10015 <ul> 10016 <li>One VM might perform all execution by compiling bytecodes into 10017 native code and be unable to generate single step instructions. 10018 In this implementation the capability can not be added.</li> 10019 <li>Another VM may be able to switch execution to a single stepping 10020 interpreter at any time. In this implementation, having the capability has no 10021 overhead and could be added at any time.</li> 10022 <li>Yet another VM might be able to choose a bytecode compiling or single stepping capable interpreted 10023 execution engine at start up, but be unable to switch between them. 10024 In this implementation the capability would need to be added 10025 during the <code>OnLoad</code> phase (before bytecode 10026 execution begins) and would have a large impact on execution speed 10027 even if single stepping was never used.</li> 10028 <li>Still another VM might be able to add an "is single stepping on" check 10029 into compiled bytecodes or a generated interpreter. Again in this implementation 10030 the capability would need to be added during the <code>OnLoad</code> phase but the overhead (a test 10031 and branch on each instruction) would be considerably less.</li> 10032 </ul> 10033 <p/> 10034 Each <jvmti/> <internallink id="environments">environment</internallink> 10035 has its own set of capabilities. 10036 Initially, that set is empty. 10037 Any desired capability must be added. 10038 If possible, capabilities should be added during the <code>OnLoad</code> phase. For most 10039 virtual machines certain capabilities require special set up for 10040 the virtual machine and this set up must happen 10041 during the <code>OnLoad</code> phase, before the virtual machine begins execution. 10042 Once a capability is added, it can 10043 only be removed if explicitly relinquished by the environment. 10044 <p/> 10045 The agent can, 10046 <functionlink id="GetPotentialCapabilities">determine what 10047 capabilities this VM can potentially provide</functionlink>, 10048 <functionlink id="AddCapabilities">add the capabilities 10049 to be used</functionlink>, 10050 <functionlink id="RelinquishCapabilities">release capabilities 10051 which are no longer needed</functionlink>, and 10052 <functionlink id="GetCapabilities">examine the currently available 10053 capabilities</functionlink>. 10054 </intro> 10055 10056 <intro id="capabilityExamples" label="Capability Examples"> 10057 For example, a freshly started agent (in the <code>OnLoad</code> function) 10058 wants to enable all possible capabilities. 10059 Note that, in general, this is not advisable as the agent may suffer 10060 a performance penalty for functionality it is not using. 10061 The code might look like this in C: 10062 <example> 10063 jvmtiCapabilities capa; 10064 jvmtiError err; 10065 10066 err = (*jvmti)->GetPotentialCapabilities(jvmti, &capa); 10067 if (err == JVMTI_ERROR_NONE) { 10068 err = (*jvmti)->AddCapabilities(jvmti, &capa); 10069 </example> 10070 For example, if an agent wants to check if it can get 10071 the bytecodes of a method (that is, it wants to check 10072 if it previously added this capability and has not 10073 relinquished it), the code might 10074 look like this in C: 10075 <example> 10076 jvmtiCapabilities capa; 10077 jvmtiError err; 10078 10079 err = (*jvmti)->GetCapabilities(jvmti, &capa); 10080 if (err == JVMTI_ERROR_NONE) { 10081 if (capa.can_get_bytecodes) { ... } } 10082 </example> 10083 </intro> 10084 10085 <capabilitiestypedef id="jvmtiCapabilities" label="The Capabilities Structure"> 10086 <description> 10087 The functions in this category use this capabilities structure 10088 which contains boolean flags corresponding to each capability: 10089 </description> 10090 <capabilityfield id="can_tag_objects"> 10091 <description> 10092 Can set and get tags, as described in the 10093 <internallink id="Heap">Heap category</internallink>. 10094 </description> 10095 </capabilityfield> 10096 <capabilityfield id="can_generate_field_modification_events"> 10097 <description> 10098 Can set watchpoints on field modification - 10099 <functionlink id="SetFieldModificationWatch"></functionlink> 10100 </description> 10101 </capabilityfield> 10102 <capabilityfield id="can_generate_field_access_events"> 10103 <description> 10104 Can set watchpoints on field access - 10105 <functionlink id="SetFieldAccessWatch"></functionlink> 10106 </description> 10107 </capabilityfield> 10108 <capabilityfield id="can_get_bytecodes"> 10109 <description> 10110 Can get bytecodes of a method <functionlink id="GetBytecodes"></functionlink> 10111 </description> 10112 </capabilityfield> 10113 <capabilityfield id="can_get_synthetic_attribute"> 10114 <description> 10115 Can test if a field or method is synthetic - 10116 <functionlink id="IsFieldSynthetic"></functionlink> and 10117 <functionlink id="IsMethodSynthetic"></functionlink> 10118 </description> 10119 </capabilityfield> 10120 <capabilityfield id="can_get_owned_monitor_info"> 10121 <description> 10122 Can get information about ownership of monitors - 10123 <functionlink id="GetOwnedMonitorInfo"></functionlink> 10124 </description> 10125 </capabilityfield> 10126 <capabilityfield id="can_get_current_contended_monitor"> 10127 <description> 10128 Can <functionlink id="GetCurrentContendedMonitor"></functionlink> 10129 </description> 10130 </capabilityfield> 10131 <capabilityfield id="can_get_monitor_info"> 10132 <description> 10133 Can <functionlink id="GetObjectMonitorUsage"></functionlink> 10134 </description> 10135 </capabilityfield> 10136 <capabilityfield id="can_pop_frame"> 10137 <description> 10138 Can pop frames off the stack - <functionlink id="PopFrame"></functionlink> 10139 </description> 10140 </capabilityfield> 10141 <capabilityfield id="can_redefine_classes"> 10142 <description> 10143 Can redefine classes with <functionlink id="RedefineClasses"/>. 10144 </description> 10145 </capabilityfield> 10146 <capabilityfield id="can_signal_thread"> 10147 <description> 10148 Can send stop or interrupt to threads 10149 </description> 10150 </capabilityfield> 10151 <capabilityfield id="can_get_source_file_name"> 10152 <description> 10153 Can get the source file name of a class 10154 </description> 10155 </capabilityfield> 10156 <capabilityfield id="can_get_line_numbers"> 10157 <description> 10158 Can get the line number table of a method 10159 </description> 10160 </capabilityfield> 10161 <capabilityfield id="can_get_source_debug_extension"> 10162 <description> 10163 Can get the source debug extension of a class 10164 </description> 10165 </capabilityfield> 10166 <capabilityfield id="can_access_local_variables"> 10167 <description> 10168 Can set and get local variables 10169 </description> 10170 </capabilityfield> 10171 <capabilityfield id="can_maintain_original_method_order"> 10172 <description> 10173 Can return methods in the order they occur in the class file 10174 </description> 10175 </capabilityfield> 10176 <capabilityfield id="can_generate_single_step_events"> 10177 <description> 10178 Can get <eventlink id="SingleStep">single step</eventlink> events 10179 </description> 10180 </capabilityfield> 10181 <capabilityfield id="can_generate_exception_events"> 10182 <description> 10183 Can get <eventlink id="Exception">exception thrown</eventlink> and 10184 <eventlink id="ExceptionCatch">exception catch</eventlink> events 10185 </description> 10186 </capabilityfield> 10187 <capabilityfield id="can_generate_frame_pop_events"> 10188 <description> 10189 Can <functionlink id="NotifyFramePop">set</functionlink> and thus get 10190 <eventlink id="FramePop"></eventlink> events 10191 </description> 10192 </capabilityfield> 10193 <capabilityfield id="can_generate_breakpoint_events"> 10194 <description> 10195 Can <functionlink id="SetBreakpoint">set</functionlink> and thus get 10196 <eventlink id="Breakpoint"></eventlink> events 10197 </description> 10198 </capabilityfield> 10199 <capabilityfield id="can_suspend"> 10200 <description> 10201 Can suspend and resume threads 10202 </description> 10203 </capabilityfield> 10204 <capabilityfield id="can_redefine_any_class"> 10205 <description> 10206 <functionlink id="RedefineClasses"/> can be called on any modifiable class. 10207 See <functionlink id="IsModifiableClass"/>. 10208 (<fieldlink id="can_redefine_classes" struct="jvmtiCapabilities"/> 10209 must also be set) 10210 </description> 10211 </capabilityfield> 10212 <capabilityfield id="can_get_current_thread_cpu_time"> 10213 <description> 10214 Can <functionlink id="GetCurrentThreadCpuTime">get</functionlink> 10215 current thread CPU time 10216 </description> 10217 </capabilityfield> 10218 <capabilityfield id="can_get_thread_cpu_time"> 10219 <description> 10220 Can <functionlink id="GetThreadCpuTime">get</functionlink> 10221 thread CPU time 10222 </description> 10223 </capabilityfield> 10224 <capabilityfield id="can_generate_method_entry_events" 10225 disp1="can_generate" disp2="_method_entry_events" 10226 > 10227 <description> 10228 Can generate method entry events on entering a method 10229 </description> 10230 </capabilityfield> 10231 <capabilityfield id="can_generate_method_exit_events" 10232 disp1="can_generate" disp2="_method_exit_events" 10233 > 10234 <description> 10235 Can generate method exit events on leaving a method 10236 </description> 10237 </capabilityfield> 10238 <capabilityfield id="can_generate_all_class_hook_events" 10239 disp1="can_generate" disp2="_all_class_hook_events" 10240 > 10241 <description> 10242 Can generate ClassFileLoadHook events for every loaded class. 10243 </description> 10244 </capabilityfield> 10245 <capabilityfield id="can_generate_compiled_method_load_events" 10246 disp1="can_generate" disp2="_compiled_method_load_events" 10247 > 10248 <description> 10249 Can generate events when a method is compiled or unloaded 10250 </description> 10251 </capabilityfield> 10252 <capabilityfield id="can_generate_monitor_events" 10253 disp1="can_generate" disp2="_monitor_events" 10254 > 10255 <description> 10256 Can generate events on monitor activity 10257 </description> 10258 </capabilityfield> 10259 <capabilityfield id="can_generate_vm_object_alloc_events" 10260 disp1="can_generate" disp2="_vm_object_alloc_events" 10261 > 10262 <description> 10263 Can generate events on VM allocation of an object 10264 </description> 10265 </capabilityfield> 10266 <capabilityfield id="can_generate_native_method_bind_events" 10267 disp1="can_generate" disp2="_native_method_bind_events" 10268 > 10269 <description> 10270 Can generate events when a native method is bound to its 10271 implementation 10272 </description> 10273 </capabilityfield> 10274 <capabilityfield id="can_generate_garbage_collection_events" 10275 disp1="can_generate" disp2="_garbage_collection_events" 10276 > 10277 <description> 10278 Can generate events when garbage collection begins or ends 10279 </description> 10280 </capabilityfield> 10281 <capabilityfield id="can_generate_object_free_events" 10282 disp1="can_generate" disp2="_object_free_events" 10283 > 10284 <description> 10285 Can generate events when the garbage collector frees an object 10286 </description> 10287 </capabilityfield> 10288 <capabilityfield id="can_force_early_return" since="1.1"> 10289 <description> 10290 Can return early from a method, as described in the 10291 <internallink id="ForceEarlyReturn">Force Early Return category</internallink>. 10292 </description> 10293 </capabilityfield> 10294 <capabilityfield id="can_get_owned_monitor_stack_depth_info" since="1.1"> 10295 <description> 10296 Can get information about owned monitors with stack depth - 10297 <functionlink id="GetOwnedMonitorStackDepthInfo"></functionlink> 10298 </description> 10299 </capabilityfield> 10300 <capabilityfield id="can_get_constant_pool" since="1.1"> 10301 <description> 10302 Can get the constant pool of a class - 10303 <functionlink id="GetConstantPool"></functionlink> 10304 </description> 10305 </capabilityfield> 10306 <capabilityfield id="can_set_native_method_prefix" since="1.1"> 10307 <description> 10308 Can set prefix to be applied when native method cannot be resolved - 10309 <functionlink id="SetNativeMethodPrefix"/> and 10310 <functionlink id="SetNativeMethodPrefixes"/> 10311 </description> 10312 </capabilityfield> 10313 <capabilityfield id="can_retransform_classes" since="1.1"> 10314 <description> 10315 Can retransform classes with <functionlink id="RetransformClasses"/>. 10316 In addition to the restrictions imposed by the specific 10317 implementation on this capability (see the 10318 <internallink id="capability">Capability</internallink> section), 10319 this capability must be set before the 10320 <eventlink id="ClassFileLoadHook"/> event is enabled for the 10321 first time in this environment. 10322 An environment that possesses this capability at the time that 10323 <code>ClassFileLoadHook</code> is enabled for the first time is 10324 said to be <i>retransformation capable</i>. 10325 An environment that does not possess this capability at the time that 10326 <code>ClassFileLoadHook</code> is enabled for the first time is 10327 said to be <i>retransformation incapable</i>. 10328 </description> 10329 </capabilityfield> 10330 <capabilityfield id="can_retransform_any_class" since="1.1"> 10331 <description> 10332 <functionlink id="RetransformClasses"/> can be called on any modifiable class. 10333 See <functionlink id="IsModifiableClass"/>. 10334 (<fieldlink id="can_retransform_classes" struct="jvmtiCapabilities"/> 10335 must also be set) 10336 </description> 10337 </capabilityfield> 10338 <capabilityfield id="can_generate_resource_exhaustion_heap_events" since="1.1"> 10339 <description> 10340 Can generate events when the VM is unable to allocate memory from 10341 the <tm>Java</tm> platform heap. 10342 See <eventlink id="ResourceExhausted"/>. 10343 </description> 10344 </capabilityfield> 10345 <capabilityfield id="can_generate_resource_exhaustion_threads_events" since="1.1"> 10346 <description> 10347 Can generate events when the VM is unable to create a thread. 10348 See <eventlink id="ResourceExhausted"/>. 10349 </description> 10350 </capabilityfield> 10351 <capabilityfield id="can_generate_early_vmstart" since="9"> 10352 <description> 10353 Can generate the <code>VMStart</code> event early. 10354 See <eventlink id="VMStart"/>. 10355 </description> 10356 </capabilityfield> 10357 <capabilityfield id="can_generate_early_class_hook_events" since="9"> 10358 <description> 10359 Can generate the <eventlink id="ClassFileLoadHook"/> events 10360 in the primordial phase. If this capability and 10361 <internallink id="jvmtiCapabilities.can_generate_all_class_hook_events"> 10362 <code>can_generate_all_class_hook_events</code></internallink> 10363 are enabled then the <eventlink id="ClassFileLoadHook"/> events 10364 can be posted for classes loaded in the primordial phase. 10365 See <eventlink id="ClassFileLoadHook"/>. 10366 </description> 10367 </capabilityfield> 10368 <capabilityfield id="can_generate_sampled_object_alloc_events" since="11"> 10369 <description> 10370 Can generate sampled allocation events. 10371 If this capability is enabled then the heap sampling method 10372 <functionlink id="SetHeapSamplingInterval"></functionlink> can be 10373 called and <eventlink id="SampledObjectAlloc"></eventlink> events can be generated. 10374 </description> 10375 </capabilityfield> 10376 </capabilitiestypedef> 10377 10378 <function id="GetPotentialCapabilities" jkernel="yes" phase="onload" num="140"> 10379 <synopsis>Get Potential Capabilities</synopsis> 10380 <description> 10381 Returns via <paramlink id="capabilities_ptr"></paramlink> the <jvmti/> 10382 features that can potentially be possessed by this environment 10383 at this time. 10384 The returned capabilities differ from the complete set of capabilities 10385 implemented by the VM in two cases: another environment possesses 10386 capabilities that can only be possessed by one environment, or the 10387 current <functionlink id="GetPhase">phase</functionlink> is live, 10388 and certain capabilities can only be added during the <code>OnLoad</code> phase. 10389 The <functionlink id="AddCapabilities"></functionlink> function 10390 may be used to set any or all or these capabilities. 10391 Currently possessed capabilities are included. 10392 <p/> 10393 Typically this function is used in the <code>OnLoad</code> function. 10394 Some virtual machines may allow a limited set of capabilities to be 10395 added in the live phase. 10396 In this case, the set of potentially available capabilities 10397 will likely differ from the <code>OnLoad</code> phase set. 10398 <p/> 10399 See the 10400 <internallink id="capabilityExamples">Capability Examples</internallink>. 10401 </description> 10402 <origin>new</origin> 10403 <capabilities> 10404 </capabilities> 10405 <parameters> 10406 <param id="capabilities_ptr"> 10407 <outptr><struct>jvmtiCapabilities</struct></outptr> 10408 <description> 10409 On return, points to the <jvmti/> capabilities that may be added. 10410 </description> 10411 </param> 10412 </parameters> 10413 <errors> 10414 </errors> 10415 </function> 10416 10417 <elide> 10418 <function id="EstimateCostOfCapabilities" phase="onload" num="141"> 10419 <synopsis>Estimate Cost Of Capabilities</synopsis> 10420 <description> 10421 <issue>There is strong opposition to this function. The concern is 10422 that it would be difficult or impossible to provide meaningful 10423 numbers, as the amount of impact is conditional on many factors 10424 that a single number could not represent. There is doubt that 10425 conditional implementations would be used or are even a good idea. 10426 The thought is that release documentation for the implementation 10427 would be the best means of exposing this information. 10428 Unless new arguments are presented, I intend to remove this 10429 function in the next revision. 10430 </issue> 10431 <p/> 10432 Return via the <paramlink id="time_impact_ptr"></paramlink> and 10433 <paramlink id="space_impact_ptr"></paramlink> an estimate of the impact 10434 of adding the capabilities pointed to by 10435 <paramlink id="capabilities_ptr"></paramlink>. 10436 The returned estimates are in percentage of additional overhead, thus 10437 a time impact of 100 mean the application might run 10438 at half the speed. 10439 The estimates are very rough approximations and are not guaranteed. 10440 Note also, that the estimates are of the impact of having the 10441 capability available--when and if it is used the impact may be 10442 much greater. 10443 Estimates can be for a single capability or for a set of 10444 capabilities. Note that the costs are not necessarily additive, 10445 adding support for one capability might make another available 10446 for free or conversely having two capabilities at once may 10447 have multiplicative impact. 10448 Estimates are relative to the current set of capabilities - 10449 that is, how much more impact given the currently possessed capabilities. 10450 <p/> 10451 Typically this function is used in the OnLoad function, 10452 some virtual machines may allow a limited set of capabilities to be 10453 added in the live phase. 10454 In this case, the set of potentially available capabilities 10455 will likely differ from the OnLoad phase set. 10456 <p/> 10457 See the 10458 <internallink id="capabilityExamples">Capability Examples</internallink>. 10459 </description> 10460 <origin>new</origin> 10461 <capabilities> 10462 </capabilities> 10463 <parameters> 10464 <param id="capabilities_ptr"> 10465 <inptr><struct>jvmtiCapabilities</struct></inptr> 10466 <description> 10467 points to the <jvmti/> capabilities to evaluate. 10468 </description> 10469 </param> 10470 <param id="time_impact_ptr"> 10471 <outptr><jint/></outptr> 10472 <description> 10473 On return, points to the estimated percentage increase in 10474 run time if this capability was added. 10475 </description> 10476 </param> 10477 <param id="space_impact_ptr"> 10478 <outptr><jint/></outptr> 10479 <description> 10480 On return, points to the estimated percentage increase in 10481 memory space used if this capability was added. 10482 </description> 10483 </param> 10484 </parameters> 10485 <errors> 10486 <error id="JVMTI_ERROR_NOT_AVAILABLE"> 10487 The desired capabilities are not even potentially available. 10488 </error> 10489 </errors> 10490 </function> 10491 </elide> 10492 10493 <function id="AddCapabilities" jkernel="yes" phase="onload" num="142"> 10494 <synopsis>Add Capabilities</synopsis> 10495 <description> 10496 Set new capabilities by adding the capabilities 10497 whose values are set to one (<code>1</code>) in 10498 <code>*</code><paramlink id="capabilities_ptr"></paramlink>. 10499 All previous capabilities are retained. 10500 Typically this function is used in the <code>OnLoad</code> function. 10501 Some virtual machines may allow a limited set of capabilities to be 10502 added in the live phase. 10503 <p/> 10504 See the 10505 <internallink id="capabilityExamples">Capability Examples</internallink>. 10506 </description> 10507 <origin>new</origin> 10508 <capabilities> 10509 </capabilities> 10510 <parameters> 10511 <param id="capabilities_ptr"> 10512 <inptr><struct>jvmtiCapabilities</struct></inptr> 10513 <description> 10514 Points to the <jvmti/> capabilities to add. 10515 </description> 10516 </param> 10517 </parameters> 10518 <errors> 10519 <error id="JVMTI_ERROR_NOT_AVAILABLE"> 10520 The desired capabilities are not even potentially available. 10521 </error> 10522 </errors> 10523 </function> 10524 10525 10526 <function id="RelinquishCapabilities" phase="onload" num="143"> 10527 <synopsis>Relinquish Capabilities</synopsis> 10528 <description> 10529 Relinquish the capabilities 10530 whose values are set to one (<code>1</code>) in 10531 <code>*</code><paramlink id="capabilities_ptr"></paramlink>. 10532 Some implementations may allow only one environment to have a capability 10533 (see the <internallink id="capability">capability introduction</internallink>). 10534 This function releases capabilities 10535 so that they may be used by other agents. 10536 All other capabilities are retained. 10537 The capability will no longer be present in <functionlink id="GetCapabilities"></functionlink>. 10538 Attempting to relinquish a capability that the agent does not possess is not an error. 10539 <issue> 10540 It is possible for the agent to be actively using capabilities 10541 which are being relinquished. For example, a thread is currently 10542 suspended and can_suspend is being relinquished or an event is currently 10543 enabled and can_generate_whatever is being relinquished. 10544 There are three possible ways we could spec this: 10545 <ul> 10546 <li>relinquish automatically releases them</li> 10547 <li>relinquish checks and returns some error code if held</li> 10548 <li>it is the agent's responsibility and it is not checked</li> 10549 </ul> 10550 One of these should be chosen. 10551 </issue> 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 relinquish. 10561 </description> 10562 </param> 10563 </parameters> 10564 <errors> 10565 </errors> 10566 </function> 10567 10568 10569 10570 <function id="GetCapabilities" jkernel="yes" phase="any" num="89"> 10571 <synopsis>Get Capabilities</synopsis> 10572 <description> 10573 Returns via <paramlink id="capabilities_ptr"></paramlink> the optional <jvmti/> 10574 features which this environment currently possesses. 10575 Each possessed capability is indicated by a one (<code>1</code>) in the 10576 corresponding field of the <internallink id="jvmtiCapabilities">capabilities 10577 structure</internallink>. 10578 An environment does not possess a capability unless it has been successfully added with 10579 <functionlink id="AddCapabilities"/>. 10580 An environment only loses possession of a capability if it has been relinquished with 10581 <functionlink id="RelinquishCapabilities"/>. Thus, this function returns the net result 10582 of the <code>AddCapabilities</code> and <code>RelinquishCapabilities</code> calls which 10583 have been made. 10584 <p/> 10585 See the 10586 <internallink id="capabilityExamples">Capability Examples</internallink>. 10587 </description> 10588 <origin>jvmdiClone</origin> 10589 <capabilities> 10590 </capabilities> 10591 <parameters> 10592 <param id="capabilities_ptr"> 10593 <outptr><struct>jvmtiCapabilities</struct></outptr> 10594 <description> 10595 On return, points to the <jvmti/> capabilities. 10596 </description> 10597 </param> 10598 </parameters> 10599 <errors> 10600 </errors> 10601 </function> 10602 10603 </category> 10604 10605 10606 <category id="timers" label="Timers"> 10607 10608 <intro> 10609 These functions provide timing information. 10610 The resolution at which the time is updated is not specified. 10611 They provides nanosecond precision, but not necessarily nanosecond accuracy. 10612 Details about the timers, such as their maximum values, can be accessed with 10613 the timer information functions. 10614 </intro> 10615 10616 <typedef id="jvmtiTimerInfo" label="Timer Info"> 10617 <description> 10618 The information function for each timer returns this data structure. 10619 </description> 10620 <field id="max_value"> 10621 <jlong/> 10622 <description> 10623 The maximum value the timer can reach. 10624 After this value is reached the timer wraps back to zero. 10625 This is an unsigned value. If tested or printed as a jlong (signed value) 10626 it may appear to be a negative number. 10627 </description> 10628 </field> 10629 <field id="may_skip_forward"> 10630 <jboolean/> 10631 <description> 10632 If true, the timer can be externally adjusted and as a result skip forward. 10633 If false, the timer value will never increase faster than real time. 10634 </description> 10635 </field> 10636 <field id="may_skip_backward"> 10637 <jboolean/> 10638 <description> 10639 If true, the timer can be externally adjusted and as a result skip backward. 10640 If false, the timer value will be monotonically increasing. 10641 </description> 10642 </field> 10643 <field id="kind"> 10644 <enum>jvmtiTimerKind</enum> 10645 <description> 10646 The kind of timer. 10647 On a platform that does not distinguish between user and system time, <datalink 10648 id="JVMTI_TIMER_TOTAL_CPU"><code>JVMTI_TIMER_TOTAL_CPU</code></datalink> 10649 is returned. 10650 </description> 10651 </field> 10652 <field id="reserved1"> 10653 <jlong/> 10654 <description> 10655 Reserved for future use. 10656 </description> 10657 </field> 10658 <field id="reserved2"> 10659 <jlong/> 10660 <description> 10661 Reserved for future use. 10662 </description> 10663 </field> 10664 </typedef> 10665 10666 <intro> 10667 Where the timer kind is -- 10668 10669 <constants id="jvmtiTimerKind" label="Timer Kinds" kind="enum"> 10670 <constant id="JVMTI_TIMER_USER_CPU" num="30"> 10671 CPU time that a thread is in user mode. 10672 </constant> 10673 <constant id="JVMTI_TIMER_TOTAL_CPU" num="31"> 10674 CPU time that a thread is in user or system mode. 10675 </constant> 10676 <constant id="JVMTI_TIMER_ELAPSED" num="32"> 10677 Elapsed time. 10678 </constant> 10679 </constants> 10680 </intro> 10681 10682 <function id="GetCurrentThreadCpuTimerInfo" callbacksafe="safe" impl="innative notrace" phase="start" num="134"> 10683 <synopsis>Get Current Thread CPU Timer Information</synopsis> 10684 <description> 10685 Get information about the 10686 <functionlink id="GetCurrentThreadCpuTime"/> timer. 10687 The fields of the <datalink id="jvmtiTimerInfo"/> structure 10688 are filled in with details about the timer. 10689 This information is specific to the platform and the implementation of 10690 <functionlink id="GetCurrentThreadCpuTime"/> and thus 10691 does not vary by thread nor does it vary 10692 during a particular invocation of the VM. 10693 <p/> 10694 Note that the implementations of <functionlink id="GetCurrentThreadCpuTime"/> 10695 and <functionlink id="GetThreadCpuTime"/> may differ, and thus the values 10696 returned by <code>GetCurrentThreadCpuTimerInfo</code> 10697 and <functionlink id="GetThreadCpuTimerInfo"/> 10698 may differ -- see <functionlink id="GetCurrentThreadCpuTime"/> for more information. 10699 </description> 10700 <origin>new</origin> 10701 <capabilities> 10702 <required id="can_get_current_thread_cpu_time"> 10703 Can get current thread CPU time. 10704 </required> 10705 </capabilities> 10706 <parameters> 10707 <param id="info_ptr"> 10708 <outptr><struct>jvmtiTimerInfo</struct></outptr> 10709 <description> 10710 On return, filled with information describing the time 10711 returned by <functionlink id="GetCurrentThreadCpuTime"/>. 10712 </description> 10713 </param> 10714 </parameters> 10715 <errors> 10716 </errors> 10717 </function> 10718 10719 <function id="GetCurrentThreadCpuTime" callbacksafe="safe" impl="innative notrace" phase="start" num="135"> 10720 <synopsis>Get Current Thread CPU Time</synopsis> 10721 <description> 10722 Return the CPU time utilized by the current thread. 10723 <p/> 10724 Note that the <functionlink id="GetThreadCpuTime"/> 10725 function provides CPU time for any thread, including 10726 the current thread. <code>GetCurrentThreadCpuTime</code> 10727 exists to support platforms which cannot 10728 supply CPU time for threads other than the current 10729 thread or which have more accurate information for 10730 the current thread (see 10731 <functionlink id="GetCurrentThreadCpuTimerInfo"/> vs 10732 <functionlink id="GetThreadCpuTimerInfo"/>). 10733 On many platforms this call will be equivalent to: 10734<example> 10735 GetThreadCpuTime(env, NULL, nanos_ptr) 10736</example> 10737 </description> 10738 <origin>new</origin> 10739 <capabilities> 10740 <required id="can_get_current_thread_cpu_time"> 10741 Can get current thread CPU time. 10742 <p/> 10743 If this capability is enabled after threads have started, 10744 the implementation may choose any time up 10745 to and including the time that the capability is enabled 10746 as the point where CPU time collection starts. 10747 <p/> 10748 This capability must be potentially available on any 10749 platform where 10750 <internallink id="jvmtiCapabilities.can_get_thread_cpu_time"><code>can_get_thread_cpu_time</code></internallink> 10751 is potentially available. 10752 </required> 10753 </capabilities> 10754 <parameters> 10755 <param id="nanos_ptr"> 10756 <outptr><jlong/></outptr> 10757 <description> 10758 On return, points to the CPU time used by this thread 10759 in nanoseconds. 10760 This is an unsigned value. If tested or printed as a jlong (signed value) 10761 it may appear to be a negative number. 10762 </description> 10763 </param> 10764 </parameters> 10765 <errors> 10766 </errors> 10767 </function> 10768 10769 <function id="GetThreadCpuTimerInfo" num="136"> 10770 <synopsis>Get Thread CPU Timer Information</synopsis> 10771 <description> 10772 Get information about the 10773 <functionlink id="GetThreadCpuTime"/> timer. 10774 The fields of the <datalink id="jvmtiTimerInfo"/> structure 10775 are filled in with details about the timer. 10776 This information is specific to the platform and the implementation of 10777 <functionlink id="GetThreadCpuTime"/> and thus 10778 does not vary by thread nor does it vary 10779 during a particular invocation of the VM. 10780 <p/> 10781 Note that the implementations of <functionlink id="GetCurrentThreadCpuTime"/> 10782 and <functionlink id="GetThreadCpuTime"/> may differ, and thus the values 10783 returned by <functionlink id="GetCurrentThreadCpuTimerInfo"/> 10784 and <code>GetThreadCpuTimerInfo</code> 10785 may differ -- see <functionlink id="GetCurrentThreadCpuTime"/> for more information. 10786 </description> 10787 <origin>new</origin> 10788 <capabilities> 10789 <required id="can_get_thread_cpu_time"> 10790 Can get thread CPU time. 10791 </required> 10792 </capabilities> 10793 <parameters> 10794 <param id="info_ptr"> 10795 <outptr><struct>jvmtiTimerInfo</struct></outptr> 10796 <description> 10797 On return, filled with information describing the time 10798 returned by <functionlink id="GetThreadCpuTime"/>. 10799 </description> 10800 </param> 10801 </parameters> 10802 <errors> 10803 </errors> 10804 </function> 10805 10806 <function id="GetThreadCpuTime" num="137"> 10807 <synopsis>Get Thread CPU Time</synopsis> 10808 <description> 10809 Return the CPU time utilized by the specified thread. 10810 <p/> 10811 Get information about this timer with 10812 <functionlink id="GetThreadCpuTimerInfo"/>. 10813 </description> 10814 <origin>new</origin> 10815 <capabilities> 10816 <required id="can_get_thread_cpu_time"> 10817 Can get thread CPU time. 10818 <p/> 10819 If this capability is enabled after threads have started, 10820 the implementation may choose any time up 10821 to and including the time that the capability is enabled 10822 as the point where CPU time collection starts. 10823 </required> 10824 </capabilities> 10825 <parameters> 10826 <param id="thread"> 10827 <jthread null="current"/> 10828 <description> 10829 The thread to query. 10830 </description> 10831 </param> 10832 <param id="nanos_ptr"> 10833 <outptr><jlong/></outptr> 10834 <description> 10835 On return, points to the CPU time used by the specified thread 10836 in nanoseconds. 10837 This is an unsigned value. If tested or printed as a jlong (signed value) 10838 it may appear to be a negative number. 10839 </description> 10840 </param> 10841 </parameters> 10842 <errors> 10843 </errors> 10844 </function> 10845 10846 <function id="GetTimerInfo" phase="any" callbacksafe="safe" num="138"> 10847 <synopsis>Get Timer Information</synopsis> 10848 <description> 10849 Get information about the 10850 <functionlink id="GetTime"/> timer. 10851 The fields of the <datalink id="jvmtiTimerInfo"/> structure 10852 are filled in with details about the timer. 10853 This information will not change during a particular invocation of the VM. 10854 </description> 10855 <origin>new</origin> 10856 <capabilities> 10857 </capabilities> 10858 <parameters> 10859 <param id="info_ptr"> 10860 <outptr><struct>jvmtiTimerInfo</struct></outptr> 10861 <description> 10862 On return, filled with information describing the time 10863 returned by <functionlink id="GetTime"/>. 10864 </description> 10865 </param> 10866 </parameters> 10867 <errors> 10868 </errors> 10869 </function> 10870 10871 <function id="GetTime" phase="any" callbacksafe="safe" num="139"> 10872 <synopsis>Get Time</synopsis> 10873 <description> 10874 Return the current value of the system timer, in nanoseconds. 10875 <p/> 10876 The value returned represents nanoseconds since some fixed but 10877 arbitrary time (perhaps in the future, so values may be 10878 negative). This function provides nanosecond precision, but not 10879 necessarily nanosecond accuracy. No guarantees are made about 10880 how frequently values change. 10881 <p/> 10882 Get information about this timer with 10883 <functionlink id="GetTimerInfo"/>. 10884 </description> 10885 <origin>new</origin> 10886 <capabilities> 10887 </capabilities> 10888 <parameters> 10889 <param id="nanos_ptr"> 10890 <outptr><jlong/></outptr> 10891 <description> 10892 On return, points to the time in nanoseconds. 10893 This is an unsigned value. If tested or printed as a jlong (signed value) 10894 it may appear to be a negative number. 10895 </description> 10896 </param> 10897 </parameters> 10898 <errors> 10899 </errors> 10900 </function> 10901 10902 <function id="GetAvailableProcessors" phase="any" num="144"> 10903 <synopsis>Get Available Processors</synopsis> 10904 <description> 10905 Returns the number of processors available to the Java virtual machine. 10906 <p/> 10907 This value may change during a particular invocation of the virtual machine. 10908 Applications that are sensitive to the number of available processors should 10909 therefore occasionally poll this property. 10910 </description> 10911 <origin>new</origin> 10912 <capabilities> 10913 </capabilities> 10914 <parameters> 10915 <param id="processor_count_ptr"> 10916 <outptr><jint/></outptr> 10917 <description> 10918 On return, points to the maximum number of processors available to the 10919 virtual machine; never smaller than one. 10920 </description> 10921 </param> 10922 </parameters> 10923 <errors> 10924 </errors> 10925 </function> 10926 10927 </category> 10928 10929 10930 <category id="classLoaderSearch" label="Class Loader Search"> 10931 10932 <intro> 10933 These functions allow the agent to add to the locations that a class loader searches for a class. 10934 This is useful for installing instrumentation under the correct class loader. 10935 </intro> 10936 10937 <function id="AddToBootstrapClassLoaderSearch" jkernel="yes" phase="onload" num="149"> 10938 <synopsis>Add To Bootstrap Class Loader Search</synopsis> 10939 <description> 10940 This function can be used to cause instrumentation classes to be defined by the 10941 bootstrap class loader. See <vmspec chapter="5.3.1"/>. 10942 After the bootstrap 10943 class loader unsuccessfully searches for a class, the specified platform-dependent 10944 search path <paramlink id="segment"/> will be searched as well. Only one segment may be specified in 10945 the <paramlink id="segment"/>. This function may be called multiple times to add multiple segments, 10946 the segments will be searched in the order that this function was called. 10947 <p/> 10948 In the <code>OnLoad</code> phase the function may be used to specify any platform-dependent 10949 search path segment to be searched after the bootstrap class loader unsuccessfully searches 10950 for a class. The segment is typically a directory or JAR file. 10951 <p/> 10952 In the live phase the <paramlink id="segment"/> may be used to specify any platform-dependent 10953 path to a <externallink id="jar/jar.html"> 10954 JAR file</externallink>. The agent should take care that the JAR file does not 10955 contain any classes or resources other than those to be defined by the bootstrap 10956 class loader for the purposes of instrumentation. 10957 <p/> 10958 <vmspec/> specifies that a subsequent attempt to resolve a symbolic 10959 reference that the Java virtual machine has previously unsuccessfully attempted 10960 to resolve always fails with the same error that was thrown as a result of the 10961 initial resolution attempt. Consequently, if the JAR file contains an entry 10962 that corresponds to a class for which the Java virtual machine has 10963 unsuccessfully attempted to resolve a reference, then subsequent attempts to 10964 resolve that reference will fail with the same error as the initial attempt. 10965 </description> 10966 <origin>new</origin> 10967 <capabilities> 10968 </capabilities> 10969 <parameters> 10970 <param id="segment"> 10971 <inbuf><char/></inbuf> 10972 <description> 10973 The platform-dependent search path segment, encoded as a 10974 <internallink id="mUTF">modified UTF-8</internallink> string. 10975 </description> 10976 </param> 10977 </parameters> 10978 <errors> 10979 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 10980 <paramlink id="segment"/> is an invalid path. In the live phase, anything other than an 10981 existing JAR file is an invalid path. 10982 </error> 10983 </errors> 10984 </function> 10985 10986 <function id="AddToSystemClassLoaderSearch" jkernel="yes" phase="onload" num="151" since="1.1"> 10987 <synopsis>Add To System Class Loader Search</synopsis> 10988 <description> 10989 This function can be used to cause instrumentation classes to be 10990 defined by the system class loader. See <vmspec chapter="5.3.2"/>. 10991 After the class loader unsuccessfully searches for a class, the specified platform-dependent search 10992 path <paramlink id="segment"/> will be searched as well. Only one segment may be specified in the 10993 <paramlink id="segment"/>. This function may be called multiple times to add multiple segments, the 10994 segments will be searched in the order that this function was called. 10995 <p/> 10996 In the <code>OnLoad</code> phase the function may be used to specify any platform-dependent 10997 search path segment to be searched after the system class loader unsuccessfully searches 10998 for a class. The segment is typically a directory or JAR file. 10999 <p/> 11000 In the live phase the <paramlink id="segment"/> is a platform-dependent path to a 11001 <externallink id="jar/jar.html">JAR file</externallink> to be 11002 searched after the system class loader unsuccessfully searches for a class. The agent should 11003 take care that the JAR file does not contain any classes or resources other than those to be 11004 defined by the system class loader for the purposes of instrumentation. 11005 <p/> 11006 In the live phase the system class loader supports adding a JAR file to be searched if 11007 the system class loader implements a method name <code>appendToClassPathForInstrumentation</code> 11008 which takes a single parameter of type <code>java.lang.String</code>. The method is not required 11009 to have <code>public</code> access. 11010 <p/> 11011 <vmspec/> specifies that a subsequent attempt to resolve a symbolic 11012 reference that the Java virtual machine has previously unsuccessfully attempted 11013 to resolve always fails with the same error that was thrown as a result of the 11014 initial resolution attempt. Consequently, if the JAR file contains an entry 11015 that corresponds to a class for which the Java virtual machine has 11016 unsuccessfully attempted to resolve a reference, then subsequent attempts to 11017 resolve that reference will fail with the same error as the initial attempt. 11018 </description> 11019 <origin>new</origin> 11020 <capabilities> 11021 </capabilities> 11022 <parameters> 11023 <param id="segment"> 11024 <inbuf><char/></inbuf> 11025 <description> 11026 The platform-dependent search path segment, encoded as a 11027 <internallink id="mUTF">modified UTF-8</internallink> string. 11028 </description> 11029 </param> 11030 </parameters> 11031 <errors> 11032 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 11033 <paramlink id="segment"/> is an invalid path. In the live phase, anything other than an 11034 existing JAR file is an invalid path. 11035 </error> 11036 <error id="JVMTI_ERROR_CLASS_LOADER_UNSUPPORTED"> 11037 Operation not supported by the system class loader. 11038 </error> 11039 </errors> 11040 </function> 11041 11042 </category> 11043 11044 11045 <category id="props" label="System Properties"> 11046 11047 <intro> 11048 These functions get and set system properties. 11049 </intro> 11050 11051 <function id="GetSystemProperties" phase="onload" num="130"> 11052 <synopsis>Get System Properties</synopsis> 11053 <description> 11054 The list of VM system property keys which may be used with 11055 <functionlink id="GetSystemProperty"/> is returned. 11056 It is strongly recommended that virtual machines provide the 11057 following property keys: 11058 <ul> 11059 <li><code>java.vm.vendor</code></li> 11060 <li><code>java.vm.version</code></li> 11061 <li><code>java.vm.name</code></li> 11062 <li><code>java.vm.info</code></li> 11063 <li><code>java.library.path</code></li> 11064 <li><code>java.class.path</code></li> 11065 </ul> 11066 Provides access to system properties defined by and used 11067 by the VM. 11068 Properties set on the command-line are included. 11069 This allows getting and setting of these properties 11070 before the VM even begins executing bytecodes. 11071 Since this is a VM view of system properties, the set of available 11072 properties will usually be different than that 11073 in <code>java.lang.System.getProperties</code>. 11074 JNI method invocation may be used to access 11075 <code>java.lang.System.getProperties</code>. 11076 <p/> 11077 The set of properties may grow during execution. 11078 </description> 11079 <origin>new</origin> 11080 <capabilities> 11081 </capabilities> 11082 <parameters> 11083 <param id="count_ptr"> 11084 <outptr><jint/></outptr> 11085 <description> 11086 On return, points to the number of property keys returned. 11087 </description> 11088 </param> 11089 <param id="property_ptr"> 11090 <allocallocbuf outcount="count_ptr"><char/></allocallocbuf> 11091 <description> 11092 On return, points to an array of property keys, encoded as 11093 <internallink id="mUTF">modified UTF-8</internallink> strings. 11094 </description> 11095 </param> 11096 </parameters> 11097 <errors> 11098 </errors> 11099 </function> 11100 11101 <function id="GetSystemProperty" phase="onload" num="131"> 11102 <synopsis>Get System Property</synopsis> 11103 <description> 11104 Return a VM system property value given the property key. 11105 <p/> 11106 The function <functionlink id="GetSystemProperties"/> 11107 returns the set of property keys which may be used. 11108 The properties which can be retrieved may grow during 11109 execution. 11110 <p/> 11111 Since this is a VM view of system properties, the values 11112 of properties may differ from that returned by 11113 <code>java.lang.System.getProperty(String)</code>. 11114 A typical VM might copy the values of the VM system 11115 properties into the <code>Properties</code> held by 11116 <code>java.lang.System</code> during the initialization 11117 of that class. Thereafter any changes to the VM system 11118 properties (with <functionlink id="SetSystemProperty"/>) 11119 or the <code>java.lang.System</code> system properties 11120 (with <code>java.lang.System.setProperty(String,String)</code>) 11121 would cause the values to diverge. 11122 JNI method invocation may be used to access 11123 <code>java.lang.System.getProperty(String)</code>. 11124 </description> 11125 <origin>new</origin> 11126 <capabilities> 11127 </capabilities> 11128 <parameters> 11129 <param id="property"> 11130 <inbuf><char/></inbuf> 11131 <description> 11132 The key of the property to retrieve, encoded as a 11133 <internallink id="mUTF">modified UTF-8</internallink> string. 11134 </description> 11135 </param> 11136 <param id="value_ptr"> 11137 <allocbuf><char/></allocbuf> 11138 <description> 11139 On return, points to the property value, encoded as a 11140 <internallink id="mUTF">modified UTF-8</internallink> string. 11141 </description> 11142 </param> 11143 </parameters> 11144 <errors> 11145 <error id="JVMTI_ERROR_NOT_AVAILABLE"> 11146 This property is not available. 11147 Use <functionlink id="GetSystemProperties"/> to find available properties. 11148 </error> 11149 </errors> 11150 </function> 11151 11152 <function id="SetSystemProperty" phase="onloadOnly" num="132"> 11153 <synopsis>Set System Property</synopsis> 11154 <description> 11155 Set a VM system property value. 11156 <p/> 11157 The function <functionlink id="GetSystemProperties"/> 11158 returns the set of property keys, some of these may be settable. 11159 See <functionlink id="GetSystemProperty"/>. 11160 </description> 11161 <origin>new</origin> 11162 <capabilities> 11163 </capabilities> 11164 <parameters> 11165 <param id="property"> 11166 <inbuf><char/></inbuf> 11167 <description> 11168 The key of the property, encoded as a 11169 <internallink id="mUTF">modified UTF-8</internallink> string. 11170 </description> 11171 </param> 11172 <param id="value_ptr"> 11173 <inbuf> 11174 <char/> 11175 <nullok> 11176 do not set the value, but return <errorlink id="JVMTI_ERROR_NOT_AVAILABLE"/> 11177 if the property is not writeable 11178 </nullok> 11179 </inbuf> 11180 <description> 11181 The property value to set, encoded as a 11182 <internallink id="mUTF">modified UTF-8</internallink> string. 11183 </description> 11184 </param> 11185 </parameters> 11186 <errors> 11187 <error id="JVMTI_ERROR_NOT_AVAILABLE"> 11188 This property is not available or is not writeable. 11189 </error> 11190 </errors> 11191 </function> 11192 11193 </category> 11194 11195 <category id="general" label="General"> 11196 11197 <intro> 11198 </intro> 11199 11200 <function id="GetPhase" jkernel="yes" phase="any" num="133"> 11201 <synopsis>Get Phase</synopsis> 11202 <description> 11203 Return the current phase of VM execution. 11204 The phases proceed in sequence: 11205 <constants id="jvmtiPhase" label="Phases of execution" kind="enum"> 11206 <constant id="JVMTI_PHASE_ONLOAD" num="1"> 11207 <code>OnLoad</code> phase: while in the 11208 <internallink id="onload"><code>Agent_OnLoad</code></internallink> 11209 or, for statically linked agents, the <internallink id="onload"> 11210 <code>Agent_OnLoad_<agent-lib-name> 11211 </code></internallink> function. 11212 </constant> 11213 <constant id="JVMTI_PHASE_PRIMORDIAL" num="2"> 11214 Primordial phase: between return from <code>Agent_OnLoad</code> 11215 or <code>Agent_OnLoad_<agent-lib-name></code> and the 11216 <code>VMStart</code> event. 11217 </constant> 11218 <constant id="JVMTI_PHASE_START" num="6"> 11219 Start phase: when the <eventlink id="VMStart"><code>VMStart</code></eventlink> event 11220 is sent and until the <code>VMInit</code> event is sent. 11221 </constant> 11222 <constant id="JVMTI_PHASE_LIVE" num="4"> 11223 Live phase: when the <eventlink id="VMInit"><code>VMInit</code></eventlink> event is sent 11224 and until the <eventlink id="VMDeath"></eventlink> event returns. 11225 </constant> 11226 <constant id="JVMTI_PHASE_DEAD" num="8"> 11227 Dead phase: after the <eventlink id="VMDeath"></eventlink> event returns or after 11228 start-up failure. 11229 </constant> 11230 </constants> 11231 In the case of start-up failure the VM will proceed directly to the dead 11232 phase skipping intermediate phases and neither a <code>VMInit</code> nor 11233 <code>VMDeath</code> event will be sent. 11234 <p/> 11235 Most <jvmti/> functions operate only in the live phase. 11236 The following functions operate in either the <code>OnLoad</code> or live phases: 11237 <functionphaselist phase="onload"/> 11238 The following functions operate in only the <code>OnLoad</code> phase: 11239 <functionphaselist phase="onloadOnly"/> 11240 The following functions operate in the start or live phases: 11241 <functionphaselist phase="start"/> 11242 The following functions operate in any phase: 11243 <functionphaselist phase="any"/> 11244 JNI functions (except the Invocation API) must only be used in the start or live phases. 11245 <p/> 11246 Most <jvmti/> events are sent only in the live phase. 11247 The following events operate in others phases: 11248 <eventphaselist phase="start"/> 11249 <eventphaselist phase="any"/> 11250 </description> 11251 <origin>new</origin> 11252 <capabilities> 11253 </capabilities> 11254 <parameters> 11255 <param id="phase_ptr"> 11256 <outptr><enum>jvmtiPhase</enum></outptr> 11257 <description> 11258 On return, points to the phase. 11259 </description> 11260 </param> 11261 </parameters> 11262 <errors> 11263 </errors> 11264 </function> 11265 11266 <function id="DisposeEnvironment" jkernel="yes" phase="any" num="127"> 11267 <synopsis>Dispose Environment</synopsis> 11268 <description> 11269 Shutdown a <jvmti/> connection created with JNI <code>GetEnv</code> 11270 (see <internallink id="environments"><jvmti/> Environments</internallink>). 11271 Dispose of any resources held by the environment. 11272 <issue> 11273 What resources are reclaimed? What is undone? 11274 Breakpoints,watchpoints removed? 11275 </issue> 11276 Threads suspended by this environment are not resumed by this call, 11277 this must be done explicitly by the agent. 11278 Memory allocated by this environment via calls to <jvmti/> functions 11279 is not released, this can be done explicitly by the agent 11280 by calling <functionlink id="Deallocate"/>. 11281 Raw monitors created by this environment are not destroyed, 11282 this can be done explicitly by the agent 11283 by calling <functionlink id="DestroyRawMonitor"/>. 11284 The state of threads waiting on raw monitors created by this environment 11285 are not affected. 11286 <p/> 11287 Any <functionlink id="SetNativeMethodPrefix">native method 11288 prefixes</functionlink> for this environment will be unset; 11289 the agent must remove any prefixed native methods before 11290 dispose is called. 11291 <p/> 11292 Any <internallink id="capability">capabilities</internallink> 11293 held by this environment are relinquished. 11294 <p/> 11295 Events enabled by this environment will no longer be sent, however 11296 event handlers currently running will continue to run. Caution must 11297 be exercised in the design of event handlers whose environment may 11298 be disposed and thus become invalid during their execution. 11299 <p/> 11300 This environment may not be used after this call. 11301 This call returns to the caller. 11302 </description> 11303 <origin>new</origin> 11304 <capabilities> 11305 </capabilities> 11306 <parameters> 11307 </parameters> 11308 <errors> 11309 </errors> 11310 </function> 11311 11312 <function id="SetEnvironmentLocalStorage" jkernel="yes" phase="any" callbacksafe="safe" impl="innative notrace" num="148"> 11313 <synopsis>Set Environment Local Storage</synopsis> 11314 <description> 11315 The VM stores a pointer value associated with each environment. 11316 This pointer value is called <i>environment-local storage</i>. 11317 This value is <code>NULL</code> unless set with this function. 11318 Agents can allocate memory in which they store environment specific 11319 information. By setting environment-local storage it can then be 11320 accessed with 11321 <functionlink id="GetEnvironmentLocalStorage"></functionlink>. 11322 <p/> 11323 Called by the agent to set the value of the <jvmti/> 11324 environment-local storage. <jvmti/> supplies to the agent a pointer-size 11325 environment-local storage that can be used to record per-environment 11326 information. 11327 </description> 11328 <origin>new</origin> 11329 <capabilities> 11330 </capabilities> 11331 <parameters> 11332 <param id="data"> 11333 <inbuf> 11334 <void/> 11335 <nullok>value is set to <code>NULL</code></nullok> 11336 </inbuf> 11337 <description> 11338 The value to be entered into the environment-local storage. 11339 </description> 11340 </param> 11341 </parameters> 11342 <errors> 11343 </errors> 11344 </function> 11345 11346 <function id="GetEnvironmentLocalStorage" jkernel="yes" phase="any" callbacksafe="safe" impl="innative notrace" num="147"> 11347 <synopsis>Get Environment Local Storage</synopsis> 11348 <description> 11349 Called by the agent to get the value of the <jvmti/> environment-local 11350 storage. 11351 </description> 11352 <origin>new</origin> 11353 <capabilities> 11354 </capabilities> 11355 <parameters> 11356 <param id="data_ptr"> 11357 <agentbuf><void/></agentbuf> 11358 <description> 11359 Pointer through which the value of the environment local 11360 storage is returned. 11361 If environment-local storage has not been set with 11362 <functionlink id="SetEnvironmentLocalStorage"></functionlink> returned 11363 pointer is <code>NULL</code>. 11364 </description> 11365 </param> 11366 </parameters> 11367 <errors> 11368 </errors> 11369 </function> 11370 11371 <function id="GetVersionNumber" jkernel="yes" phase="any" num="88"> 11372 <synopsis>Get Version Number</synopsis> 11373 <description> 11374 Return the <jvmti/> version via <code>version_ptr</code>. 11375 The return value is the version identifier. 11376 The version identifier includes major, minor and micro 11377 version as well as the interface type. 11378 <constants id="jvmtiVersionInterfaceTypes" label="Version Interface Types" kind="bits"> 11379 <constant id="JVMTI_VERSION_INTERFACE_JNI" num="0x00000000"> 11380 Value of <code>JVMTI_VERSION_MASK_INTERFACE_TYPE</code> for JNI. 11381 </constant> 11382 <constant id="JVMTI_VERSION_INTERFACE_JVMTI" num="0x30000000"> 11383 Value of <code>JVMTI_VERSION_MASK_INTERFACE_TYPE</code> for <jvmti/>. 11384 </constant> 11385 </constants> 11386 <constants id="jvmtiVersionMasks" label="Version Masks" kind="bits"> 11387 <constant id="JVMTI_VERSION_MASK_INTERFACE_TYPE" num="0x70000000"> 11388 Mask to extract interface type. 11389 The value of the version returned by this function masked with 11390 <code>JVMTI_VERSION_MASK_INTERFACE_TYPE</code> is always 11391 <code>JVMTI_VERSION_INTERFACE_JVMTI</code> 11392 since this is a <jvmti/> function. 11393 </constant> 11394 <constant id="JVMTI_VERSION_MASK_MAJOR" num="0x0FFF0000"> 11395 Mask to extract major version number. 11396 </constant> 11397 <constant id="JVMTI_VERSION_MASK_MINOR" num="0x0000FF00"> 11398 Mask to extract minor version number. 11399 </constant> 11400 <constant id="JVMTI_VERSION_MASK_MICRO" num="0x000000FF"> 11401 Mask to extract micro version number. 11402 </constant> 11403 </constants> 11404 <constants id="jvmtiVersionShifts" label="Version Shifts" kind="bits"> 11405 <constant id="JVMTI_VERSION_SHIFT_MAJOR" num="16"> 11406 Shift to extract major version number. 11407 </constant> 11408 <constant id="JVMTI_VERSION_SHIFT_MINOR" num="8"> 11409 Shift to extract minor version number. 11410 </constant> 11411 <constant id="JVMTI_VERSION_SHIFT_MICRO" num="0"> 11412 Shift to extract micro version number. 11413 </constant> 11414 </constants> 11415 </description> 11416 <origin>jvmdi</origin> 11417 <capabilities> 11418 </capabilities> 11419 <parameters> 11420 <param id="version_ptr"> 11421 <outptr><jint/></outptr> 11422 <description> 11423 On return, points to the <jvmti/> version. 11424 </description> 11425 </param> 11426 </parameters> 11427 <errors> 11428 </errors> 11429 </function> 11430 11431 11432 <function id="GetErrorName" phase="any" num="128"> 11433 <synopsis>Get Error Name</synopsis> 11434 <description> 11435 Return the symbolic name for an 11436 <internallink id="ErrorSection">error code</internallink>. 11437 <p/> 11438 For example 11439 <code>GetErrorName(env, JVMTI_ERROR_NONE, &err_name)</code> 11440 would return in <code>err_name</code> the string 11441 <code>"JVMTI_ERROR_NONE"</code>. 11442 </description> 11443 <origin>new</origin> 11444 <capabilities> 11445 </capabilities> 11446 <parameters> 11447 <param id="error"> 11448 <enum>jvmtiError</enum> 11449 <description> 11450 The error code. 11451 </description> 11452 </param> 11453 <param id="name_ptr"> 11454 <allocbuf><char/></allocbuf> 11455 <description> 11456 On return, points to the error name. 11457 The name is encoded as a 11458 <internallink id="mUTF">modified UTF-8</internallink> string, 11459 but is restricted to the ASCII subset. 11460 </description> 11461 </param> 11462 </parameters> 11463 <errors> 11464 </errors> 11465 </function> 11466 11467 <function id="SetVerboseFlag" phase="any" num="150"> 11468 <synopsis>Set Verbose Flag</synopsis> 11469 <description> 11470 <constants id="jvmtiVerboseFlag" label="Verbose Flag Enumeration" kind="enum"> 11471 <constant id="JVMTI_VERBOSE_OTHER" num="0"> 11472 Verbose output other than the below. 11473 </constant> 11474 <constant id="JVMTI_VERBOSE_GC" num="1"> 11475 Verbose garbage collector output, like that specified with <code>-verbose:gc</code>. 11476 </constant> 11477 <constant id="JVMTI_VERBOSE_CLASS" num="2"> 11478 Verbose class loading output, like that specified with <code>-verbose:class</code>. 11479 </constant> 11480 <constant id="JVMTI_VERBOSE_JNI" num="4"> 11481 Verbose JNI output, like that specified with <code>-verbose:jni</code>. 11482 </constant> 11483 </constants> 11484 Control verbose output. 11485 This is the output which typically is sent to <code>stderr</code>. 11486 </description> 11487 <origin>new</origin> 11488 <capabilities> 11489 </capabilities> 11490 <parameters> 11491 <param id="flag"> 11492 <enum>jvmtiVerboseFlag</enum> 11493 <description> 11494 Which verbose flag to set. 11495 </description> 11496 </param> 11497 <param id="value"> 11498 <jboolean/> 11499 <description> 11500 New value of the flag. 11501 </description> 11502 </param> 11503 </parameters> 11504 <errors> 11505 </errors> 11506 </function> 11507 11508 11509 <function id="GetJLocationFormat" phase="any" num="129"> 11510 <synopsis>Get JLocation Format</synopsis> 11511 <description> 11512 Although the greatest functionality is achieved with location information 11513 referencing the virtual machine bytecode index, the definition of 11514 <code>jlocation</code> has intentionally been left unconstrained to allow VM 11515 implementations that do not have this information. 11516 <p/> 11517 This function describes the representation of <code>jlocation</code> used in this VM. 11518 If the returned format is <datalink id="JVMTI_JLOCATION_JVMBCI"></datalink>, 11519 <code>jlocation</code>s can 11520 be used as in indices into the array returned by 11521 <functionlink id="GetBytecodes"></functionlink>. 11522 <constants id="jvmtiJlocationFormat" label="JLocation Format Enumeration" kind="enum"> 11523 <constant id="JVMTI_JLOCATION_JVMBCI" num="1"> 11524 <code>jlocation</code> values represent virtual machine 11525 bytecode indices--that is, offsets into the 11526 virtual machine code for a method. 11527 </constant> 11528 <constant id="JVMTI_JLOCATION_MACHINEPC" num="2"> 11529 <code>jlocation</code> values represent native machine 11530 program counter values. 11531 </constant> 11532 <constant id="JVMTI_JLOCATION_OTHER" num="0"> 11533 <code>jlocation</code> values have some other representation. 11534 </constant> 11535 </constants> 11536 </description> 11537 <origin>new</origin> 11538 <capabilities> 11539 </capabilities> 11540 <parameters> 11541 <param id="format_ptr"> 11542 <outptr><enum>jvmtiJlocationFormat</enum></outptr> 11543 <description> 11544 On return, points to the format identifier for <code>jlocation</code> values. 11545 </description> 11546 </param> 11547 </parameters> 11548 <errors> 11549 </errors> 11550 </function> 11551 11552 </category> 11553 11554 <category id="heap_monitoring" label="Heap Monitoring"> 11555 <function id="SetHeapSamplingInterval" phase="onload" num="156" since="11"> 11556 <synopsis>Set Heap Sampling Interval</synopsis> 11557 <description> 11558 Generate a <eventlink id="SampledObjectAlloc"/> event when objects are allocated. 11559 Each thread keeps a counter of bytes allocated. The event will only be generated 11560 when that counter exceeds an average of <paramlink id="sampling_interval"></paramlink> 11561 since the last sample. 11562 <p/> 11563 Setting <paramlink id="sampling_interval"></paramlink> to 0 will cause an event to be 11564 generated by each allocation supported by the system once the new interval is taken into account. 11565 <p/> 11566 Note that updating the new sampling interval might take various number of allocations 11567 to provoke internal data structure updates. Therefore it is important to 11568 consider the sampling interval as an average. This includes the interval 0, where events 11569 might not be generated straight away for each allocation. 11570 </description> 11571 <origin>new</origin> 11572 <capabilities> 11573 <required id="can_generate_sampled_object_alloc_events"></required> 11574 </capabilities> 11575 <parameters> 11576 <param id="sampling_interval"> 11577 <jint/> 11578 <description> 11579 The sampling interval in bytes. The sampler uses a statistical approach to 11580 generate an event, on average, once for every <paramlink id="sampling_interval"/> bytes of 11581 memory allocated by a given thread. 11582 <p/> 11583 Once the new sampling interval is taken into account, 0 as a sampling interval will generate 11584 a sample for every allocation. 11585 <p/> 11586 Note: The overhead of this feature is directly correlated with the sampling interval. 11587 A high sampling interval, such as 1024 bytes, will incur a high overhead. 11588 A lower interval, such as 1024KB, will have a much lower overhead. Sampling should only 11589 be used with an understanding that it may impact performance. 11590 </description> 11591 </param> 11592 </parameters> 11593 <errors> 11594 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 11595 <paramlink id="sampling_interval"></paramlink> is less than zero. 11596 </error> 11597 </errors> 11598 </function> 11599 </category> 11600 11601</functionsection> 11602 11603<errorsection label="Error Reference"> 11604 <intro> 11605 Every <jvmti/> function returns a <b><code>jvmtiError</code></b> error code. 11606 <p/> 11607 It is the responsibility of the agent to call <jvmti/> functions with 11608 valid parameters and in the proper context (calling thread is attached, 11609 phase is correct, etc.). 11610 Detecting some error conditions may be difficult, inefficient, or 11611 impossible for an implementation. 11612 The errors listed in 11613 <internallink id="reqerrors">Function Specific Required Errors</internallink> 11614 must be detected by the implementation. 11615 All other errors represent the recommended response to the error 11616 condition. 11617 </intro> 11618 11619 <errorcategory id="universal-error" label="Universal Errors"> 11620 <intro> 11621 The following errors may be returned by any function 11622 </intro> 11623 11624 <errorid id="JVMTI_ERROR_NONE" num="0"> 11625 No error has occurred. This is the error code that is returned 11626 on successful completion of the function. 11627 </errorid> 11628 <errorid id="JVMTI_ERROR_NULL_POINTER" num="100"> 11629 Pointer is unexpectedly <code>NULL</code>. 11630 </errorid> 11631 <errorid id="JVMTI_ERROR_OUT_OF_MEMORY" num="110"> 11632 The function attempted to allocate memory and no more memory was 11633 available for allocation. 11634 </errorid> 11635 <errorid id="JVMTI_ERROR_ACCESS_DENIED" num="111"> 11636 The desired functionality has not been enabled in this virtual machine. 11637 </errorid> 11638 <errorid id="JVMTI_ERROR_UNATTACHED_THREAD" num="115"> 11639 The thread being used to call this function is not attached 11640 to the virtual machine. Calls must be made from attached threads. 11641 See <code>AttachCurrentThread</code> in the JNI invocation API. 11642 </errorid> 11643 <errorid id="JVMTI_ERROR_INVALID_ENVIRONMENT" num="116"> 11644 The <jvmti/> environment provided is no longer connected or is 11645 not an environment. 11646 </errorid> 11647 <errorid id="JVMTI_ERROR_WRONG_PHASE" num="112"> 11648 The desired functionality is not available in the current 11649 <functionlink id="GetPhase">phase</functionlink>. 11650 Always returned if the virtual machine has completed running. 11651 </errorid> 11652 <errorid id="JVMTI_ERROR_INTERNAL" num="113"> 11653 An unexpected internal error has occurred. 11654 </errorid> 11655 </errorcategory> 11656 11657 <errorcategory id="reqerrors" label="Function Specific Required Errors"> 11658 <intro> 11659 The following errors are returned by some <jvmti/> functions and must 11660 be returned by the implementation when the condition occurs. 11661 </intro> 11662 11663 <errorid id="JVMTI_ERROR_INVALID_PRIORITY" num="12"> 11664 Invalid priority. 11665 </errorid> 11666 <errorid id="JVMTI_ERROR_THREAD_NOT_SUSPENDED" num="13"> 11667 Thread was not suspended. 11668 </errorid> 11669 <errorid id="JVMTI_ERROR_THREAD_SUSPENDED" num="14"> 11670 Thread already suspended. 11671 </errorid> 11672 <errorid id="JVMTI_ERROR_THREAD_NOT_ALIVE" num="15"> 11673 This operation requires the thread to be alive--that is, 11674 it must be started and not yet have died. 11675 </errorid> 11676 <errorid id="JVMTI_ERROR_CLASS_NOT_PREPARED" num="22"> 11677 The class has been loaded but not yet prepared. 11678 </errorid> 11679 <errorid id="JVMTI_ERROR_NO_MORE_FRAMES" num="31"> 11680 There are no Java programming language or JNI stack frames at the specified depth. 11681 </errorid> 11682 <errorid id="JVMTI_ERROR_OPAQUE_FRAME" num="32"> 11683 Information about the frame is not available (e.g. for native frames). 11684 </errorid> 11685 <errorid id="JVMTI_ERROR_DUPLICATE" num="40"> 11686 Item already set. 11687 </errorid> 11688 <errorid id="JVMTI_ERROR_NOT_FOUND" num="41"> 11689 Desired element (e.g. field or breakpoint) not found 11690 </errorid> 11691 <errorid id="JVMTI_ERROR_NOT_MONITOR_OWNER" num="51"> 11692 This thread doesn't own the raw monitor. 11693 </errorid> 11694 <errorid id="JVMTI_ERROR_INTERRUPT" num="52"> 11695 The call has been interrupted before completion. 11696 </errorid> 11697 <errorid id="JVMTI_ERROR_UNMODIFIABLE_CLASS" num="79"> 11698 The class cannot be modified. 11699 </errorid> 11700 <errorid id="JVMTI_ERROR_UNMODIFIABLE_MODULE" num="80"> 11701 The module cannot be modified. 11702 </errorid> 11703 <errorid id="JVMTI_ERROR_NOT_AVAILABLE" num="98"> 11704 The functionality is not available in this virtual machine. 11705 </errorid> 11706 <errorid id="JVMTI_ERROR_ABSENT_INFORMATION" num="101"> 11707 The requested information is not available. 11708 </errorid> 11709 <errorid id="JVMTI_ERROR_INVALID_EVENT_TYPE" num="102"> 11710 The specified event type ID is not recognized. 11711 </errorid> 11712 <errorid id="JVMTI_ERROR_NATIVE_METHOD" num="104"> 11713 The requested information is not available for native method. 11714 </errorid> 11715 <errorid id="JVMTI_ERROR_CLASS_LOADER_UNSUPPORTED" num="106"> 11716 The class loader does not support this operation. 11717 </errorid> 11718 </errorcategory> 11719 11720 <errorcategory id="function-specific-errors" label="Function Specific Agent Errors"> 11721 <intro> 11722 The following errors are returned by some <jvmti/> functions. 11723 They are returned in the event of invalid parameters passed by the 11724 agent or usage in an invalid context. 11725 An implementation is not required to detect these errors. 11726 </intro> 11727 11728 <errorid id="JVMTI_ERROR_INVALID_THREAD" num="10"> 11729 The passed thread is not a valid thread. 11730 </errorid> 11731 <errorid id="JVMTI_ERROR_INVALID_FIELDID" num="25"> 11732 Invalid field. 11733 </errorid> 11734 <errorid id="JVMTI_ERROR_INVALID_MODULE" num="26"> 11735 Invalid module. 11736 </errorid> 11737 <errorid id="JVMTI_ERROR_INVALID_METHODID" num="23"> 11738 Invalid method. 11739 </errorid> 11740 <errorid id="JVMTI_ERROR_INVALID_LOCATION" num="24"> 11741 Invalid location. 11742 </errorid> 11743 <errorid id="JVMTI_ERROR_INVALID_OBJECT" num="20"> 11744 Invalid object. 11745 </errorid> 11746 <errorid id="JVMTI_ERROR_INVALID_CLASS" num="21"> 11747 Invalid class. 11748 </errorid> 11749 <errorid id="JVMTI_ERROR_TYPE_MISMATCH" num="34"> 11750 The variable is not an appropriate type for the function used. 11751 </errorid> 11752 <errorid id="JVMTI_ERROR_INVALID_SLOT" num="35"> 11753 Invalid slot. 11754 </errorid> 11755 <errorid id="JVMTI_ERROR_MUST_POSSESS_CAPABILITY" num="99"> 11756 The capability being used is false in this environment. 11757 </errorid> 11758 <errorid id="JVMTI_ERROR_INVALID_THREAD_GROUP" num="11"> 11759 Thread group invalid. 11760 </errorid> 11761 <errorid id="JVMTI_ERROR_INVALID_MONITOR" num="50"> 11762 Invalid raw monitor. 11763 </errorid> 11764 <errorid id="JVMTI_ERROR_ILLEGAL_ARGUMENT" num="103"> 11765 Illegal argument. 11766 </errorid> 11767 <errorid id="JVMTI_ERROR_INVALID_TYPESTATE" num="65"> 11768 The state of the thread has been modified, and is now inconsistent. 11769 </errorid> 11770 <errorid id="JVMTI_ERROR_UNSUPPORTED_VERSION" num="68"> 11771 A new class file has a version number not supported by this VM. 11772 </errorid> 11773 <errorid id="JVMTI_ERROR_INVALID_CLASS_FORMAT" num="60"> 11774 A new class file is malformed (the VM would return a <code>ClassFormatError</code>). 11775 </errorid> 11776 <errorid id="JVMTI_ERROR_CIRCULAR_CLASS_DEFINITION" num="61"> 11777 The new class file definitions would lead to a circular 11778 definition (the VM would return a <code>ClassCircularityError</code>). 11779 </errorid> 11780 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_ADDED" num="63"> 11781 A new class file would require adding a method. 11782 </errorid> 11783 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED" num="64"> 11784 A new class version changes a field. 11785 </errorid> 11786 <errorid id="JVMTI_ERROR_FAILS_VERIFICATION" num="62"> 11787 The class bytes fail verification. 11788 </errorid> 11789 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED" num="66"> 11790 A direct superclass is different for the new class 11791 version, or the set of directly implemented 11792 interfaces is different. 11793 </errorid> 11794 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_DELETED" num="67"> 11795 A new class version does not declare a method 11796 declared in the old class version. 11797 </errorid> 11798 <errorid id="JVMTI_ERROR_NAMES_DONT_MATCH" num="69"> 11799 The class name defined in the new class file is 11800 different from the name in the old class object. 11801 </errorid> 11802 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED" num="70"> 11803 A new class version has different modifiers. 11804 </errorid> 11805 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED" num="71"> 11806 A method in the new class version has different modifiers 11807 than its counterpart in the old class version. 11808 </errorid> 11809 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_ATTRIBUTE_CHANGED" num="72"> 11810 A new class version has unsupported differences in class attributes. 11811 </errorid> 11812 </errorcategory> 11813</errorsection> 11814 11815<eventsection label="Events"> 11816 <intro label="Handling Events" id="eventIntro"> 11817 Agents can be informed of many events that occur in application 11818 programs. 11819 <p/> 11820 To handle events, designate a set of callback functions with 11821 <functionlink id="SetEventCallbacks"></functionlink>. 11822 For each event the corresponding callback function will be 11823 called. 11824 Arguments to the callback function provide additional 11825 information about the event. 11826 <p/> 11827 The callback function is usually called from within an application 11828 thread. The <jvmti/> implementation does not 11829 queue events in any way. This means 11830 that event callback functions must be written 11831 carefully. Here are some general guidelines. See 11832 the individual event descriptions for further 11833 suggestions. 11834 <p/> 11835 <ul> 11836 <li>Any exception thrown during the execution of an event callback can 11837 overwrite any current pending exception in the current application thread. 11838 Care must be taken to preserve a pending exception 11839 when an event callback makes a JNI call that might generate an exception. 11840 </li> 11841 <li>Event callback functions must be re-entrant. The <jvmti/> implementation does 11842 not queue events. If an agent needs to process events one at a time, it 11843 can use a raw monitor inside the 11844 event callback functions to serialize event processing. 11845 </li> 11846 <li>Event callback functions that execute JNI's FindClass function to load 11847 classes need to note that FindClass locates the class loader associated 11848 with the current native method. For the purposes of class loading, an 11849 event callback that includes a JNI environment as a parameter to the 11850 callback will treated as if it is a native call, where the native method 11851 is in the class of the event thread's current frame. 11852 </li> 11853 </ul> 11854 <p/> 11855 Some <jvmti/> events identify objects with JNI references. 11856 All references 11857 in <jvmti/> events are JNI local references and will become invalid 11858 after the event callback returns. 11859 Unless stated otherwise, memory referenced by pointers sent in event 11860 callbacks may not be referenced after the event callback returns. 11861 <p/> 11862 Except where stated otherwise, events are delivered on the thread 11863 that caused the event. 11864 Events are sent at the time they occur. 11865 The specification for each event includes the set of 11866 <functionlink id="GetPhase">phases</functionlink> in which it can be sent; 11867 if an event triggering activity occurs during another phase, no event 11868 is sent. 11869 <p/> 11870 A thread that generates an event does not change its execution status 11871 (for example, the event does not cause the thread to be suspended). 11872 If an agent wishes the event to result in suspension, then the agent 11873 is responsible for explicitly suspending the thread with 11874 <functionlink id="SuspendThread"></functionlink>. 11875 <p/> 11876 If an event is enabled in multiple environments, the event will be sent 11877 to each agent in the order that the environments were created. 11878 </intro> 11879 11880 <intro label="Enabling Events" id="enablingevents"> 11881 All events are initially disabled. In order to receive any 11882 event: 11883 <ul> 11884 <li> 11885 If the event requires a capability, that capability must 11886 be added with 11887 <functionlink id="AddCapabilities"></functionlink>. 11888 </li> 11889 <li> 11890 A callback for the event must be set with 11891 <functionlink id="SetEventCallbacks"></functionlink>. 11892 </li> 11893 <li> 11894 The event must be enabled with 11895 <functionlink id="SetEventNotificationMode"></functionlink>. 11896 </li> 11897 </ul> 11898 </intro> 11899 11900 <intro label="Multiple Co-located Events" id="eventorder"> 11901 In many situations it is possible for multiple events to occur 11902 at the same location in one thread. When this happens, all the events 11903 are reported through the event callbacks in the order specified in this section. 11904 <p/> 11905 If the current location is at the entry point of a method, the 11906 <eventlink id="MethodEntry"></eventlink> event is reported before 11907 any other event at the current location in the same thread. 11908 <p/> 11909 If an exception catch has been detected at the current location, 11910 either because it is the beginning of a catch clause or a native method 11911 that cleared a pending exception has returned, the 11912 <code>exceptionCatch</code> event is reported before 11913 any other event at the current location in the same thread. 11914 <p/> 11915 If a <code>singleStep</code> event or 11916 <code>breakpoint</code> event is triggered at the 11917 current location, the event is defined to occur 11918 immediately before the code at the current location is executed. 11919 These events are reported before any events which are triggered 11920 by the execution of code at the current location in the same 11921 thread (specifically: 11922 <code>exception</code>, 11923 <code>fieldAccess</code>, and 11924 <code>fieldModification</code>). 11925 If both a step and breakpoint event are triggered for the same thread and 11926 location, the step event is reported before the breakpoint event. 11927 <p/> 11928 If the current location is the exit point of a method (that is, the last 11929 location before returning to the caller), the 11930 <eventlink id="MethodExit"></eventlink> event and 11931 the <eventlink id="FramePop"></eventlink> event (if requested) 11932 are reported after all other events at the current location in the same 11933 thread. There is no specified ordering of these two events 11934 with respect to each other. 11935 <p/> 11936 Co-located events can be triggered during the processing of some other 11937 event by the agent at the same location in the same thread. 11938 If such an event, of type <i>y</i>, is triggered during the processing of 11939 an event of type <i>x</i>, and if <i>x</i> 11940 precedes <i>y</i> in the ordering specified above, the co-located event 11941 <i>y</i> is reported for the current thread and location. If <i>x</i> does not precede 11942 <i>y</i>, <i>y</i> is not reported for the current thread and location. 11943 For example, if a breakpoint is set at the current location 11944 during the processing of <eventlink id="SingleStep"></eventlink>, 11945 that breakpoint will be reported before the thread moves off the current 11946 location. 11947 <p/>The following events are never considered to be co-located with 11948 other events. 11949 <ul> 11950 <li><eventlink id="VMStart"></eventlink></li> 11951 <li><eventlink id="VMInit"></eventlink></li> 11952 <li><eventlink id="VMDeath"></eventlink></li> 11953 <li><eventlink id="ThreadStart"></eventlink></li> 11954 <li><eventlink id="ThreadEnd"></eventlink></li> 11955 <li><eventlink id="ClassLoad"></eventlink></li> 11956 <li><eventlink id="ClassPrepare"></eventlink></li> 11957 </ul> 11958 </intro> 11959 11960 <intro label="Event Callbacks" id="jvmtiEventCallbacks"> 11961 The event callback structure below is used to specify the handler function 11962 for events. It is set with the 11963 <functionlink id="SetEventCallbacks"></functionlink> function. 11964 </intro> 11965 11966 <event label="Single Step" 11967 id="SingleStep" const="JVMTI_EVENT_SINGLE_STEP" filtered="thread" num="60"> 11968 <description> 11969 Single step events allow the agent to trace thread execution 11970 at the finest granularity allowed by the VM. A single step event is 11971 generated whenever a thread reaches a new location. 11972 Typically, single step events represent the completion of one VM 11973 instruction as defined in <vmspec/>. However, some implementations 11974 may define locations differently. In any case the 11975 <code>method</code> and <code>location</code> 11976 parameters uniquely identify the current location and allow 11977 the mapping to source file and line number when that information is 11978 available. 11979 <p/> 11980 No single step events are generated from within native methods. 11981 </description> 11982 <origin>jvmdi</origin> 11983 <capabilities> 11984 <required id="can_generate_single_step_events"></required> 11985 </capabilities> 11986 <parameters> 11987 <param id="jni_env"> 11988 <outptr> 11989 <struct>JNIEnv</struct> 11990 </outptr> 11991 <description> 11992 The JNI environment of the event (current) thread 11993 </description> 11994 </param> 11995 <param id="thread"> 11996 <jthread/> 11997 <description> 11998 Thread about to execution a new instruction 11999 </description> 12000 </param> 12001 <param id="klass"> 12002 <jclass method="method"/> 12003 <description> 12004 Class of the method about to execute a new instruction 12005 </description> 12006 </param> 12007 <param id="method"> 12008 <jmethodID class="klass"/> 12009 <description> 12010 Method about to execute a new instruction 12011 </description> 12012 </param> 12013 <param id="location"> 12014 <jlocation/> 12015 <description> 12016 Location of the new instruction 12017 </description> 12018 </param> 12019 </parameters> 12020 </event> 12021 12022 <event label="Breakpoint" 12023 id="Breakpoint" const="JVMTI_EVENT_BREAKPOINT" filtered="thread" num="62"> 12024 <description> 12025 Breakpoint events are generated whenever a thread reaches a location 12026 designated as a breakpoint with <functionlink id="SetBreakpoint"></functionlink>. 12027 The <code>method</code> and <code>location</code> 12028 parameters uniquely identify the current location and allow 12029 the mapping to source file and line number when that information is 12030 available. 12031 </description> 12032 <origin>jvmdi</origin> 12033 <capabilities> 12034 <required id="can_generate_breakpoint_events"></required> 12035 </capabilities> 12036 <parameters> 12037 <param id="jni_env"> 12038 <outptr> 12039 <struct>JNIEnv</struct> 12040 </outptr> 12041 <description> 12042 The JNI environment of the event (current) thread. 12043 </description> 12044 </param> 12045 <param id="thread"> 12046 <jthread/> 12047 <description> 12048 Thread that hit the breakpoint 12049 </description> 12050 </param> 12051 <param id="klass"> 12052 <jclass method="method"/> 12053 <description> 12054 Class of the method that hit the breakpoint 12055 </description> 12056 </param> 12057 <param id="method"> 12058 <jmethodID class="klass"/> 12059 <description> 12060 Method that hit the breakpoint 12061 </description> 12062 </param> 12063 <param id="location"> 12064 <jlocation/> 12065 <description> 12066 location of the breakpoint 12067 </description> 12068 </param> 12069 </parameters> 12070 </event> 12071 12072 <event label="Field Access" 12073 id="FieldAccess" const="JVMTI_EVENT_FIELD_ACCESS" filtered="thread" num="63"> 12074 <description> 12075 Field access events are generated whenever a thread accesses 12076 a field that was designated as a watchpoint 12077 with <functionlink id="SetFieldAccessWatch"></functionlink>. 12078 The <code>method</code> and <code>location</code> 12079 parameters uniquely identify the current location and allow 12080 the mapping to source file and line number when that information is 12081 available. 12082 </description> 12083 <origin>jvmdi</origin> 12084 <capabilities> 12085 <required id="can_generate_field_access_events"></required> 12086 </capabilities> 12087 <parameters> 12088 <param id="jni_env"> 12089 <outptr> 12090 <struct>JNIEnv</struct> 12091 </outptr> 12092 <description> 12093 The JNI environment of the event (current) thread 12094 </description> 12095 </param> 12096 <param id="thread"> 12097 <jthread/> 12098 <description> 12099 Thread accessing the field 12100 </description> 12101 </param> 12102 <param id="klass"> 12103 <jclass method="method"/> 12104 <description> 12105 Class of the method where the access is occurring 12106 </description> 12107 </param> 12108 <param id="method"> 12109 <jmethodID class="klass"/> 12110 <description> 12111 Method where the access is occurring 12112 </description> 12113 </param> 12114 <param id="location"> 12115 <jlocation/> 12116 <description> 12117 Location where the access is occurring 12118 </description> 12119 </param> 12120 <param id="field_klass"> 12121 <jclass field="field"/> 12122 <description> 12123 Class of the field being accessed 12124 </description> 12125 </param> 12126 <param id="object"> 12127 <jobject/> 12128 <description> 12129 Object with the field being accessed if the field is an 12130 instance field; <code>NULL</code> otherwise 12131 </description> 12132 </param> 12133 <param id="field"> 12134 <jfieldID class="field_klass"/> 12135 <description> 12136 Field being accessed 12137 </description> 12138 </param> 12139 </parameters> 12140 </event> 12141 12142 <event label="Field Modification" 12143 id="FieldModification" const="JVMTI_EVENT_FIELD_MODIFICATION" filtered="thread" num="64"> 12144 <description> 12145 Field modification events are generated whenever a thread modifies 12146 a field that was designated as a watchpoint 12147 with <functionlink id="SetFieldModificationWatch"></functionlink>. 12148 The <code>method</code> and <code>location</code> 12149 parameters uniquely identify the current location and allow 12150 the mapping to source file and line number when that information is 12151 available. 12152 </description> 12153 <origin>jvmdi</origin> 12154 <capabilities> 12155 <required id="can_generate_field_modification_events"></required> 12156 </capabilities> 12157 <parameters> 12158 <param id="jni_env"> 12159 <outptr> 12160 <struct>JNIEnv</struct> 12161 </outptr> 12162 <description> 12163 The JNI environment of the event (current) thread 12164 </description> 12165 </param> 12166 <param id="thread"> 12167 <jthread/> 12168 <description> 12169 Thread modifying the field 12170 </description> 12171 </param> 12172 <param id="klass"> 12173 <jclass method="method"/> 12174 <description> 12175 Class of the method where the modification is occurring 12176 </description> 12177 </param> 12178 <param id="method"> 12179 <jmethodID class="klass"/> 12180 <description> 12181 Method where the modification is occurring 12182 </description> 12183 </param> 12184 <param id="location"> 12185 <jlocation/> 12186 <description> 12187 Location where the modification is occurring 12188 </description> 12189 </param> 12190 <param id="field_klass"> 12191 <jclass field="field"/> 12192 <description> 12193 Class of the field being modified 12194 </description> 12195 </param> 12196 <param id="object"> 12197 <jobject/> 12198 <description> 12199 Object with the field being modified if the field is an 12200 instance field; <code>NULL</code> otherwise 12201 </description> 12202 </param> 12203 <param id="field"> 12204 <jfieldID class="field_klass"/> 12205 <description> 12206 Field being modified 12207 </description> 12208 </param> 12209 <param id="signature_type"> 12210 <char/> 12211 <description> 12212 Signature type of the new value 12213 </description> 12214 </param> 12215 <param id="new_value"> 12216 <jvalue/> 12217 <description> 12218 The new value 12219 </description> 12220 </param> 12221 </parameters> 12222 </event> 12223 12224 <event label="Frame Pop" 12225 id="FramePop" const="JVMTI_EVENT_FRAME_POP" filtered="thread" num="61"> 12226 <description> 12227 Frame pop events are generated upon exit from a single method 12228 in a single frame as specified 12229 in a call to <functionlink id="NotifyFramePop"></functionlink>. 12230 This is true whether termination is caused by 12231 executing its return instruction 12232 or by throwing an exception to its caller 12233 (see <paramlink id="was_popped_by_exception"></paramlink>). 12234 However, frame pops caused by the <functionlink id="PopFrame"/> 12235 function are not reported. 12236 <p/> 12237 The location reported by <functionlink id="GetFrameLocation"></functionlink> 12238 identifies the executable location in the returning method, 12239 immediately prior to the return. 12240 </description> 12241 <origin>jvmdi</origin> 12242 <capabilities> 12243 <required id="can_generate_frame_pop_events"></required> 12244 </capabilities> 12245 <parameters> 12246 <param id="jni_env"> 12247 <outptr> 12248 <struct>JNIEnv</struct> 12249 </outptr> 12250 <description> 12251 The JNI environment of the event (current) thread 12252 </description> 12253 </param> 12254 <param id="thread"> 12255 <jthread/> 12256 <description> 12257 Thread that is popping the frame 12258 </description> 12259 </param> 12260 <param id="klass"> 12261 <jclass method="method"/> 12262 <description> 12263 Class of the method being popped 12264 </description> 12265 </param> 12266 <param id="method"> 12267 <jmethodID class="klass"/> 12268 <description> 12269 Method being popped 12270 </description> 12271 </param> 12272 <param id="was_popped_by_exception"> 12273 <jboolean/> 12274 <description> 12275 True if frame was popped by a thrown exception. 12276 False if method exited through its return instruction. 12277 </description> 12278 </param> 12279 </parameters> 12280 </event> 12281 12282 <event label="Method Entry" 12283 id="MethodEntry" const="JVMTI_EVENT_METHOD_ENTRY" filtered="thread" num="65"> 12284 <description> 12285 Method entry events are generated upon entry of Java 12286 programming language methods (including native methods). 12287 <p/> 12288 The location reported by <functionlink id="GetFrameLocation"></functionlink> 12289 identifies the initial executable location in 12290 the method. 12291 <p/> 12292 Enabling method 12293 entry or exit events will significantly degrade performance on many platforms and is thus 12294 not advised for performance critical usage (such as profiling). 12295 <internallink id="bci">Bytecode instrumentation</internallink> should be 12296 used in these cases. 12297 </description> 12298 <origin>jvmdi</origin> 12299 <capabilities> 12300 <required id="can_generate_method_entry_events"></required> 12301 </capabilities> 12302 <parameters> 12303 <param id="jni_env"> 12304 <outptr> 12305 <struct>JNIEnv</struct> 12306 </outptr> 12307 <description> 12308 The JNI environment of the event (current) thread 12309 </description> 12310 </param> 12311 <param id="thread"> 12312 <jthread/> 12313 <description> 12314 Thread entering the method 12315 </description> 12316 </param> 12317 <param id="klass"> 12318 <jclass method="method"/> 12319 <description> 12320 Class of the method being entered 12321 </description> 12322 </param> 12323 <param id="method"> 12324 <jmethodID class="klass"/> 12325 <description> 12326 Method being entered 12327 </description> 12328 </param> 12329 </parameters> 12330 </event> 12331 12332 <event label="Method Exit" 12333 id="MethodExit" const="JVMTI_EVENT_METHOD_EXIT" filtered="thread" num="66"> 12334 <description> 12335 Method exit events are generated upon exit from Java 12336 programming language methods (including native methods). 12337 This is true whether termination is caused by 12338 executing its return instruction 12339 or by throwing an exception to its caller 12340 (see <paramlink id="was_popped_by_exception"></paramlink>). 12341 <p/> 12342 The <code>method</code> field uniquely identifies the 12343 method being entered or exited. The <code>frame</code> field provides 12344 access to the stack frame for the method. 12345 <p/> 12346 The location reported by <functionlink id="GetFrameLocation"></functionlink> 12347 identifies the executable location in the returning method 12348 immediately prior to the return. 12349 <p/> 12350 Enabling method 12351 entry or exit events will significantly degrade performance on many platforms and is thus 12352 not advised for performance critical usage (such as profiling). 12353 <internallink id="bci">Bytecode instrumentation</internallink> should be 12354 used in these cases. 12355 </description> 12356 <origin>jvmdi</origin> 12357 <capabilities> 12358 <required id="can_generate_method_exit_events"></required> 12359 </capabilities> 12360 <parameters> 12361 <param id="jni_env"> 12362 <outptr> 12363 <struct>JNIEnv</struct> 12364 </outptr> 12365 <description> 12366 The JNI environment of the event (current) thread 12367 </description> 12368 </param> 12369 <param id="thread"> 12370 <jthread/> 12371 <description> 12372 Thread exiting the method 12373 </description> 12374 </param> 12375 <param id="klass"> 12376 <jclass method="method"/> 12377 <description> 12378 Class of the method being exited 12379 </description> 12380 </param> 12381 <param id="method"> 12382 <jmethodID class="klass"/> 12383 <description> 12384 Method being exited 12385 </description> 12386 </param> 12387 <param id="was_popped_by_exception"> 12388 <jboolean/> 12389 <description> 12390 True if frame was popped by a thrown exception. 12391 False if method exited through its return instruction. 12392 </description> 12393 </param> 12394 <param id="return_value"> 12395 <jvalue/> 12396 <description> 12397 The return value of the method being exited. 12398 Undefined and should not be used if 12399 <paramlink id="was_popped_by_exception"></paramlink> 12400 is true. 12401 </description> 12402 </param> 12403 </parameters> 12404 </event> 12405 12406 <event label="Native Method Bind" phase="any" 12407 id="NativeMethodBind" const="JVMTI_EVENT_NATIVE_METHOD_BIND" num="67"> 12408 <description> 12409 A Native Method Bind event is sent when a VM binds a 12410 Java programming language native method 12411 to the address of a function that implements the native method. 12412 This will occur when the native method is called for the first time 12413 and also occurs when the JNI function <code>RegisterNatives</code> is called. 12414 This event allows the bind to be redirected to an agent-specified 12415 proxy function. 12416 This event is not sent when the native method is unbound. 12417 Typically, this proxy function will need to be specific to a 12418 particular method or, to handle the general case, automatically 12419 generated assembly code, since after instrumentation code is 12420 executed the function at the original binding 12421 address will usually be invoked. 12422 The original binding can be restored or the redirection changed 12423 by use of the JNI function <code>RegisterNatives</code>. 12424 Some events may be sent during the primordial phase, JNI and 12425 most of <jvmti/> cannot be used at this time but the method and 12426 address can be saved for use later. 12427 </description> 12428 <origin>new</origin> 12429 <capabilities> 12430 <required id="can_generate_native_method_bind_events"></required> 12431 </capabilities> 12432 <parameters> 12433 <param id="jni_env"> 12434 <outptr> 12435 <struct>JNIEnv</struct> 12436 </outptr> 12437 <description> 12438 The JNI environment of the event (current) thread 12439 Will be <code>NULL</code> if sent during the primordial 12440 <functionlink id="GetPhase">phase</functionlink>. 12441 </description> 12442 </param> 12443 <param id="thread"> 12444 <jthread/> 12445 <description> 12446 Thread requesting the bind 12447 </description> 12448 </param> 12449 <param id="klass"> 12450 <jclass method="method"/> 12451 <description> 12452 Class of the method being bound 12453 </description> 12454 </param> 12455 <param id="method"> 12456 <jmethodID class="klass"/> 12457 <description> 12458 Native method being bound 12459 </description> 12460 </param> 12461 <param id="address"> 12462 <outptr><void/></outptr> 12463 <description> 12464 The address the VM is about to bind to--that is, the 12465 address of the implementation of the native method 12466 </description> 12467 </param> 12468 <param id="new_address_ptr"> 12469 <agentbuf><void/></agentbuf> 12470 <description> 12471 if the referenced address is changed (that is, if 12472 <code>*new_address_ptr</code> is set), the binding 12473 will instead be made to the supplied address. 12474 </description> 12475 </param> 12476 </parameters> 12477 </event> 12478 12479 <event label="Exception" 12480 id="Exception" const="JVMTI_EVENT_EXCEPTION" filtered="thread" num="58"> 12481 <description> 12482 Exception events are generated whenever an exception is first detected 12483 in a Java programming language method. 12484 Where "exception" means any <code>java.lang.Throwable</code>. 12485 The exception may have been thrown by a Java programming language or native 12486 method, but in the case of native methods, the event is not generated 12487 until the exception is first seen by a Java programming language method. If an exception is 12488 set and cleared in a native method (and thus is never visible to Java programming language code), 12489 no exception event is generated. 12490 <p/> 12491 The <code>method</code> and <code>location</code> 12492 parameters uniquely identify the current location 12493 (where the exception was detected) and allow 12494 the mapping to source file and line number when that information is 12495 available. The <code>exception</code> field identifies the thrown 12496 exception object. The <code>catch_method</code> 12497 and <code>catch_location</code> identify the location of the catch clause, 12498 if any, that handles the thrown exception. If there is no such catch clause, 12499 each field is set to 0. There is no guarantee that the thread will ever 12500 reach this catch clause. If there are native methods on the call stack 12501 between the throw location and the catch clause, the exception may 12502 be reset by one of those native methods. 12503 Similarly, exceptions that are reported as uncaught (<code>catch_klass</code> 12504 et al. set to 0) may in fact be caught by native code. 12505 Agents can check for these occurrences by monitoring 12506 <eventlink id="ExceptionCatch"></eventlink> events. 12507 Note that finally clauses are implemented as catch and re-throw. Therefore they 12508 will be reported in the catch location. 12509 </description> 12510 <origin>jvmdi</origin> 12511 <capabilities> 12512 <required id="can_generate_exception_events"></required> 12513 </capabilities> 12514 <parameters> 12515 <param id="jni_env"> 12516 <outptr> 12517 <struct>JNIEnv</struct> 12518 </outptr> 12519 <description> 12520 The JNI environment of the event (current) thread 12521 </description> 12522 </param> 12523 <param id="thread"> 12524 <jthread/> 12525 <description> 12526 Thread generating the exception 12527 </description> 12528 </param> 12529 <param id="klass"> 12530 <jclass method="method"/> 12531 <description> 12532 Class generating the exception 12533 </description> 12534 </param> 12535 <param id="method"> 12536 <jmethodID class="klass"/> 12537 <description> 12538 Method generating the exception 12539 </description> 12540 </param> 12541 <param id="location"> 12542 <jlocation/> 12543 <description> 12544 Location where exception occurred 12545 </description> 12546 </param> 12547 <param id="exception"> 12548 <jobject/> 12549 <description> 12550 The exception being thrown 12551 </description> 12552 </param> 12553 <param id="catch_klass"> 12554 <jclass method="catch_method"/> 12555 <description> 12556 Class that will catch the exception, or <code>NULL</code> if no known catch 12557 </description> 12558 </param> 12559 <param id="catch_method"> 12560 <jmethodID class="catch_klass"/> 12561 <description> 12562 Method that will catch the exception, or <code>NULL</code> if no known catch 12563 </description> 12564 </param> 12565 <param id="catch_location"> 12566 <jlocation/> 12567 <description> 12568 location which will catch the exception or zero if no known catch 12569 </description> 12570 </param> 12571 </parameters> 12572 </event> 12573 12574 <event label="Exception Catch" 12575 id="ExceptionCatch" const="JVMTI_EVENT_EXCEPTION_CATCH" filtered="thread" num="59"> 12576 <description> 12577 Exception catch events are generated whenever a thrown exception is caught. 12578 Where "exception" means any <code>java.lang.Throwable</code>. 12579 If the exception is caught in a Java programming language method, the event is generated 12580 when the catch clause is reached. If the exception is caught in a native 12581 method, the event is generated as soon as control is returned to a Java programming language 12582 method. Exception catch events are generated for any exception for which 12583 a throw was detected in a Java programming language method. 12584 Note that finally clauses are implemented as catch and re-throw. Therefore they 12585 will generate exception catch events. 12586 <p/> 12587 The <code>method</code> and <code>location</code> 12588 parameters uniquely identify the current location 12589 and allow the mapping to source file and line number when that information is 12590 available. For exceptions caught in a Java programming language method, the 12591 <code>exception</code> object identifies the exception object. Exceptions 12592 caught in native methods are not necessarily available by the time the 12593 exception catch is reported, so the <code>exception</code> field is set 12594 to <code>NULL</code>. 12595 </description> 12596 <origin>jvmdi</origin> 12597 <capabilities> 12598 <required id="can_generate_exception_events"></required> 12599 </capabilities> 12600 <parameters> 12601 <param id="jni_env"> 12602 <outptr> 12603 <struct>JNIEnv</struct> 12604 </outptr> 12605 <description> 12606 The JNI environment of the event (current) thread 12607 </description> 12608 </param> 12609 <param id="thread"> 12610 <jthread/> 12611 <description> 12612 Thread catching the exception 12613 </description> 12614 </param> 12615 <param id="klass"> 12616 <jclass method="method"/> 12617 <description> 12618 Class catching the exception 12619 </description> 12620 </param> 12621 <param id="method"> 12622 <jmethodID class="klass"/> 12623 <description> 12624 Method catching the exception 12625 </description> 12626 </param> 12627 <param id="location"> 12628 <jlocation/> 12629 <description> 12630 Location where exception is being caught 12631 </description> 12632 </param> 12633 <param id="exception"> 12634 <jobject/> 12635 <description> 12636 Exception being caught 12637 </description> 12638 </param> 12639 </parameters> 12640 </event> 12641 12642 <event label="Thread Start" 12643 id="ThreadStart" const="JVMTI_EVENT_THREAD_START" num="52" phase="start"> 12644 <description> 12645 Thread start events are generated by a new thread before its initial 12646 method executes. 12647 <p/> 12648 A thread may be listed in the array returned by 12649 <functionlink id="GetAllThreads"></functionlink> 12650 before its thread start event is generated. 12651 It is possible for other events to be generated 12652 on a thread before its thread start event. 12653 <p/> 12654 The event is sent on the newly started <paramlink id="thread"></paramlink>. 12655 </description> 12656 <origin>jvmdi</origin> 12657 <capabilities> 12658 </capabilities> 12659 <parameters> 12660 <param id="jni_env"> 12661 <outptr> 12662 <struct>JNIEnv</struct> 12663 </outptr> 12664 <description> 12665 The JNI environment of the event (current) thread. 12666 </description> 12667 </param> 12668 <param id="thread"> 12669 <jthread/> 12670 <description> 12671 Thread starting 12672 </description> 12673 </param> 12674 </parameters> 12675 </event> 12676 12677 <event label="Thread End" 12678 id="ThreadEnd" const="JVMTI_EVENT_THREAD_END" filtered="thread" num="53" phase="start"> 12679 <description> 12680 Thread end events are generated by a terminating thread 12681 after its initial method has finished execution. 12682 <p/> 12683 A thread may be listed in the array returned by 12684 <functionlink id="GetAllThreads"></functionlink> 12685 after its thread end event is generated. 12686 No events are generated on a thread 12687 after its thread end event. 12688 <p/> 12689 The event is sent on the dying <paramlink id="thread"></paramlink>. 12690 </description> 12691 <origin>jvmdi</origin> 12692 <capabilities> 12693 </capabilities> 12694 <parameters> 12695 <param id="jni_env"> 12696 <outptr> 12697 <struct>JNIEnv</struct> 12698 </outptr> 12699 <description> 12700 The JNI environment of the event (current) thread. 12701 </description> 12702 </param> 12703 <param id="thread"> 12704 <jthread/> 12705 <description> 12706 Thread ending 12707 </description> 12708 </param> 12709 </parameters> 12710 </event> 12711 12712 <event label="Class Load" 12713 id="ClassLoad" const="JVMTI_EVENT_CLASS_LOAD" filtered="thread" phase="start" num="55"> 12714 <description> 12715 A class load event is generated when a class is first loaded. The order 12716 of class load events generated by a particular thread are guaranteed 12717 to match the order of class loading within that thread. 12718 Array class creation does not generate a class load event. 12719 The creation of a primitive class (for example, java.lang.Integer.TYPE) 12720 does not generate a class load event. 12721 <p/> 12722 This event is sent at an early stage in loading the class. As 12723 a result the class should be used carefully. Note, for example, 12724 that methods and fields are not yet loaded, so queries for methods, 12725 fields, subclasses, and so on will not give correct results. 12726 See "Loading of Classes and Interfaces" in the <i>Java Language 12727 Specification</i>. For most 12728 purposes the <eventlink id="ClassPrepare"></eventlink> event will 12729 be more useful. 12730 </description> 12731 <origin>jvmdi</origin> 12732 <capabilities> 12733 </capabilities> 12734 <parameters> 12735 <param id="jni_env"> 12736 <outptr> 12737 <struct>JNIEnv</struct> 12738 </outptr> 12739 <description> 12740 The JNI environment of the event (current) thread 12741 </description> 12742 </param> 12743 <param id="thread"> 12744 <jthread/> 12745 <description> 12746 Thread loading the class 12747 </description> 12748 </param> 12749 <param id="klass"> 12750 <jclass/> 12751 <description> 12752 Class being loaded 12753 </description> 12754 </param> 12755 </parameters> 12756 </event> 12757 12758 <elide> 12759 <event label="Class Unload" 12760 id="ClassUnload" const="JVMTI_EVENT_CLASS_UNLOAD" num="57"> 12761 <description> 12762 A class unload event is generated when the class is about to be unloaded. 12763 Class unload events take place during garbage collection and must be 12764 handled extremely carefully. The garbage collector holds many locks 12765 and has suspended all other threads, so the event handler cannot depend 12766 on the ability to acquire any locks. The class unload event handler should 12767 do as little as possible, perhaps by queuing information to be processed 12768 later. In particular, the <code>jclass</code> should be used only in 12769 the JNI function <code>isSameObject</code> or in the following <jvmti/> functions: 12770 <ul> 12771 <li><functionlink id="GetClassSignature"></functionlink></li> 12772 <li><functionlink id="GetSourceFileName"></functionlink></li> 12773 <li><functionlink id="IsInterface"></functionlink></li> 12774 <li><functionlink id="IsArrayClass"></functionlink></li> 12775 </ul> 12776 </description> 12777 <origin>jvmdi</origin> 12778 <capabilities> 12779 </capabilities> 12780 <parameters> 12781 <param id="jni_env"> 12782 <outptr> 12783 <struct>JNIEnv</struct> 12784 </outptr> 12785 <description> 12786 The JNI environment of the event (current) thread 12787 </description> 12788 </param> 12789 <param id="thread"> 12790 <jthread/> 12791 <description> 12792 Thread generating the class unload 12793 </description> 12794 </param> 12795 <param id="klass"> 12796 <jclass/> 12797 <description> 12798 Class being unloaded 12799 </description> 12800 </param> 12801 </parameters> 12802 </event> 12803 </elide> 12804 12805 <event label="Class Prepare" 12806 id="ClassPrepare" const="JVMTI_EVENT_CLASS_PREPARE" filtered="thread" phase="start" num="56"> 12807 <description> 12808 A class prepare event is generated when class preparation is complete. 12809 At this point, class fields, methods, and implemented interfaces are 12810 available, and no code from the class has been executed. Since array 12811 classes never have fields or methods, class prepare events are not 12812 generated for them. Class prepare events are not generated for 12813 primitive classes (for example, <code>java.lang.Integer.TYPE</code>). 12814 </description> 12815 <origin>jvmdi</origin> 12816 <capabilities> 12817 </capabilities> 12818 <parameters> 12819 <param id="jni_env"> 12820 <outptr> 12821 <struct>JNIEnv</struct> 12822 </outptr> 12823 <description> 12824 The JNI environment of the event (current) thread 12825 </description> 12826 </param> 12827 <param id="thread"> 12828 <jthread/> 12829 <description> 12830 Thread generating the class prepare 12831 </description> 12832 </param> 12833 <param id="klass"> 12834 <jclass/> 12835 <description> 12836 Class being prepared 12837 </description> 12838 </param> 12839 </parameters> 12840 </event> 12841 12842 <event label="Class File Load Hook" phase="any" 12843 id="ClassFileLoadHook" const="JVMTI_EVENT_CLASS_FILE_LOAD_HOOK" num="54"> 12844 <description> 12845 This event is sent when the VM obtains class file data, 12846 but before it constructs 12847 the in-memory representation for that class. 12848 This event is also sent when the class is being modified by the 12849 <functionlink id="RetransformClasses"/> function or 12850 the <functionlink id="RedefineClasses"/> function, 12851 called in any <jvmti/> environment. 12852 The agent can instrument 12853 the existing class file data sent by the VM to include profiling/debugging hooks. 12854 See the description of 12855 <internallink id="bci">bytecode instrumentation</internallink> 12856 for usage information. 12857 <p/> 12858 When the capabilities 12859 <internallink id="jvmtiCapabilities.can_generate_early_class_hook_events"> 12860 <code>can_generate_early_class_hook_events</code></internallink> and 12861 <internallink id="jvmtiCapabilities.can_generate_all_class_hook_events"> 12862 <code>can_generate_all_class_hook_events</code></internallink> 12863 are enabled then this event may be sent in the primordial phase. 12864 Otherwise, this event may be sent before the VM is initialized (the start 12865 <functionlink id="GetPhase">phase</functionlink>). 12866 Some classes might not be compatible 12867 with the function (eg. ROMized classes or implementation defined classes) and this event will 12868 not be generated for these classes. 12869 <p/> 12870 The agent must allocate the space for the modified 12871 class file data buffer 12872 using the memory allocation function 12873 <functionlink id="Allocate"></functionlink> because the 12874 VM is responsible for freeing the new class file data buffer 12875 using <functionlink id="Deallocate"></functionlink>. 12876 <p/> 12877 If the agent wishes to modify the class file, it must set 12878 <code>new_class_data</code> to point 12879 to the newly instrumented class file data buffer and set 12880 <code>new_class_data_len</code> to the length of that 12881 buffer before returning 12882 from this call. If no modification is desired, the agent simply 12883 does not set <code>new_class_data</code>. If multiple agents 12884 have enabled this event the results are chained. That is, if 12885 <code>new_class_data</code> has been set, it becomes the 12886 <code>class_data</code> for the next agent. 12887 <p/> 12888 When handling a class load in the live phase, then the 12889 <functionlink id="GetNamedModule"></functionlink> 12890 function can be used to map class loader and a package name to a module. 12891 When a class is being redefined or retransformed then 12892 <code>class_being_redefined</code> is non <code>NULL</code> and so 12893 the JNI <code>GetModule</code> function can also be used 12894 to obtain the Module. 12895 <p/> 12896 The order that this event is sent to each environment differs 12897 from other events. 12898 This event is sent to environments in the following order: 12899 <ul> 12900 <li><fieldlink id="can_retransform_classes" 12901 struct="jvmtiCapabilities">retransformation 12902 incapable</fieldlink> 12903 environments, in the 12904 order in which they were created 12905 </li> 12906 <li><fieldlink id="can_retransform_classes" 12907 struct="jvmtiCapabilities">retransformation 12908 capable</fieldlink> 12909 environments, in the 12910 order in which they were created 12911 </li> 12912 </ul> 12913 When triggered by <functionlink id="RetransformClasses"/>, 12914 this event is sent only to <fieldlink id="can_retransform_classes" 12915 struct="jvmtiCapabilities">retransformation 12916 capable</fieldlink> 12917 environments. 12918 </description> 12919 <origin>jvmpi</origin> 12920 <capabilities> 12921 <capability id="can_generate_all_class_hook_events"></capability> 12922 <capability id="can_generate_early_class_hook_events"></capability> 12923 </capabilities> 12924 <parameters> 12925 <param id="jni_env"> 12926 <outptr> 12927 <struct>JNIEnv</struct> 12928 </outptr> 12929 <description> 12930 The JNI environment of the event (current) thread. 12931 </description> 12932 </param> 12933 <param id="class_being_redefined"> 12934 <jclass/> 12935 <description> 12936 The class being 12937 <functionlink id="RedefineClasses">redefined</functionlink> or 12938 <functionlink id="RetransformClasses">retransformed</functionlink>. 12939 <code>NULL</code> if sent by class load. 12940 </description> 12941 </param> 12942 <param id="loader"> 12943 <jobject/> 12944 <description> 12945 The class loader loading the class. 12946 <code>NULL</code> if the bootstrap class loader. 12947 </description> 12948 </param> 12949 <param id="name"> 12950 <vmbuf><char/></vmbuf> 12951 <description> 12952 Name of class being loaded as a VM internal qualified name 12953 (for example, "java/util/List"), encoded as a 12954 <internallink id="mUTF">modified UTF-8</internallink> string. 12955 Note: if the class is defined with a <code>NULL</code> name or 12956 without a name specified, <code>name</code> will be <code>NULL</code>. 12957 </description> 12958 </param> 12959 <param id="protection_domain"> 12960 <jobject/> 12961 <description> 12962 The <code>ProtectionDomain</code> of the class. 12963 </description> 12964 </param> 12965 <param id="class_data_len"> 12966 <jint/> 12967 <description> 12968 Length of current class file data buffer. 12969 </description> 12970 </param> 12971 <param id="class_data"> 12972 <vmbuf><uchar/></vmbuf> 12973 <description> 12974 Pointer to the current class file data buffer. 12975 </description> 12976 </param> 12977 <param id="new_class_data_len"> 12978 <outptr><jint/></outptr> 12979 <description> 12980 Pointer to the length of the new class file data buffer. 12981 </description> 12982 </param> 12983 <param id="new_class_data"> 12984 <agentbuf incount="new_class_data_len"><uchar/></agentbuf> 12985 <description> 12986 Pointer to the pointer to the instrumented class file data buffer. 12987 </description> 12988 </param> 12989 </parameters> 12990 </event> 12991 12992 <event label="VM Start Event" 12993 id="VMStart" const="JVMTI_EVENT_VM_START" num="57" phase="start"> 12994 <description> 12995 The VM start event signals the start of the VM. 12996 At this time JNI is live but the VM is not yet fully initialized. 12997 Once this event is generated, the agent is free to call any JNI function. 12998 This event signals the beginning of the start phase, 12999 <jvmti/> functions permitted in the start phase may be called. 13000 <p/> 13001 The timing of this event may depend on whether the agent has added the 13002 <internallink id="jvmtiCapabilities.can_generate_early_vmstart"> 13003 <code>can_generate_early_vmstart</code></internallink> capability or not. 13004 If the capability has been added then the VM posts the event as early 13005 as possible. The VM is capable of executing bytecode but it may not have 13006 initialized to the point where it can load classes in modules other than 13007 <code>java.base</code>, or even arbitrary classes in <code>java.base</code>. 13008 Agents that do load-time instrumentation in this 13009 phase must take great care when instrumenting code that potentially 13010 executes in this phase. Extreme care should also be taken with JNI 13011 <code>FindClass</code> as it may not be possible to load classes and attempts 13012 to do so may result in unpredictable behavior, maybe even stability issues 13013 on some VM implementations. 13014 If the capability has not been added then the VM delays posting this 13015 event until it is capable of loading classes in modules other than 13016 <code>java.base</code> or the VM has completed its initialization. 13017 Agents that create more than one JVM TI environment, where the 13018 capability is added to some but not all environments, may observe the 13019 start phase beginning earlier in the JVM TI environments that possess 13020 the capability. 13021 <p/> 13022 In the case of VM start-up failure, this event will not be sent. 13023 </description> 13024 <origin>jvmdi</origin> 13025 <capabilities> 13026 </capabilities> 13027 <parameters> 13028 <param id="jni_env"> 13029 <outptr> 13030 <struct>JNIEnv</struct> 13031 </outptr> 13032 <description> 13033 The JNI environment of the event (current) thread. 13034 </description> 13035 </param> 13036 </parameters> 13037 </event> 13038 13039 <event label="VM Initialization Event" 13040 id="VMInit" const="JVMTI_EVENT_VM_INIT" num="50"> 13041 <description> 13042 The VM initialization event signals the completion of VM initialization. Once 13043 this event is generated, the agent is free to call any JNI or <jvmti/> 13044 function. The VM initialization event can be preceded by or can be concurrent 13045 with other events, but 13046 the preceding events should be handled carefully, if at all, because the 13047 VM has not completed its initialization. The thread start event for the 13048 main application thread is guaranteed not to occur until after the 13049 handler for the VM initialization event returns. 13050 <p/> 13051 In the case of VM start-up failure, this event will not be sent. 13052 </description> 13053 <origin>jvmdi</origin> 13054 <capabilities> 13055 </capabilities> 13056 <parameters> 13057 <param id="jni_env"> 13058 <outptr> 13059 <struct>JNIEnv</struct> 13060 </outptr> 13061 <description> 13062 The JNI environment of the event (current) thread. 13063 </description> 13064 </param> 13065 <param id="thread"> 13066 <jthread/> 13067 <description> 13068 The initial thread 13069 </description> 13070 </param> 13071 </parameters> 13072 </event> 13073 13074 <event label="VM Death Event" 13075 id="VMDeath" const="JVMTI_EVENT_VM_DEATH" num="51"> 13076 <description> 13077 The VM death event notifies the agent of the termination of the VM. 13078 No events will occur after the VMDeath event. 13079 <p/> 13080 In the case of VM start-up failure, this event will not be sent. 13081 Note that <internallink id="onunload">Agent_OnUnload</internallink> 13082 will still be called in these cases. 13083 </description> 13084 <origin>jvmdi</origin> 13085 <capabilities> 13086 </capabilities> 13087 <parameters> 13088 <param id="jni_env"> 13089 <outptr> 13090 <struct>JNIEnv</struct> 13091 </outptr> 13092 <description> 13093 The JNI environment of the event (current) thread 13094 </description> 13095 </param> 13096 </parameters> 13097 </event> 13098 13099 <event label="Compiled Method Load" phase="start" 13100 id="CompiledMethodLoad" const="JVMTI_EVENT_COMPILED_METHOD_LOAD" num="68"> 13101 <description> 13102 Sent when a method is compiled and loaded into memory by the VM. 13103 If it is unloaded, the <eventlink id="CompiledMethodUnload"/> event is sent. 13104 If it is moved, the <eventlink id="CompiledMethodUnload"/> event is sent, 13105 followed by a new <code>CompiledMethodLoad</code> event. 13106 Note that a single method may have multiple compiled forms, and that 13107 this event will be sent for each form. 13108 Note also that several methods may be inlined into a single 13109 address range, and that this event will be sent for each method. 13110 <p/> 13111 These events can be sent after their initial occurrence with 13112 <functionlink id="GenerateEvents"></functionlink>. 13113 </description> 13114 <origin>jvmpi</origin> 13115 <typedef id="jvmtiAddrLocationMap" label="Native address to location entry"> 13116 <field id="start_address"> 13117 <vmbuf><void/></vmbuf> 13118 <description> 13119 Starting native address of code corresponding to a location 13120 </description> 13121 </field> 13122 <field id="location"> 13123 <jlocation/> 13124 <description> 13125 Corresponding location. See 13126 <functionlink id="GetJLocationFormat"></functionlink> 13127 for the meaning of location. 13128 </description> 13129 </field> 13130 </typedef> 13131 <capabilities> 13132 <required id="can_generate_compiled_method_load_events"></required> 13133 </capabilities> 13134 <parameters> 13135 <param id="klass"> 13136 <jclass method="method"/> 13137 <description> 13138 Class of the method being compiled and loaded 13139 </description> 13140 </param> 13141 <param id="method"> 13142 <jmethodID class="klass"/> 13143 <description> 13144 Method being compiled and loaded 13145 </description> 13146 </param> 13147 <param id="code_size"> 13148 <jint/> 13149 <description> 13150 Size of compiled code 13151 </description> 13152 </param> 13153 <param id="code_addr"> 13154 <vmbuf><void/></vmbuf> 13155 <description> 13156 Address where compiled method code is loaded 13157 </description> 13158 </param> 13159 <param id="map_length"> 13160 <jint/> 13161 <description> 13162 Number of <typelink id="jvmtiAddrLocationMap"></typelink> 13163 entries in the address map. 13164 Zero if mapping information cannot be supplied. 13165 </description> 13166 </param> 13167 <param id="map"> 13168 <vmbuf><struct>jvmtiAddrLocationMap</struct></vmbuf> 13169 <description> 13170 Map from native addresses to location. 13171 The native address range of each entry is from 13172 <fieldlink id="start_address" struct="jvmtiAddrLocationMap"></fieldlink> 13173 to <code>start_address-1</code> of the next entry. 13174 <code>NULL</code> if mapping information cannot be supplied. 13175 </description> 13176 </param> 13177 <param id="compile_info"> 13178 <vmbuf><void/></vmbuf> 13179 <description> 13180 VM-specific compilation information. 13181 The referenced compile information is managed by the VM 13182 and must not depend on the agent for collection. 13183 A VM implementation defines the content and lifetime 13184 of the information. 13185 </description> 13186 </param> 13187 </parameters> 13188 </event> 13189 13190 <event label="Compiled Method Unload" phase="start" 13191 id="CompiledMethodUnload" const="JVMTI_EVENT_COMPILED_METHOD_UNLOAD" num="69"> 13192 <description> 13193 Sent when a compiled method is unloaded from memory. 13194 This event might not be sent on the thread which performed the unload. 13195 This event may be sent sometime after the unload occurs, but 13196 will be sent before the memory is reused 13197 by a newly generated compiled method. This event may be sent after 13198 the class is unloaded. 13199 </description> 13200 <origin>jvmpi</origin> 13201 <capabilities> 13202 <required id="can_generate_compiled_method_load_events"></required> 13203 </capabilities> 13204 <parameters> 13205 <param id="klass"> 13206 <jclass method="method"/> 13207 <description> 13208 Class of the compiled method being unloaded. 13209 </description> 13210 </param> 13211 <param id="method"> 13212 <jmethodID class="klass"/> 13213 <description> 13214 Compiled method being unloaded. 13215 For identification of the compiled method only -- the class 13216 may be unloaded and therefore the method should not be used 13217 as an argument to further JNI or <jvmti/> functions. 13218 </description> 13219 </param> 13220 <param id="code_addr"> 13221 <vmbuf><void/></vmbuf> 13222 <description> 13223 Address where compiled method code was loaded. 13224 For identification of the compiled method only -- 13225 the space may have been reclaimed. 13226 </description> 13227 </param> 13228 </parameters> 13229 </event> 13230 13231 <event label="Dynamic Code Generated" phase="any" 13232 id="DynamicCodeGenerated" const="JVMTI_EVENT_DYNAMIC_CODE_GENERATED" num="70"> 13233 <description> 13234 Sent when a component of the virtual machine is generated dynamically. 13235 This does not correspond to Java programming language code that is 13236 compiled--see <eventlink id="CompiledMethodLoad"></eventlink>. 13237 This is for native code--for example, an interpreter that is generated 13238 differently depending on command-line options. 13239 <p/> 13240 Note that this event has no controlling capability. 13241 If a VM cannot generate these events, it simply does not send any. 13242 <p/> 13243 These events can be sent after their initial occurrence with 13244 <functionlink id="GenerateEvents"></functionlink>. 13245 </description> 13246 <origin>jvmpi</origin> 13247 <capabilities> 13248 </capabilities> 13249 <parameters> 13250 <param id="name"> 13251 <vmbuf><char/></vmbuf> 13252 <description> 13253 Name of the code, encoded as a 13254 <internallink id="mUTF">modified UTF-8</internallink> string. 13255 Intended for display to an end-user. 13256 The name might not be unique. 13257 </description> 13258 </param> 13259 <param id="address"> 13260 <vmbuf><void/></vmbuf> 13261 <description> 13262 Native address of the code 13263 </description> 13264 </param> 13265 <param id="length"> 13266 <jint/> 13267 <description> 13268 Length in bytes of the code 13269 </description> 13270 </param> 13271 </parameters> 13272 </event> 13273 13274 <event label="Data Dump Request" 13275 id="DataDumpRequest" const="JVMTI_EVENT_DATA_DUMP_REQUEST" num="71"> 13276 <description> 13277 Sent by the VM to request the agent to dump its data. This 13278 is just a hint and the agent need not react to this event. 13279 This is useful for processing command-line signals from users. For 13280 example, in the Java 2 SDK a CTRL-Break on Win32 and a CTRL-\ on Solaris 13281 causes the VM to send this event to the agent. 13282 </description> 13283 <origin>jvmpi</origin> 13284 <capabilities> 13285 </capabilities> 13286 <parameters> 13287 </parameters> 13288 </event> 13289 13290 <event label="Monitor Contended Enter" 13291 id="MonitorContendedEnter" const="JVMTI_EVENT_MONITOR_CONTENDED_ENTER" filtered="thread" num="75"> 13292 <description> 13293 Sent when a thread is attempting to enter a Java programming language 13294 monitor already acquired by another thread. 13295 </description> 13296 <origin>jvmpi</origin> 13297 <capabilities> 13298 <required id="can_generate_monitor_events"></required> 13299 </capabilities> 13300 <parameters> 13301 <param id="jni_env"> 13302 <outptr> 13303 <struct>JNIEnv</struct> 13304 </outptr> 13305 <description> 13306 The JNI environment of the event (current) thread 13307 </description> 13308 </param> 13309 <param id="thread"> 13310 <jthread/> 13311 <description> 13312 JNI local reference to the thread 13313 attempting to enter the monitor 13314 </description> 13315 </param> 13316 <param id="object"> 13317 <jobject/> 13318 <description> 13319 JNI local reference to the monitor 13320 </description> 13321 </param> 13322 </parameters> 13323 </event> 13324 13325 <event label="Monitor Contended Entered" 13326 id="MonitorContendedEntered" const="JVMTI_EVENT_MONITOR_CONTENDED_ENTERED" filtered="thread" num="76"> 13327 <description> 13328 Sent when a thread enters a Java programming language 13329 monitor after waiting for it to be released by another thread. 13330 </description> 13331 <origin>jvmpi</origin> 13332 <capabilities> 13333 <required id="can_generate_monitor_events"></required> 13334 </capabilities> 13335 <parameters> 13336 <param id="jni_env"> 13337 <outptr> 13338 <struct>JNIEnv</struct> 13339 </outptr> 13340 <description> 13341 The JNI environment of the event (current) thread 13342 </description> 13343 </param> 13344 <param id="thread"> 13345 <jthread/> 13346 <description> 13347 JNI local reference to the thread entering 13348 the monitor 13349 </description> 13350 </param> 13351 <param id="object"> 13352 <jobject/> 13353 <description> 13354 JNI local reference to the monitor 13355 </description> 13356 </param> 13357 </parameters> 13358 </event> 13359 13360 <event label="Monitor Wait" 13361 id="MonitorWait" const="JVMTI_EVENT_MONITOR_WAIT" filtered="thread" num="73"> 13362 <description> 13363 Sent when a thread is about to wait on an object. 13364 </description> 13365 <origin>jvmpi</origin> 13366 <capabilities> 13367 <required id="can_generate_monitor_events"></required> 13368 </capabilities> 13369 <parameters> 13370 <param id="jni_env"> 13371 <outptr> 13372 <struct>JNIEnv</struct> 13373 </outptr> 13374 <description> 13375 The JNI environment of the event (current) thread 13376 </description> 13377 </param> 13378 <param id="thread"> 13379 <jthread/> 13380 <description> 13381 JNI local reference to the thread about to wait 13382 </description> 13383 </param> 13384 <param id="object"> 13385 <jobject/> 13386 <description> 13387 JNI local reference to the monitor 13388 </description> 13389 </param> 13390 <param id="timeout"> 13391 <jlong/> 13392 <description> 13393 The number of milliseconds the thread will wait 13394 </description> 13395 </param> 13396 </parameters> 13397 </event> 13398 13399 <event label="Monitor Waited" 13400 id="MonitorWaited" const="JVMTI_EVENT_MONITOR_WAITED" filtered="thread" num="74"> 13401 <description> 13402 Sent when a thread finishes waiting on an object. 13403 </description> 13404 <origin>jvmpi</origin> 13405 <capabilities> 13406 <required id="can_generate_monitor_events"></required> 13407 </capabilities> 13408 <parameters> 13409 <param id="jni_env"> 13410 <outptr> 13411 <struct>JNIEnv</struct> 13412 </outptr> 13413 <description> 13414 The JNI environment of the event (current) thread 13415 </description> 13416 </param> 13417 <param id="thread"> 13418 <jthread/> 13419 <description> 13420 JNI local reference to the thread that was finished waiting 13421 </description> 13422 </param> 13423 <param id="object"> 13424 <jobject/> 13425 <description> 13426 JNI local reference to the monitor. 13427 </description> 13428 </param> 13429 <param id="timed_out"> 13430 <jboolean/> 13431 <description> 13432 True if the monitor timed out 13433 </description> 13434 </param> 13435 </parameters> 13436 </event> 13437 13438 <event label="Resource Exhausted" 13439 id="ResourceExhausted" const="JVMTI_EVENT_RESOURCE_EXHAUSTED" num="80" 13440 since="1.1"> 13441 <description> 13442 Sent when a VM resource needed by a running application has been exhausted. 13443 Except as required by the optional capabilities, the set of resources 13444 which report exhaustion is implementation dependent. 13445 <p/> 13446 The following bit flags define the properties of the resource exhaustion: 13447 <constants id="jvmtiResourceExhaustionFlags" 13448 label="Resource Exhaustion Flags" 13449 kind="bits" 13450 since="1.1"> 13451 <constant id="JVMTI_RESOURCE_EXHAUSTED_OOM_ERROR" num="0x0001"> 13452 After this event returns, the VM will throw a 13453 <code>java.lang.OutOfMemoryError</code>. 13454 </constant> 13455 <constant id="JVMTI_RESOURCE_EXHAUSTED_JAVA_HEAP" num="0x0002"> 13456 The VM was unable to allocate memory from the <tm>Java</tm> 13457 platform <i>heap</i>. 13458 The <i>heap</i> is the runtime 13459 data area from which memory for all class instances and 13460 arrays are allocated. 13461 </constant> 13462 <constant id="JVMTI_RESOURCE_EXHAUSTED_THREADS" num="0x0004"> 13463 The VM was unable to create a thread. 13464 </constant> 13465 </constants> 13466 </description> 13467 <origin>new</origin> 13468 <capabilities> 13469 <capability id="can_generate_resource_exhaustion_heap_events"> 13470 Can generate events when the VM is unable to allocate memory from the 13471 <internallink id="JVMTI_RESOURCE_EXHAUSTED_JAVA_HEAP">heap</internallink>. 13472 </capability> 13473 <capability id="can_generate_resource_exhaustion_threads_events"> 13474 Can generate events when the VM is unable to 13475 <internallink id="JVMTI_RESOURCE_EXHAUSTED_THREADS">create 13476 a thread</internallink>. 13477 </capability> 13478 </capabilities> 13479 <parameters> 13480 <param id="jni_env"> 13481 <outptr> 13482 <struct>JNIEnv</struct> 13483 </outptr> 13484 <description> 13485 The JNI environment of the event (current) thread 13486 </description> 13487 </param> 13488 <param id="flags"> 13489 <jint/> 13490 <description> 13491 Flags defining the properties of the of resource exhaustion 13492 as specified by the 13493 <internallink id="jvmtiResourceExhaustionFlags">Resource 13494 Exhaustion Flags</internallink>. 13495 </description> 13496 </param> 13497 <param id="reserved"> 13498 <vmbuf><void/></vmbuf> 13499 <description> 13500 Reserved. 13501 </description> 13502 </param> 13503 <param id="description"> 13504 <vmbuf><char/></vmbuf> 13505 <description> 13506 Description of the resource exhaustion, encoded as a 13507 <internallink id="mUTF">modified UTF-8</internallink> string. 13508 </description> 13509 </param> 13510 </parameters> 13511 </event> 13512 13513 <event label="VM Object Allocation" 13514 id="VMObjectAlloc" const="JVMTI_EVENT_VM_OBJECT_ALLOC" num="84"> 13515 <description> 13516 Sent when a method causes the virtual machine to directly allocate an 13517 Object visible to Java programming language code. 13518 Generally object allocation should be detected by instrumenting 13519 the bytecodes of allocating methods. 13520 Object allocation generated in native code by JNI function 13521 calls should be detected using 13522 <internallink id="jniIntercept">JNI function interception</internallink>. 13523 Some methods might not have associated bytecodes and are not 13524 native methods, they instead are executed directly by the 13525 VM. These methods should send this event. 13526 Virtual machines which are incapable of bytecode instrumentation 13527 for some or all of their methods can send this event. 13528 13529 Note that the <internallink 13530 id="SampledObjectAlloc">SampledObjectAlloc</internallink> 13531 event is triggered on all Java object allocations, including those 13532 caused by bytecode method execution, JNI method execution, and 13533 directly by VM methods. 13534 <p/> 13535 Typical examples where this event might be sent: 13536 <ul> 13537 <li>Reflection -- for example, <code>java.lang.Class.newInstance()</code></li> 13538 <li>Methods not represented by bytecodes -- for example, VM intrinsics and 13539 J2ME preloaded classes</li> 13540 </ul> 13541 Cases where this event would not be generated: 13542 <ul> 13543 <li>Allocation due to bytecodes -- for example, the <code>new</code> 13544 and <code>newarray</code> VM instructions</li> 13545 <li>Allocation due to JNI function calls -- for example, 13546 <code>AllocObject</code></li> 13547 <li>Allocations during VM initialization</li> 13548 <li>VM internal objects</li> 13549 </ul> 13550 </description> 13551 <origin>new</origin> 13552 <capabilities> 13553 <required id="can_generate_vm_object_alloc_events"></required> 13554 </capabilities> 13555 <parameters> 13556 <param id="jni_env"> 13557 <outptr> 13558 <struct>JNIEnv</struct> 13559 </outptr> 13560 <description> 13561 The JNI environment of the event (current) thread 13562 </description> 13563 </param> 13564 <param id="thread"> 13565 <jthread/> 13566 <description> 13567 Thread allocating the object. 13568 </description> 13569 </param> 13570 <param id="object"> 13571 <jobject/> 13572 <description> 13573 JNI local reference to the object that was allocated. 13574 </description> 13575 </param> 13576 <param id="object_klass"> 13577 <jclass/> 13578 <description> 13579 JNI local reference to the class of the object. 13580 </description> 13581 </param> 13582 <param id="size"> 13583 <jlong/> 13584 <description> 13585 Size of the object (in bytes). See <functionlink id="GetObjectSize"/>. 13586 </description> 13587 </param> 13588 </parameters> 13589 </event> 13590 13591 <event label="Sampled Object Allocation" 13592 id="SampledObjectAlloc" const="JVMTI_EVENT_SAMPLED_OBJECT_ALLOC" filtered="thread" num="86" since="11"> 13593 <description> 13594 Sent when an allocated object is sampled. 13595 By default, the sampling interval is set to 512KB. The sampling is semi-random to avoid 13596 pattern-based bias and provides an approximate overall average interval over long periods of 13597 sampling. 13598 <p/> 13599 Each thread tracks how many bytes it has allocated since it sent the last event. 13600 When the number of bytes exceeds the sampling interval, it will send another event. 13601 This implies that, on average, one object will be sampled every time a thread has 13602 allocated 512KB bytes since the last sample. 13603 <p/> 13604 Note that the sampler is pseudo-random: it will not sample every 512KB precisely. 13605 The goal of this is to ensure high quality sampling even if allocation is 13606 happening in a fixed pattern (i.e., the same set of objects are being allocated 13607 every 512KB). 13608 <p/> 13609 If another sampling interval is required, the user can call 13610 <functionlink id="SetHeapSamplingInterval"></functionlink> with a strictly positive integer value, 13611 representing the new sampling interval. 13612 <p/> 13613 This event is sent once the sampled allocation has been performed. It provides the object, stack trace 13614 of the allocation, the thread allocating, the size of allocation, and the object's class. 13615 <p/> 13616 A typical use case of this system is to determine where heap allocations originate. 13617 In conjunction with weak references and the function 13618 <functionlink id="GetStackTrace"></functionlink>, a user can track which objects were allocated from which 13619 stack trace, and which are still live during the execution of the program. 13620 </description> 13621 <origin>new</origin> 13622 <capabilities> 13623 <required id="can_generate_sampled_object_alloc_events"></required> 13624 </capabilities> 13625 <parameters> 13626 <param id="jni_env"> 13627 <outptr> 13628 <struct>JNIEnv</struct> 13629 </outptr> 13630 <description> 13631 The JNI environment of the event (current) thread. 13632 </description> 13633 </param> 13634 <param id="thread"> 13635 <jthread/> 13636 <description> 13637 Thread allocating the object. 13638 </description> 13639 </param> 13640 <param id="object"> 13641 <jobject/> 13642 <description> 13643 JNI local reference to the object that was allocated. 13644 </description> 13645 </param> 13646 <param id="object_klass"> 13647 <jclass/> 13648 <description> 13649 JNI local reference to the class of the object 13650 </description> 13651 </param> 13652 <param id="size"> 13653 <jlong/> 13654 <description> 13655 Size of the object (in bytes). See <functionlink id="GetObjectSize"/>. 13656 </description> 13657 </param> 13658 </parameters> 13659 </event> 13660 13661 <event label="Object Free" 13662 id="ObjectFree" const="JVMTI_EVENT_OBJECT_FREE" num="83"> 13663 <description> 13664 An Object Free event is sent when the garbage collector frees an object. 13665 Events are only sent for tagged objects--see 13666 <internallink id="Heap">heap functions</internallink>. 13667 <p/> 13668 The event handler must not use JNI functions and 13669 must not use <jvmti/> functions except those which 13670 specifically allow such use (see the raw monitor, memory management, 13671 and environment local storage functions). 13672 </description> 13673 <origin>new</origin> 13674 <capabilities> 13675 <required id="can_generate_object_free_events"></required> 13676 </capabilities> 13677 <parameters> 13678 <param id="tag"> 13679 <jlong/> 13680 <description> 13681 The freed object's tag 13682 </description> 13683 </param> 13684 </parameters> 13685 </event> 13686 13687 <event label="Garbage Collection Start" 13688 id="GarbageCollectionStart" const="JVMTI_EVENT_GARBAGE_COLLECTION_START" num="81"> 13689 <description> 13690 A Garbage Collection Start event is sent when a 13691 garbage collection pause begins. 13692 Only stop-the-world collections are reported--that is, collections during 13693 which all threads cease to modify the state of the Java virtual machine. 13694 This means that some collectors will never generate these events. 13695 This event is sent while the VM is still stopped, thus 13696 the event handler must not use JNI functions and 13697 must not use <jvmti/> functions except those which 13698 specifically allow such use (see the raw monitor, memory management, 13699 and environment local storage functions). 13700 <p/> 13701 This event is always sent as a matched pair with 13702 <eventlink id="GarbageCollectionFinish"/> 13703 (assuming both events are enabled) and no garbage collection 13704 events will occur between them. 13705 </description> 13706 <origin>new</origin> 13707 <capabilities> 13708 <required id="can_generate_garbage_collection_events"></required> 13709 </capabilities> 13710 <parameters> 13711 </parameters> 13712 </event> 13713 13714 <event label="Garbage Collection Finish" 13715 id="GarbageCollectionFinish" const="JVMTI_EVENT_GARBAGE_COLLECTION_FINISH" num="82"> 13716 <description> 13717 A Garbage Collection Finish event is sent when a 13718 garbage collection pause ends. 13719 This event is sent while the VM is still stopped, thus 13720 the event handler must not use JNI functions and 13721 must not use <jvmti/> functions except those which 13722 specifically allow such use (see the raw monitor, memory management, 13723 and environment local storage functions). 13724 <p/> 13725 Some agents may need to do post garbage collection operations that 13726 require the use of the disallowed <jvmti/> or JNI functions. For these 13727 cases an agent thread can be created which waits on a raw monitor, 13728 and the handler for the Garbage Collection Finish event simply 13729 notifies the raw monitor 13730 <p/> 13731 This event is always sent as a matched pair with 13732 <eventlink id="GarbageCollectionStart"/> (assuming both events are enabled). 13733 <issue> 13734 The most important use of this event is to provide timing information, 13735 and thus additional information is not required. However, 13736 information about the collection which is "free" should be included - 13737 what that information is needs to be determined. 13738 </issue> 13739 </description> 13740 <origin>new</origin> 13741 <capabilities> 13742 <required id="can_generate_garbage_collection_events"></required> 13743 </capabilities> 13744 <parameters> 13745 </parameters> 13746 </event> 13747 13748 <elide> 13749 <event label="Verbose Output" phase="any" 13750 id="VerboseOutput" const="JVMTI_EVENT_VERBOSE_OUTPUT" num="85"> 13751 <description> 13752 Send verbose messages as strings. 13753 <issue> 13754 This format is extremely fragile, as it can change with each 13755 platform, collector and version. Alternatives include: 13756 <ul> 13757 <li>building off Java programming language M and M APIs</li> 13758 <li>XML</li> 13759 <li>key/value pairs</li> 13760 <li>removing it</li> 13761 </ul> 13762 </issue> 13763 <issue> 13764 Though this seemed trivial to implement. 13765 In the RI it appears this will be quite complex. 13766 </issue> 13767 </description> 13768 <origin>new</origin> 13769 <capabilities> 13770 </capabilities> 13771 <parameters> 13772 <param id="flag"> 13773 <enum>jvmtiVerboseFlag</enum> 13774 <description> 13775 Which verbose output is being sent. 13776 </description> 13777 </param> 13778 <param id="message"> 13779 <vmbuf><char/></vmbuf> 13780 <description> 13781 Message text, encoded as a 13782 <internallink id="mUTF">modified UTF-8</internallink> string. 13783 </description> 13784 </param> 13785 </parameters> 13786 </event> 13787 </elide> 13788 13789</eventsection> 13790 13791<datasection> 13792 <intro> 13793 <jvmti/> extends the data types defined by JNI. 13794 </intro> 13795 <basetypes id="jniTypes" label="JNI Types Used in the JVM Tool Interface"> 13796 <basetype id="jboolean"> 13797 <description> 13798 Holds a Java programming language <code>boolean</code>. 13799 Unsigned 8 bits. 13800 </description> 13801 </basetype> 13802 <basetype id="jchar"> 13803 <description> 13804 Holds a Java programming language <code>char</code>. 13805 Unsigned 16 bits. 13806 </description> 13807 </basetype> 13808 <basetype id="jint"> 13809 <description> 13810 Holds a Java programming language <code>int</code>. 13811 Signed 32 bits. 13812 </description> 13813 </basetype> 13814 <basetype id="jlong"> 13815 <description> 13816 Holds a Java programming language <code>long</code>. 13817 Signed 64 bits. 13818 </description> 13819 </basetype> 13820 <basetype id="jfloat"> 13821 <description> 13822 Holds a Java programming language <code>float</code>. 13823 32 bits. 13824 </description> 13825 </basetype> 13826 <basetype id="jdouble"> 13827 <description> 13828 Holds a Java programming language <code>double</code>. 13829 64 bits. 13830 </description> 13831 </basetype> 13832 <basetype id="jobject"> 13833 <description> 13834 Holds a Java programming language object. 13835 </description> 13836 </basetype> 13837 <basetype id="jclass"> 13838 <description> 13839 Holds a Java programming language class. 13840 </description> 13841 </basetype> 13842 <basetype id="jvalue"> 13843 <description> 13844 Is a union of all primitive types and <code>jobject</code>. Thus, holds any Java 13845 programming language value. 13846 </description> 13847 </basetype> 13848 <basetype id="jfieldID"> 13849 <description> 13850 Identifies a Java programming language field. 13851 <code>jfieldID</code>s returned by <jvmti/> functions and events may be 13852 safely stored. 13853 </description> 13854 </basetype> 13855 <basetype id="jmethodID"> 13856 <description> 13857 Identifies a Java programming language method, initializer, or constructor. 13858 <code>jmethodID</code>s returned by <jvmti/> functions and events may be 13859 safely stored. However, if the class is unloaded, they become invalid 13860 and must not be used. 13861 </description> 13862 </basetype> 13863 <basetype id="JNIEnv"> 13864 <description> 13865 Pointer to the JNI function table. Pointer to this (<code>JNIEnv *</code>) 13866 is a JNI environment. 13867 </description> 13868 </basetype> 13869 </basetypes> 13870 13871 <basetypes id="jvmtiTypes" label="JVM Tool Interface Base Types"> 13872 <basetype id="jvmtiEnv"> 13873 <description> 13874 The <jvmti/> <internallink id="environments">environment</internallink> pointer. 13875 See the <internallink id="FunctionSection">Function Section</internallink>. 13876 <code>jvmtiEnv</code> points to the 13877 <internallink id="FunctionTable">function table</internallink> pointer. 13878 </description> 13879 </basetype> 13880 <basetype id="jthread"> 13881 <definition>typedef jobject jthread;</definition> 13882 <description> 13883 Subtype of <datalink id="jobject"></datalink> that holds a thread. 13884 </description> 13885 </basetype> 13886 <basetype id="jthreadGroup"> 13887 <definition>typedef jobject jthreadGroup;</definition> 13888 <description> 13889 Subtype of <datalink id="jobject"></datalink> that holds a thread group. 13890 </description> 13891 </basetype> 13892 <basetype id="jlocation"> 13893 <definition>typedef jlong jlocation;</definition> 13894 <description> 13895 A 64 bit value, representing a monotonically increasing 13896 executable position within a method. 13897 <code>-1</code> indicates a native method. 13898 See <functionlink id="GetJLocationFormat"></functionlink> for the format on a 13899 given VM. 13900 </description> 13901 </basetype> 13902 <basetype id="jrawMonitorID"> 13903 <definition>struct _jrawMonitorID; 13904typedef struct _jrawMonitorID *jrawMonitorID;</definition> 13905 <description> 13906 A raw monitor. 13907 </description> 13908 </basetype> 13909 <basetype id="jvmtiError"> 13910 <description> 13911 Holds an error return code. 13912 See the <internallink id="ErrorSection">Error section</internallink> for possible values. 13913 <example> 13914typedef enum { 13915 JVMTI_ERROR_NONE = 0, 13916 JVMTI_ERROR_INVALID_THREAD = 10, 13917 ... 13918} jvmtiError; 13919</example> 13920 </description> 13921 </basetype> 13922 <basetype id="jvmtiEvent"> 13923 <description> 13924 An identifier for an event type. 13925 See the <internallink id="EventSection">Event section</internallink> for possible values. 13926 It is guaranteed that future versions of this specification will 13927 never assign zero as an event type identifier. 13928<example> 13929typedef enum { 13930 JVMTI_EVENT_SINGLE_STEP = 1, 13931 JVMTI_EVENT_BREAKPOINT = 2, 13932 ... 13933} jvmtiEvent; 13934</example> 13935 </description> 13936 </basetype> 13937 <basetype id="jvmtiEventCallbacks" name="eventCallbacks"> 13938 <description> 13939 The callbacks used for events. 13940<example> 13941typedef struct { 13942 jvmtiEventVMInit VMInit; 13943 jvmtiEventVMDeath VMDeath; 13944 ... 13945} jvmtiEventCallbacks; 13946</example> 13947 See <internallink id="jvmtiEventCallbacks">event callbacks</internallink> 13948 for the complete structure. 13949 <p/> 13950 Where, for example, the VM initialization callback is defined: 13951<example> 13952typedef void (JNICALL *jvmtiEventVMInit) 13953 (jvmtiEnv *jvmti_env, 13954 JNIEnv* jni_env, 13955 jthread thread); 13956</example> 13957 See the individual events for the callback function definition. 13958 </description> 13959 </basetype> 13960 <basetype id="jniNativeInterface"> 13961 <definition>typedef struct JNINativeInterface_ jniNativeInterface;</definition> 13962 <description> 13963 Typedef for the JNI function table <code>JNINativeInterface</code> 13964 defined in the 13965 <externallink id="jni/functions.html#interface-function-table"> 13966 JNI Specification</externallink>. 13967 The JNI reference implementation defines this with an underscore. 13968 </description> 13969 </basetype> 13970 </basetypes> 13971 13972</datasection> 13973 13974<issuessection label="Issues"> 13975 <intro id="suspendRequired" label="Resolved Issue: Suspend - Required or Automatic"> 13976 JVMDI requires that the agent suspend threads before calling 13977 certain sensitive functions. JVMPI requires garbage collection to be 13978 disabled before calling certain sensitive functions. 13979 It was suggested that rather than have this requirement, that 13980 VM place itself in a suitable state before performing an 13981 operation. This makes considerable sense since each VM 13982 knows its requirements and can most easily arrange a 13983 safe state. 13984 <p/> 13985 The ability to externally suspend/resume threads will, of 13986 course, remain. The ability to enable/disable garbage collection will not. 13987 <p/> 13988 This issue is resolved--suspend will not 13989 be required. The spec has been updated to reflect this. 13990 </intro> 13991 13992 <intro id="stackSampling" label="Resolved Issue: Call Stack Sampling"> 13993 There are a variety of approaches to sampling call stacks. 13994 The biggest bifurcation is between VM controlled and agent 13995 controlled. 13996 <p/> 13997 This issue is resolved--agent controlled 13998 sampling will be the approach. 13999 </intro> 14000 14001 <intro id="threadRepresentation" label="Resolved Issue: Thread Representation"> 14002 JVMDI represents threads as jthread. JVMPI primarily 14003 uses JNIEnv* to represent threads. 14004 <p/> 14005 The Expert Group has chosen jthread as the representation 14006 for threads in <jvmti/>. 14007 JNIEnv* is sent by 14008 events since it is needed to JNI functions. JNIEnv, per the 14009 JNI spec, are not supposed to be used outside their thread. 14010 </intro> 14011 14012 <intro id="design" label="Resolved Issue: Method Representation"> 14013 The JNI spec allows an implementation to depend on jclass/jmethodID 14014 pairs, rather than simply a jmethodID, to reference a method. 14015 JVMDI, for consistency, choose the same representation. 14016 JVMPI, however, specifies that a jmethodID alone maps to a 14017 method. Both of the Sun <tm>J2SE</tm> virtual machines (Classic and <tm>HotSpot</tm>) store 14018 pointers in jmethodIDs, and as a result, a jmethodID is sufficient. 14019 In fact, any JVM implementation that supports JVMPI must have 14020 such a representation. 14021 <jvmti/> will use jmethodID as a unique representation of a method 14022 (no jclass is used). 14023 There should be efficiency gains, particularly in 14024 functionality like stack dumping, to this representation. 14025 <p/> 14026 Note that fields were not used in JVMPI and that the access profile 14027 of fields differs from methods--for implementation efficiency 14028 reasons, a jclass/jfieldID pair will still be needed for field 14029 reference. 14030 </intro> 14031 14032 <intro id="localReferenceIssue" label="Resolved Issue: Local References"> 14033 Functions return local references. 14034 </intro> 14035 14036 <intro id="frameRep" label="Resolved Issue: Representation of frames"> 14037 In JVMDI, a frame ID is used to represent a frame. Problem with this 14038 is that a VM must track when a frame becomes invalid, a far better 14039 approach, and the one used in <jvmti/>, is to reference frames by depth. 14040 </intro> 14041 14042 <intro id="requiredCapabilities" label="Issue: Required Capabilities"> 14043 Currently, having a required capabilities means that the functionality 14044 is optional. Capabilities are useful even for required functionality 14045 since they can inform the VM is needed set-up. Thus, there should be 14046 a set of capabilities that a conformant implementation must provide 14047 (if requested during Agent_OnLoad). 14048 </intro> 14049 14050 <intro id="taghint" label="Proposal: add tag hint function"> 14051 A hint of the percentage of objects that will be tagged would 14052 help the VM pick a good implementation. 14053 </intro> 14054 14055 <intro id="moreMonitorQueries" label="Request: More Monitor Quires"> 14056 How difficult or easy would be to extend the monitor_info category to include 14057 <pre> 14058 - current number of monitors 14059 - enumeration of monitors 14060 - enumeration of threads waiting on a given monitor 14061 </pre> 14062 The reason for my question is the fact that current get_monitor_info support 14063 requires the agent to specify a given thread to get the info which is probably 14064 OK in the profiling/debugging space, while in the monitoring space the agent 14065 could be watching the monitor list and then decide which thread to ask for 14066 the info. You might ask why is this important for monitoring .... I think it 14067 can aid in the detection/prediction of application contention caused by hot-locks. 14068 </intro> 14069</issuessection> 14070 14071<changehistory id="ChangeHistory" update="09/05/07"> 14072 <intro> 14073 The <jvmti/> specification is an evolving document with major, minor, 14074 and micro version numbers. 14075 A released version of the specification is uniquely identified 14076 by its major and minor version. 14077 The functions, events, and capabilities in this specification 14078 indicate a "Since" value which is the major and minor version in 14079 which it was introduced. 14080 The version of the specification implemented by the VM can 14081 be retrieved at runtime with the <functionlink id="GetVersionNumber"/> 14082 function. 14083 </intro> 14084 <change date="14 Nov 2002"> 14085 Converted to XML document. 14086 </change> 14087 <change date="14 Nov 2002"> 14088 Elided heap dump functions (for now) since what was there 14089 was wrong. 14090 </change> 14091 <change date="18 Nov 2002"> 14092 Added detail throughout. 14093 </change> 14094 <change date="18 Nov 2002"> 14095 Changed JVMTI_THREAD_STATUS_RUNNING to JVMTI_THREAD_STATUS_RUNNABLE. 14096 </change> 14097 <change date="19 Nov 2002"> 14098 Added AsyncGetStackTrace. 14099 </change> 14100 <change date="19 Nov 2002"> 14101 Added jframeID return to GetStackTrace. 14102 </change> 14103 <change date="19 Nov 2002"> 14104 Elided GetCurrentFrame and GetCallingFrame functions (for now) since what was there 14105 since they are redundant with GetStackTrace. 14106 </change> 14107 <change date="19 Nov 2002"> 14108 Elided ClearAllBreakpoints since it has always been redundant. 14109 </change> 14110 <change date="19 Nov 2002"> 14111 Added GetSystemProperties. 14112 </change> 14113 <change date="19 Nov 2002"> 14114 Changed the thread local storage functions to use jthread. 14115 </change> 14116 <change date="20 Nov 2002"> 14117 Added GetJLocationFormat. 14118 </change> 14119 <change date="22 Nov 2002"> 14120 Added events and introductory text. 14121 </change> 14122 <change date="22 Nov 2002"> 14123 Cross reference type and constant definitions. 14124 </change> 14125 <change date="24 Nov 2002"> 14126 Added DTD. 14127 </change> 14128 <change date="24 Nov 2002"> 14129 Added capabilities function section. 14130 </change> 14131 <change date="29 Nov 2002"> 14132 Assign capabilities to each function and event. 14133 </change> 14134 <change date="29 Nov 2002"> 14135 Add <internallink id="jniIntercept">JNI interception functions</internallink>. 14136 </change> 14137 <change date="30 Nov 2002"> 14138 Auto generate SetEventNotificationMode capabilities. 14139 </change> 14140 <change date="30 Nov 2002"> 14141 Add <eventlink id="VMObjectAlloc"></eventlink> event. 14142 </change> 14143 <change date="30 Nov 2002"> 14144 Add <eventlink id="DynamicCodeGenerated"></eventlink> event. 14145 </change> 14146 <change date="30 Nov 2002"> 14147 Add const to declarations. 14148 </change> 14149 <change date="30 Nov 2002"> 14150 Change method exit and frame pop to send on exception. 14151 </change> 14152 <change date="1 Dec 2002"> 14153 Add ForceGarbageCollection. 14154 </change> 14155 <change date="2 Dec 2002"> 14156 Redo Xrun section; clarify GetStackTrace and add example; 14157 Fix width problems; use "agent" consistently. 14158 </change> 14159 <change date="8 Dec 2002"> 14160 Remove previous start-up intro. 14161 Add <internallink id="environments"><jvmti/> Environments</internallink> 14162 section. 14163 </change> 14164 <change date="8 Dec 2002"> 14165 Add <functionlink id="DisposeEnvironment"></functionlink>. 14166 </change> 14167 <change date="9 Dec 2002"> 14168 Numerous minor updates. 14169 </change> 14170 <change date="15 Dec 2002"> 14171 Add heap profiling functions added: 14172 get/set annotation, iterate live objects/heap. 14173 Add heap profiling functions place holder added: 14174 heap roots. 14175 Heap profiling event added: object free. 14176 Heap profiling event redesigned: vm object allocation. 14177 Heap profiling event placeholders added: garbage collection start/finish. 14178 Native method bind event added. 14179 </change> 14180 <change date="19 Dec 2002"> 14181 Revamp suspend/resume functions. 14182 Add origin information with jvmdi tag. 14183 Misc fixes. 14184 </change> 14185 <change date="24 Dec 2002"> 14186 Add semantics to types. 14187 </change> 14188 <change date="27 Dec 2002"> 14189 Add local reference section. 14190 Autogenerate parameter descriptions from types. 14191 </change> 14192 <change date="28 Dec 2002"> 14193 Document that RunAgentThread sends threadStart. 14194 </change> 14195 <change date="29 Dec 2002"> 14196 Remove redundant local ref and dealloc warning. 14197 Convert GetRawMonitorName to allocated buffer. 14198 Add GenerateEvents. 14199 </change> 14200 <change date="30 Dec 2002"> 14201 Make raw monitors a type and rename to "jrawMonitorID". 14202 </change> 14203 <change date="1 Jan 2003"> 14204 Include origin information. 14205 Clean-up JVMDI issue references. 14206 Remove Deallocate warnings which are now automatically generated. 14207 </change> 14208 <change date="2 Jan 2003"> 14209 Fix representation issues for jthread. 14210 </change> 14211 <change date="3 Jan 2003"> 14212 Make capabilities buffered out to 64 bits - and do it automatically. 14213 </change> 14214 <change date="4 Jan 2003"> 14215 Make constants which are enumeration into enum types. 14216 Parameters now of enum type. 14217 Clean-up and index type section. 14218 Replace remaining datadef entities with callback. 14219 </change> 14220 <change date="7 Jan 2003"> 14221 Correct GenerateEvents description. 14222 More internal semantics work. 14223 </change> 14224 <change date="9 Jan 2003"> 14225 Replace previous GetSystemProperties with two functions 14226 which use allocated information instead fixed. 14227 Add SetSystemProperty. 14228 More internal semantics work. 14229 </change> 14230 <change date="12 Jan 2003"> 14231 Add varargs to end of SetEventNotificationMode. 14232 </change> 14233 <change date="20 Jan 2003"> 14234 Finish fixing spec to reflect that alloc sizes are jlong. 14235 </change> 14236 <change date="22 Jan 2003"> 14237 Allow NULL as RunAgentThread arg. 14238 </change> 14239 <change date="22 Jan 2003"> 14240 Fixed names to standardized naming convention 14241 Removed AsyncGetStackTrace. 14242 </change> 14243 <change date="29 Jan 2003"> 14244 Since we are using jthread, removed GetThread. 14245 </change> 14246 <change date="31 Jan 2003"> 14247 Change GetFieldName to allow NULLs like GetMethodName. 14248 </change> 14249 <change date="29 Feb 2003" version="v40"> 14250 Rewrite the introductory text, adding sections on 14251 start-up, environments and bytecode instrumentation. 14252 Change the command line arguments per EG discussions. 14253 Add an introduction to the capabilities section. 14254 Add the extension mechanism category and functions. 14255 Mark for deletion, but clarified anyhow, SuspendAllThreads. 14256 Rename IterateOverLiveObjects to IterateOverReachableObjects and 14257 change the text accordingly. 14258 Clarify IterateOverHeap. 14259 Clarify CompiledMethodLoad. 14260 Discuss prerequisite state for Calling Functions. 14261 Clarify SetAllocationHooks. 14262 Added issues ("To be resolved:") through-out. 14263 And so on... 14264 </change> 14265 <change date="6 Mar 2003" version="v41"> 14266 Remove struct from the call to GetOwnedMonitorInfo. 14267 Automatically generate most error documentation, remove 14268 (rather broken) hand written error doc. 14269 Better describe capability use (empty initial set). 14270 Add min value to jint params. 14271 Remove the capability can_access_thread_local_storage. 14272 Rename error JVMTI_ERROR_NOT_IMPLEMENTED to JVMTI_ERROR_MUST_POSSESS_CAPABILITY; 14273 same for *NOT_IMPLEMENTED. 14274 Description fixes. 14275 </change> 14276 <change date="8 Mar 2003" version="v42"> 14277 Rename GetClassSignature to GetClassName. 14278 Rename IterateOverClassObjects to IterateOverInstancesOfClass. 14279 Remove GetMaxStack (operand stack isn't used in <jvmti/>). 14280 Description fixes: define launch-time, remove native frame pop 14281 from PopFrame, and assorted clarifications. 14282 </change> 14283 <change date="8 Mar 2003" version="v43"> 14284 Fix minor editing problem. 14285 </change> 14286 <change date="10 Mar 2003" version="v44"> 14287 Add phase information. 14288 Remap (compact) event numbers. 14289 </change> 14290 <change date="11 Mar 2003" version="v45"> 14291 More phase information - allow "any". 14292 Elide raw monitor queries and events. 14293 Minor description fixes. 14294 </change> 14295 <change date="12 Mar 2003" version="v46"> 14296 Add GetPhase. 14297 Use "phase" through document. 14298 Elide GetRawMonitorName. 14299 Elide GetObjectMonitors. 14300 </change> 14301 <change date="12 Mar 2003" version="v47"> 14302 Fixes from link, XML, and spell checking. 14303 Auto-generate the callback structure. 14304 </change> 14305 <change date="13 Mar 2003" version="v48"> 14306 One character XML fix. 14307 </change> 14308 <change date="13 Mar 2003" version="v49"> 14309 Change function parameter names to be consistent with 14310 event parameters (fooBarBaz becomes foo_bar_baz). 14311 </change> 14312 <change date="14 Mar 2003" version="v50"> 14313 Fix broken link. Fix thread markers. 14314 </change> 14315 <change date="14 Mar 2003" version="v51"> 14316 Change constants so they are under 128 to workaround 14317 compiler problems. 14318 </change> 14319 <change date="23 Mar 2003" version="v52"> 14320 Overhaul capabilities. Separate GetStackTrace into 14321 GetStackTrace and GetStackFrames. 14322 </change> 14323 <change date="8 Apr 2003" version="v54"> 14324 Use depth instead of jframeID to reference frames. 14325 Remove the now irrelevant GetCurrentFrame, GetCallerFrame and GetStackFrames. 14326 Remove frame arg from events. 14327 </change> 14328 <change date="9 Apr 2003" version="v55"> 14329 Remove GetObjectWithAnnotation since tests show bufferred approach more efficient. 14330 Add missing annotation_count to GetObjectsWithAnnotations 14331 </change> 14332 <change date="10 Apr 2003" version="v56"> 14333 Remove confusing parenthetical statement in GetObjectsWithAnnotations 14334 </change> 14335 <change date="13 Apr 2003" version="v58"> 14336 Replace jclass/jmethodID representation of method with simply jmethodID; 14337 Pass JvmtiEnv* as first arg of every event; remove JNIEnv* where inappropriate. 14338 Replace can_access_frames with can_access_local_variables; remove from purely stack access. 14339 Use can_get_synthetic_attribute; fix description. 14340 Clarify that zero length arrays must be deallocated. 14341 Clarify RelinquishCapabilities. 14342 Generalize JVMTI_ERROR_VM_DEAD to JVMTI_ERROR_WRONG_PHASE. 14343 </change> 14344 <change date="27 Apr 2003" version="v59"> 14345 Remove lingering indirect references to OBSOLETE_METHOD_ID. 14346 </change> 14347 <change date="4 May 2003" version="v60"> 14348 Allow DestroyRawMonitor during OnLoad. 14349 </change> 14350 <change date="7 May 2003" version="v61"> 14351 Added not monitor owner error return to DestroyRawMonitor. 14352 </change> 14353 <change date="13 May 2003" version="v62"> 14354 Clarify semantics of raw monitors. 14355 Change flags on <code>GetThreadStatus</code>. 14356 <code>GetClassLoader</code> return NULL for the bootstrap class loader. 14357 Add <code>GetClassName</code> issue. 14358 Define local variable signature. 14359 Disallow zero in annotations array of <code>GetObjectsWithAnnotations</code>. 14360 Remove over specification in <code>GetObjectsWithAnnotations</code>. 14361 Elide <code>SetAllocationHooks</code>. 14362 Elide <code>SuspendAllThreads</code>. 14363 </change> 14364 <change date="14 May 2003" version="v63"> 14365 Define the data type <code>jvmtiEventCallbacks</code>. 14366 Zero length allocations return NULL. 14367 Keep SetAllocationHooks in JVMDI, but remove from <jvmti/>. 14368 Add JVMTI_THREAD_STATUS_FLAG_INTERRUPTED. 14369 </change> 14370 <change date="15 May 2003" version="v64"> 14371 Better wording, per review. 14372 </change> 14373 <change date="15 May 2003" version="v65"> 14374 First Alpha. 14375 Make jmethodID and jfieldID unique, jclass not used. 14376 </change> 14377 <change date="27 May 2003" version="v66"> 14378 Fix minor XSLT errors. 14379 </change> 14380 <change date="13 June 2003" version="v67"> 14381 Undo making jfieldID unique (jmethodID still is). 14382 </change> 14383 <change date="17 June 2003" version="v68"> 14384 Changes per June 11th Expert Group meeting -- 14385 Overhaul Heap functionality: single callback, 14386 remove GetHeapRoots, add reachable iterators, 14387 and rename "annotation" to "tag". 14388 NULL thread parameter on most functions is current 14389 thread. 14390 Add timers. 14391 Remove ForceExit. 14392 Add GetEnvironmentLocalStorage. 14393 Add verbose flag and event. 14394 Add AddToBootstrapClassLoaderSearch. 14395 Update ClassFileLoadHook. 14396 </change> 14397 <change date="18 June 2003" version="v69"> 14398 Clean up issues sections. 14399 Rename GetClassName back to GetClassSignature and 14400 fix description. 14401 Add generic signature to GetClassSignature, 14402 GetFieldSignature, GetMethodSignature, and 14403 GetLocalVariableTable. 14404 Elide EstimateCostOfCapabilities. 14405 Clarify that the system property functions operate 14406 on the VM view of system properties. 14407 Clarify Agent_OnLoad. 14408 Remove "const" from JNIEnv* in events. 14409 Add metadata accessors. 14410 </change> 14411 <change date="18 June 2003" version="v70"> 14412 Add start_depth to GetStackTrace. 14413 Move system properties to a new category. 14414 Add GetObjectSize. 14415 Remove "X" from command line flags. 14416 XML, HTML, and spell check corrections. 14417 </change> 14418 <change date="19 June 2003" version="v71"> 14419 Fix JVMTI_HEAP_ROOT_THREAD to be 6. 14420 Make each synopsis match the function name. 14421 Fix unclear wording. 14422 </change> 14423 <change date="26 June 2003" version="v72"> 14424 SetThreadLocalStorage and SetEnvironmentLocalStorage should allow value 14425 to be set to NULL. 14426 NotifyFramePop, GetFrameLocationm and all the local variable operations 14427 needed to have their wording about frames fixed. 14428 Grammar and clarity need to be fixed throughout. 14429 Capitalization and puntuation need to be consistent. 14430 Need micro version number and masks for accessing major, minor, and micro. 14431 The error code lists should indicate which must be returned by 14432 an implementation. 14433 The command line properties should be visible in the properties functions. 14434 Disallow popping from the current thread. 14435 Allow implementations to return opaque frame error when they cannot pop. 14436 The NativeMethodBind event should be sent during any phase. 14437 The DynamicCodeGenerated event should be sent during any phase. 14438 The following functions should be allowed to operate before VMInit: 14439 Set/GetEnvironmentLocalStorage 14440 GetMethodDeclaringClass 14441 GetClassSignature 14442 GetClassModifiers 14443 IsInterface 14444 IsArrayClass 14445 GetMethodName 14446 GetMethodModifiers 14447 GetMaxLocals 14448 GetArgumentsSize 14449 GetLineNumberTable 14450 GetMethodLocation 14451 IsMethodNative 14452 IsMethodSynthetic. 14453 Other changes (to XSL): 14454 Argument description should show asterisk after not before pointers. 14455 NotifyFramePop, GetFrameLocationm and all the local variable operations 14456 should hsve the NO_MORE_FRAMES error added. 14457 Not alive threads should have a different error return than invalid thread. 14458 </change> 14459 <change date="7 July 2003" version="v73"> 14460 VerboseOutput event was missing message parameter. 14461 Minor fix-ups. 14462 </change> 14463 <change date="14 July 2003" version="v74"> 14464 Technical Publications Department corrections. 14465 Allow thread and environment local storage to be set to NULL. 14466 </change> 14467 <change date="23 July 2003" version="v75"> 14468 Use new Agent_OnLoad rather than overloaded JVM_OnLoad. 14469 Add JNICALL to callbacks (XSL). 14470 Document JNICALL requirement for both events and callbacks (XSL). 14471 Restrict RedefineClasses to methods and attributes. 14472 Elide the VerboseOutput event. 14473 VMObjectAlloc: restrict when event is sent and remove method parameter. 14474 Finish loose ends from Tech Pubs edit. 14475 </change> 14476 <change date="24 July 2003" version="v76"> 14477 Change ClassFileLoadHook event to send the class instead of a boolean of redefine. 14478 </change> 14479 <change date="24 July 2003" version="v77"> 14480 XML fixes. 14481 Minor text clarifications and corrections. 14482 </change> 14483 <change date="24 July 2003" version="v78"> 14484 Remove GetExceptionHandlerTable and GetThrownExceptions from <jvmti/>. 14485 Clarify that stack frames are JVM Spec frames. 14486 Split can_get_source_info into can_get_source_file_name, can_get_line_numbers, 14487 and can_get_source_debug_extension. 14488 PopFrame cannot have a native calling method. 14489 Removed incorrect statement in GetClassloaderClasses 14490 (see <vmspec chapter="4.4"/>). 14491 </change> 14492 <change date="24 July 2003" version="v79"> 14493 XML and text fixes. 14494 Move stack frame description into Stack Frame category. 14495 </change> 14496 <change date="26 July 2003" version="v80"> 14497 Allow NULL (means bootstrap loader) for GetClassloaderClasses. 14498 Add new heap reference kinds for references from classes. 14499 Add timer information struct and query functions. 14500 Add AvailableProcessors. 14501 Rename GetOtherThreadCpuTime to GetThreadCpuTime. 14502 Explicitly add JVMTI_ERROR_INVALID_THREAD and JVMTI_ERROR_THREAD_NOT_ALIVE 14503 to SetEventNotification mode. 14504 Add initial thread to the VM_INIT event. 14505 Remove platform assumptions from AddToBootstrapClassLoaderSearch. 14506 </change> 14507 <change date="26 July 2003" version="v81"> 14508 Grammar and clarity changes per review. 14509 </change> 14510 <change date="27 July 2003" version="v82"> 14511 More grammar and clarity changes per review. 14512 Add Agent_OnUnload. 14513 </change> 14514 <change date="28 July 2003" version="v83"> 14515 Change return type of Agent_OnUnload to void. 14516 </change> 14517 <change date="28 July 2003" version="v84"> 14518 Rename JVMTI_REFERENCE_ARRAY to JVMTI_REFERENCE_ARRAY_ELEMENT. 14519 </change> 14520 <change date="28 July 2003" version="v85"> 14521 Steal java.lang.Runtime.availableProcessors() wording for 14522 AvailableProcessors(). 14523 Guarantee that zero will never be an event ID. 14524 Remove some issues which are no longer issues. 14525 Per review, rename and more completely document the timer 14526 information functions. 14527 </change> 14528 <change date="29 July 2003" version="v86"> 14529 Non-spec visible change to XML controlled implementation: 14530 SetThreadLocalStorage must run in VM mode. 14531 </change> 14532 <change date="5 August 2003" version="0.1.87"> 14533 Add GetErrorName. 14534 Add varargs warning to jvmtiExtensionEvent. 14535 Remove "const" on the jvmtiEnv* of jvmtiExtensionEvent. 14536 Remove unused can_get_exception_info capability. 14537 Pass jvmtiEnv* and JNIEnv* to the jvmtiStartFunction. 14538 Fix jvmtiExtensionFunctionInfo.func declared type. 14539 Extension function returns error code. 14540 Use new version numbering. 14541 </change> 14542 <change date="5 August 2003" version="0.2.88"> 14543 Remove the ClassUnload event. 14544 </change> 14545 <change date="8 August 2003" version="0.2.89"> 14546 Heap reference iterator callbacks return an enum that 14547 allows outgoing object references to be ignored. 14548 Allow JNIEnv as a param type to extension events/functions. 14549 </change> 14550 <change date="15 August 2003" version="0.2.90"> 14551 Fix a typo. 14552 </change> 14553 <change date="2 September 2003" version="0.2.91"> 14554 Remove all metadata functions: GetClassMetadata, 14555 GetFieldMetadata, and GetMethodMetadata. 14556 </change> 14557 <change date="1 October 2003" version="0.2.92"> 14558 Mark the functions Allocate. Deallocate, RawMonitor*, 14559 SetEnvironmentLocalStorage, and GetEnvironmentLocalStorage 14560 as safe for use in heap callbacks and GC events. 14561 </change> 14562 <change date="24 November 2003" version="0.2.93"> 14563 Add pass through opaque user data pointer to heap iterate 14564 functions and callbacks. 14565 In the CompiledMethodUnload event, send the code address. 14566 Add GarbageCollectionOccurred event. 14567 Add constant pool reference kind. 14568 Mark the functions CreateRawMonitor and DestroyRawMonitor 14569 as safe for use in heap callbacks and GC events. 14570 Clarify: VMDeath, GetCurrentThreadCpuTimerInfo, 14571 GetThreadCpuTimerInfo, IterateOverReachableObjects, 14572 IterateOverObjectsReachableFromObject, GetTime and 14573 JVMTI_ERROR_NULL_POINTER. 14574 Add missing errors to: GenerateEvents and 14575 AddToBootstrapClassLoaderSearch. 14576 Fix description of ClassFileLoadHook name parameter. 14577 In heap callbacks and GC/ObjectFree events, specify 14578 that only explicitly allowed functions can be called. 14579 Allow GetCurrentThreadCpuTimerInfo, GetCurrentThreadCpuTime, 14580 GetTimerInfo, and GetTime during callback. 14581 Allow calling SetTag/GetTag during the onload phase. 14582 SetEventNotificationMode, add: error attempted inappropriate 14583 thread level control. 14584 Remove jvmtiExceptionHandlerEntry. 14585 Fix handling of native methods on the stack -- 14586 location_ptr param of GetFrameLocation, remove 14587 JVMTI_ERROR_OPAQUE_FRAME from GetFrameLocation, 14588 jvmtiFrameInfo.location, and jlocation. 14589 Remove typo (from JVMPI) implying that the MonitorWaited 14590 event is sent on sleep. 14591 </change> 14592 <change date="25 November 2003" version="0.2.94"> 14593 Clarifications and typos. 14594 </change> 14595 <change date="3 December 2003" version="0.2.95"> 14596 Allow NULL user_data in heap iterators. 14597 </change> 14598 <change date="28 January 2004" version="0.2.97"> 14599 Add GetThreadState, deprecate GetThreadStatus. 14600 </change> 14601 <change date="29 January 2004" version="0.2.98"> 14602 INVALID_SLOT and TYPE_MISMATCH errors should be optional. 14603 </change> 14604 <change date="12 February 2004" version="0.2.102"> 14605 Remove MonitorContendedExit. 14606 Added JNIEnv parameter to VMObjectAlloc. 14607 Clarified definition of class_tag and referrer_index 14608 parameters to heap callbacks. 14609 </change> 14610 <change date="16 Febuary 2004" version="0.2.103"> 14611 Document JAVA_TOOL_OPTIONS. 14612 </change> 14613 <change date="17 Febuary 2004" version="0.2.105"> 14614 Divide start phase into primordial and start. 14615 Add VMStart event 14616 Change phase associations of functions and events. 14617 </change> 14618 <change date="18 Febuary 2004" version="0.3.6"> 14619 Elide deprecated GetThreadStatus. 14620 Bump minor version, subtract 100 from micro version 14621 </change> 14622 <change date="18 Febuary 2004" version="0.3.7"> 14623 Document that timer nanosecond values are unsigned. 14624 Clarify text having to do with native methods. 14625 </change> 14626 <change date="19 Febuary 2004" version="0.3.8"> 14627 Fix typos. 14628 Remove elided deprecated GetThreadStatus. 14629 </change> 14630 <change date="23 Febuary 2004" version="0.3.9"> 14631 Require NotifyFramePop to act on suspended threads. 14632 </change> 14633 <change date="24 Febuary 2004" version="0.3.10"> 14634 Add capabilities 14635 (<internallink id="jvmtiCapabilities.can_redefine_any_class" 14636 ><code>can_redefine_any_class</code></internallink> 14637 and 14638 <internallink id="jvmtiCapabilities.can_generate_all_class_hook_events" 14639 ><code>can_generate_all_class_hook_events</code></internallink>) 14640 and an error (<errorlink id="JVMTI_ERROR_UNMODIFIABLE_CLASS"></errorlink>) 14641 which allow some classes to be unmodifiable. 14642 </change> 14643 <change date="28 Febuary 2004" version="0.3.11"> 14644 Add JVMTI_ERROR_MUST_POSSESS_CAPABILITY to SetEventNotificationMode. 14645 </change> 14646 <change date="8 March 2004" version="0.3.12"> 14647 Clarified CompiledMethodUnload so that it is clear the event 14648 may be posted after the class has been unloaded. 14649 </change> 14650 <change date="5 March 2004" version="0.3.13"> 14651 Change the size parameter of VMObjectAlloc to jlong to match GetObjectSize. 14652 </change> 14653 <change date="13 March 2004" version="0.3.14"> 14654 Added guideline for the use of the JNI FindClass function in event 14655 callback functions. 14656 </change> 14657 <change date="15 March 2004" version="0.3.15"> 14658 Add GetAllStackTraces and GetThreadListStackTraces. 14659 </change> 14660 <change date="19 March 2004" version="0.3.16"> 14661 ClassLoad and ClassPrepare events can be posted during start phase. 14662 </change> 14663 <change date="25 March 2004" version="0.3.17"> 14664 Add JVMTI_ERROR_NATIVE_METHOD to GetLineNumberTable, GetLocalVariableTable, 14665 GetMaxLocals, GetArgumentsSize, GetMethodLocation, GetBytecodes. 14666 </change> 14667 <change date="29 March 2004" version="0.3.18"> 14668 Return the timer kind in the timer information structure. 14669 </change> 14670 <change date="31 March 2004" version="0.3.19"> 14671 Spec clarifications: 14672 JVMTI_THREAD_STATE_IN_NATIVE might not include JNI or <jvmti/>. 14673 ForceGarbageCollection does not run finalizers. 14674 The context of the specification is the Java platform. 14675 Warn about early instrumentation. 14676 </change> 14677 <change date="1 April 2004" version="0.3.20"> 14678 Refinements to the above clarifications and 14679 Clarify that an error returned by Agent_OnLoad terminates the VM. 14680 </change> 14681 <change date="1 April 2004" version="0.3.21"> 14682 Array class creation does not generate a class load event. 14683 </change> 14684 <change date="7 April 2004" version="0.3.22"> 14685 Align thread state hierarchy more closely with java.lang.Thread.State. 14686 </change> 14687 <change date="12 April 2004" version="0.3.23"> 14688 Clarify the documentation of thread state. 14689 </change> 14690 <change date="19 April 2004" version="0.3.24"> 14691 Remove GarbageCollectionOccurred event -- can be done by agent. 14692 </change> 14693 <change date="22 April 2004" version="0.3.25"> 14694 Define "command-line option". 14695 </change> 14696 <change date="29 April 2004" version="0.3.26"> 14697 Describe the intended use of bytecode instrumentation. 14698 Fix description of extension event first parameter. 14699 </change> 14700 <change date="30 April 2004" version="0.3.27"> 14701 Clarification and typos. 14702 </change> 14703 <change date="18 May 2004" version="0.3.28"> 14704 Remove DataDumpRequest event. 14705 </change> 14706 <change date="18 May 2004" version="0.3.29"> 14707 Clarify RawMonitorWait with zero timeout. 14708 Clarify thread state after RunAgentThread. 14709 </change> 14710 <change date="24 May 2004" version="0.3.30"> 14711 Clean-up: fix bad/old links, etc. 14712 </change> 14713 <change date="30 May 2004" version="0.3.31"> 14714 Clarifications including: 14715 All character strings are modified UTF-8. 14716 Agent thread visibiity. 14717 Meaning of obsolete method version. 14718 Thread invoking heap callbacks, 14719 </change> 14720 <change date="1 June 2004" version="1.0.32"> 14721 Bump major.minor version numbers to "1.0". 14722 </change> 14723 <change date="2 June 2004" version="1.0.33"> 14724 Clarify interaction between ForceGarbageCollection 14725 and ObjectFree. 14726 </change> 14727 <change date="6 June 2004" version="1.0.34"> 14728 Restrict AddToBootstrapClassLoaderSearch and 14729 SetSystemProperty to the OnLoad phase only. 14730 </change> 14731 <change date="11 June 2004" version="1.0.35"> 14732 Fix typo in SetTag. 14733 </change> 14734 <change date="18 June 2004" version="1.0.36"> 14735 Fix trademarks. 14736 Add missing parameter in example GetThreadState usage. 14737 </change> 14738 <change date="4 August 2004" version="1.0.37"> 14739 Copyright updates. 14740 </change> 14741 <change date="5 November 2004" version="1.0.38"> 14742 Add missing function table layout. 14743 Add missing description of C++ member function format of functions. 14744 Clarify that name in CFLH can be NULL. 14745 Released as part of <tm>J2SE</tm> 5.0. 14746 </change> 14747 <change date="24 April 2005" version="1.1.47"> 14748 Bump major.minor version numbers to "1.1". 14749 Add ForceEarlyReturn* functions. 14750 Add GetOwnedMonitorStackDepthInfo function. 14751 Add GetCurrentThread function. 14752 Add "since" version marker. 14753 Add AddToSystemClassLoaderSearch. 14754 Allow AddToBootstrapClassLoaderSearch be used in live phase. 14755 Fix historic rubbish in the descriptions of the heap_object_callback 14756 parameter of IterateOverHeap and IterateOverInstancesOfClass functions; 14757 disallow NULL for this parameter. 14758 Clarify, correct and make consistent: wording about current thread, 14759 opaque frames and insufficient number of frames in PopFrame. 14760 Consistently use "current frame" rather than "topmost". 14761 Clarify the JVMTI_ERROR_TYPE_MISMATCH errors in GetLocal* and SetLocal* 14762 by making them compatible with those in ForceEarlyReturn*. 14763 Many other clarifications and wording clean ups. 14764 </change> 14765 <change date="25 April 2005" version="1.1.48"> 14766 Add GetConstantPool. 14767 Switch references to the first edition of the VM Spec, to the seconds edition. 14768 </change> 14769 <change date="26 April 2005" version="1.1.49"> 14770 Clarify minor/major version order in GetConstantPool. 14771 </change> 14772 <change date="26 April 2005" version="1.1.50"> 14773 Add SetNativeMethodPrefix and SetNativeMethodPrefixes. 14774 Reassign GetOwnedMonitorStackDepthInfo to position 153. 14775 Break out Class Loader Search in its own documentation category. 14776 Deal with overly long lines in XML source. 14777 </change> 14778 <change date="29 April 2005" version="1.1.51"> 14779 Allow agents be started in the live phase. 14780 Added paragraph about deploying agents. 14781 </change> 14782 <change date="30 April 2005" version="1.1.52"> 14783 Add specification description to SetNativeMethodPrefix(es). 14784 Better define the conditions on GetConstantPool. 14785 </change> 14786 <change date="30 April 2005" version="1.1.53"> 14787 Break out the GetClassVersionNumber function from GetConstantPool. 14788 Clean-up the references to the VM Spec. 14789 </change> 14790 <change date="1 May 2005" version="1.1.54"> 14791 Allow SetNativeMethodPrefix(es) in any phase. 14792 Add clarifications about the impact of redefinition on GetConstantPool. 14793 </change> 14794 <change date="2 May 2005" version="1.1.56"> 14795 Various clarifications to SetNativeMethodPrefix(es). 14796 </change> 14797 <change date="2 May 2005" version="1.1.57"> 14798 Add missing performance warning to the method entry event. 14799 </change> 14800 <change date="5 May 2005" version="1.1.58"> 14801 Remove internal JVMDI support. 14802 </change> 14803 <change date="8 May 2005" version="1.1.59"> 14804 Add <functionlink id="RetransformClasses"/>. 14805 Revamp the bytecode instrumentation documentation. 14806 Change <functionlink id="IsMethodObsolete"/> to no longer 14807 require the can_redefine_classes capability. 14808 </change> 14809 <change date="11 May 2005" version="1.1.63"> 14810 Clarifications for retransformation. 14811 </change> 14812 <change date="11 May 2005" version="1.1.64"> 14813 Clarifications for retransformation, per review. 14814 Lock "retransformation (in)capable" at class load enable time. 14815 </change> 14816 <change date="4 June 2005" version="1.1.67"> 14817 Add new heap functionity which supports reporting primitive values, 14818 allows setting the referrer tag, and has more powerful filtering: 14819 FollowReferences, IterateThroughHeap, and their associated 14820 callbacks, structs, enums, and constants. 14821 </change> 14822 <change date="4 June 2005" version="1.1.68"> 14823 Clarification. 14824 </change> 14825 <change date="6 June 2005" version="1.1.69"> 14826 FollowReferences, IterateThroughHeap: Put callbacks in a struct; 14827 Add missing error codes; reduce bits in the visit control flags. 14828 </change> 14829 <change date="14 June 2005" version="1.1.70"> 14830 More on new heap functionity: spec clean-up per review. 14831 </change> 14832 <change date="15 June 2005" version="1.1.71"> 14833 More on new heap functionity: Rename old heap section to Heap (1.0). 14834 </change> 14835 <change date="21 June 2005" version="1.1.72"> 14836 Fix typos. 14837 </change> 14838 <change date="27 June 2005" version="1.1.73"> 14839 Make referrer info structure a union. 14840 </change> 14841 <change date="9 September 2005" version="1.1.74"> 14842 In new heap functions: 14843 Add missing superclass reference kind. 14844 Use a single scheme for computing field indexes. 14845 Remove outdated references to struct based referrer info. 14846 </change> 14847 <change date="12 September 2005" version="1.1.75"> 14848 Don't callback during FollowReferences on frivolous java.lang.Object superclass. 14849 </change> 14850 <change date="13 September 2005" version="1.1.76"> 14851 In string primitive callback, length now Unicode length. 14852 In array and string primitive callbacks, value now "const". 14853 Note possible compiler impacts on setting JNI function table. 14854 </change> 14855 <change date="13 September 2005" version="1.1.77"> 14856 GetClassVersionNumbers() and GetConstantPool() should return 14857 error on array or primitive class. 14858 </change> 14859 <change date="14 September 2005" version="1.1.78"> 14860 Grammar fixes. 14861 </change> 14862 <change date="26 September 2005" version="1.1.79"> 14863 Add IsModifiableClass query. 14864 </change> 14865 <change date="9 February 2006" version="1.1.81"> 14866 Add referrer_class_tag parameter to jvmtiHeapReferenceCallback. 14867 </change> 14868 <change date="13 February 2006" version="1.1.82"> 14869 Doc fixes: update can_redefine_any_class to include retransform. 14870 Clarify that exception events cover all Throwables. 14871 In GetStackTrace, no test is done for start_depth too big if start_depth is zero, 14872 Clarify fields reported in Primitive Field Callback -- static vs instance. 14873 Repair confusing names of heap types, including callback names. 14874 Require consistent usage of stack depth in the face of thread launch methods. 14875 Note incompatibility of <jvmti/> memory management with other systems. 14876 </change> 14877 <change date="14 February 2006" version="1.1.85"> 14878 Fix typos and missing renames. 14879 </change> 14880 <change date="13 March 2006" version="1.1.86"> 14881 Clarify that jmethodIDs and jfieldIDs can be saved. 14882 Clarify that Iterate Over Instances Of Class includes subclasses. 14883 </change> 14884 <change date="14 March 2006" version="1.1.87"> 14885 Better phrasing. 14886 </change> 14887 <change date="16 March 2006" version="1.1.88"> 14888 Match the referrer_index for static fields in Object Reference Callback 14889 with the Reference Implementation (and all other known implementations); 14890 that is, make it match the definition for instance fields. 14891 In GetThreadListStackTraces, add JVMTI_ERROR_INVALID_THREAD to cover 14892 an invalid thread in the list; and specify that not started threads 14893 return empty stacks. 14894 </change> 14895 <change date="17 March 2006" version="1.1.89"> 14896 Typo. 14897 </change> 14898 <change date="25 March 2006" version="1.1.90"> 14899 Typo. 14900 </change> 14901 <change date="6 April 2006" version="1.1.91"> 14902 Remove restrictions on AddToBootstrapClassLoaderSearch and 14903 AddToSystemClassLoaderSearch. 14904 </change> 14905 <change date="1 May 2006" version="1.1.93"> 14906 Changed spec to return -1 for monitor stack depth for the 14907 implementation which can not determine stack depth. 14908 </change> 14909 <change date="3 May 2006" version="1.1.94"> 14910 Corrections for readability and accuracy courtesy of Alan Pratt of IBM. 14911 List the object relationships reported in FollowReferences. 14912 </change> 14913 <change date="5 May 2006" version="1.1.95"> 14914 Clarify the object relationships reported in FollowReferences. 14915 </change> 14916 <change date="28 June 2006" version="1.1.98"> 14917 Clarify DisposeEnvironment; add warning. 14918 Fix typos in SetLocalXXX "retrieve" => "set". 14919 Clarify that native method prefixes must remain set while used. 14920 Clarify that exactly one Agent_OnXXX is called per agent. 14921 Clarify that library loading is independent from start-up. 14922 Remove ambiguous reference to Agent_OnLoad in the Agent_OnUnload spec. 14923 </change> 14924 <change date="31 July 2006" version="1.1.99"> 14925 Clarify the interaction between functions and exceptions. 14926 Clarify and give examples of field indices. 14927 Remove confusing "That is" sentence from MonitorWait and MonitorWaited events. 14928 Update links to point to Java 6. 14929 </change> 14930 <change date="6 August 2006" version="1.1.102"> 14931 Add ResourceExhaustedEvent. 14932 </change> 14933 <change date="11 October 2012" version="1.2.2"> 14934 Fixed the "HTTP" and "Missing Anchor" errors reported by the LinkCheck tool. 14935 </change> 14936 <change date="19 June 2013" version="1.2.3"> 14937 Added support for statically linked agents. 14938 </change> 14939 <change date="13 October 2016" version="9.0.0"> 14940 Support for modules: 14941 - The majorversion is 9 now 14942 - The ClassFileLoadHook events are not sent during the primordial phase anymore. 14943 - Allow CompiledMethodLoad events at start phase 14944 - Add new capabilities: 14945 - can_generate_early_vmstart 14946 - can_generate_early_class_hook_events 14947 - Add new functions: 14948 - GetAllModules 14949 - AddModuleReads, AddModuleExports, AddModuleOpens, AddModuleUses, AddModuleProvides 14950 - IsModifiableModule 14951 Clarified can_redefine_any_classes, can_retransform_any_classes and IsModifiableClass API to 14952 disallow some implementation defined classes. 14953 </change> 14954 <change date="12 February 2017" version="9.0.0"> 14955 Minor update for GetCurrentThread function: 14956 - The function may return NULL in the start phase if the 14957 can_generate_early_vmstart capability is enabled. 14958 </change> 14959 <change date="7 February 2018" version="11.0.0"> 14960 Minor update for new class file NestHost and NestMembers attributes: 14961 - Specify that RedefineClasses and RetransformClasses are not allowed 14962 to change the class file NestHost and NestMembers attributes. 14963 - Add new error JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_ATTRIBUTE_CHANGED 14964 that can be returned by RedefineClasses and RetransformClasses. 14965 </change> 14966 <change date="20 May 2019" version="13.0.0"> 14967 Minor spec update for the capability "can_redefine_any_class". 14968 It now says: 14969 "RedefineClasses can be called on any modifiable class. See IsModifiableClass. 14970 (can_redefine_classes must also be set)" 14971 </change> 14972 <change date="5 June 2019" version="13.0.0"> 14973 Minor PopFrame spec update: 14974 - The specified thread must be suspended or must be the current thread. 14975 (It was not allowed to be the current thread before.) 14976 </change> 14977 <change date="10 October 2019" version="14.0.0"> 14978 Minor update for new class file Record attribute: 14979 - Specify that RedefineClasses and RetransformClasses are not allowed 14980 to change the class file Record attribute. 14981 </change> 14982</changehistory> 14983 14984</specification> 14985<!-- Keep this comment at the end of the file 14986Local variables: 14987mode: sgml 14988sgml-omittag:t 14989sgml-shorttag:t 14990sgml-namecase-general:t 14991sgml-general-insert-case:lower 14992sgml-minimize-attributes:nil 14993sgml-always-quote-attributes:t 14994sgml-indent-step:2 14995sgml-indent-data:t 14996sgml-parent-document:nil 14997sgml-exposed-tags:nil 14998sgml-local-catalogs:nil 14999sgml-local-ecat-files:nil 15000End: 15001--> 15002