Path: blob/master/src/hotspot/share/prims/jvmti.xml
64441 views
<?xml version="1.0" encoding="ISO-8859-1"?>1<?xml-stylesheet type="text/xsl" href="jvmti.xsl"?>2<!--3Copyright (c) 2002, 2021, Oracle and/or its affiliates. All rights reserved.4DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.56This code is free software; you can redistribute it and/or modify it7under the terms of the GNU General Public License version 2 only, as8published by the Free Software Foundation.910This code is distributed in the hope that it will be useful, but WITHOUT11ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13version 2 for more details (a copy is included in the LICENSE file that14accompanied this code).1516You should have received a copy of the GNU General Public License version172 along with this work; if not, write to the Free Software Foundation,18Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.1920Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21or visit www.oracle.com if you need additional information or have any22questions.23-->2425<!DOCTYPE specification [26<!ELEMENT specification (title, intro*, functionsection, errorsection,27eventsection, datasection, issuessection, changehistory)>28<!ATTLIST specification label CDATA #REQUIRED>2930<!ELEMENT title (#PCDATA|jvmti|tm)*>31<!ATTLIST title subtitle CDATA #REQUIRED>3233<!ELEMENT intro ANY>34<!ATTLIST intro id CDATA #IMPLIED35label CDATA "">3637<!ELEMENT functionsection (intro*, category*)>38<!ATTLIST functionsection label CDATA #REQUIRED>3940<!ELEMENT category ((intro|typedef|uniontypedef|capabilitiestypedef)*,41(function|callback|elide)*)>42<!ATTLIST category id CDATA #REQUIRED43label CDATA #REQUIRED>4445<!ELEMENT function (synopsis, typedef*, description?, origin,46(capabilities|eventcapabilities),47parameters, errors)>48<!ATTLIST function id CDATA #REQUIRED49num CDATA #REQUIRED50phase (onload|onloadOnly|start|live|any) #IMPLIED51callbacksafe (safe|unsafe) #IMPLIED52impl CDATA #IMPLIED53hide CDATA #IMPLIED54jkernel (yes|no) #IMPLIED55since CDATA "1.0">5657<!ELEMENT callback ((jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread|jthreadGroup|jobject|58jvalue|enum|jint|jlong|jfloat|jdouble|jlocation|jboolean|char|uchar|size_t|void),59synopsis, description?, parameters)>60<!ATTLIST callback id CDATA #REQUIRED61since CDATA "1.0">6263<!ELEMENT synopsis (#PCDATA|jvmti)*>6465<!ELEMENT typedef (description?, field*)>66<!ATTLIST typedef id CDATA #REQUIRED67label CDATA #REQUIRED68since CDATA "1.0">6970<!ELEMENT uniontypedef (description?, field*)>71<!ATTLIST uniontypedef id CDATA #REQUIRED72label CDATA #REQUIRED73since CDATA "1.0">7475<!ELEMENT field ((jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread|jthreadGroup|jobject|76jvalue|enum|jint|jlong|jfloat|jdouble|jlocation|jboolean|char|uchar|size_t|void|allocfieldbuf|inptr|inbuf|outbuf|vmbuf|ptrtype|struct),77description)>78<!ATTLIST field id CDATA #REQUIRED>7980<!ELEMENT capabilitiestypedef (description?, capabilityfield*)>81<!ATTLIST capabilitiestypedef id CDATA #REQUIRED82label CDATA #REQUIRED>8384<!ELEMENT capabilityfield (description)>85<!ATTLIST capabilityfield id CDATA #REQUIRED86disp1 CDATA ""87disp2 CDATA ""88since CDATA "1.0">8990<!ELEMENT description ANY>9192<!ELEMENT capabilities (required*, capability*)>9394<!ELEMENT eventcapabilities EMPTY>9596<!ELEMENT required ANY>97<!ATTLIST required id CDATA #REQUIRED>9899<!ELEMENT capability ANY>100<!ATTLIST capability id CDATA #REQUIRED>101102<!ELEMENT parameters (param*)>103104<!ELEMENT param ((jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread|jthreadGroup|jobject|105jvalue|enum|jint|jlong|jfloat|jdouble|jlocation|jboolean|char|uchar|size_t|void|varargs|struct|ptrtype|106outptr|allocbuf|allocallocbuf|inptr|inbuf|outbuf|vmbuf|agentbuf),107description)>108<!ATTLIST param id CDATA #REQUIRED>109110<!ELEMENT jmethodID EMPTY>111<!ATTLIST jmethodID class CDATA #IMPLIED112native CDATA #IMPLIED>113114<!ELEMENT jfieldID EMPTY>115<!ATTLIST jfieldID class CDATA #IMPLIED>116117<!ELEMENT jclass EMPTY>118<!ATTLIST jclass method CDATA #IMPLIED119field CDATA #IMPLIED>120121<!ELEMENT jframeID EMPTY>122<!ATTLIST jframeID thread CDATA #IMPLIED>123124<!ELEMENT jrawMonitorID EMPTY>125126<!ELEMENT jthread EMPTY>127<!ATTLIST jthread started CDATA #IMPLIED128null CDATA #IMPLIED129frame CDATA #IMPLIED130impl CDATA #IMPLIED>131132<!ELEMENT varargs EMPTY>133134<!ELEMENT jthreadGroup EMPTY>135<!ELEMENT jobject EMPTY>136<!ELEMENT jvalue EMPTY>137<!ELEMENT jchar EMPTY>138<!ELEMENT jint EMPTY>139<!ATTLIST jint min CDATA #IMPLIED>140<!ELEMENT jlong EMPTY>141<!ELEMENT jfloat EMPTY>142<!ELEMENT jdouble EMPTY>143<!ELEMENT jlocation EMPTY>144<!ELEMENT jboolean EMPTY>145<!ELEMENT char EMPTY>146<!ELEMENT uchar EMPTY>147<!ELEMENT size_t EMPTY>148<!ELEMENT void EMPTY>149<!ELEMENT enum (#PCDATA)*>150<!ELEMENT struct (#PCDATA)*>151152<!ELEMENT nullok ANY>153154<!ELEMENT ptrtype ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread|155jthreadGroup|jobject|jvalue), nullok?)>156157<!ELEMENT outptr ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread|158jthreadGroup|jobject|jvalue|enum|jchar|jint|jlong|jfloat|jdouble|159jlocation|jboolean|char|uchar|size_t|void), nullok?)>160161<!ELEMENT allocbuf ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread|162jthreadGroup|jobject|jvalue|enum|jint|jlong|jfloat|jdouble|163jlocation|jboolean|char|uchar|size_t|void), nullok?)>164<!ATTLIST allocbuf incount CDATA #IMPLIED165outcount CDATA #IMPLIED>166167<!ELEMENT allocallocbuf ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread|168jthreadGroup|jobject|jvalue|enum|jint|jlong|jfloat|jdouble|169jlocation|jboolean|char|uchar|size_t|void), nullok?)>170<!ATTLIST allocallocbuf incount CDATA #IMPLIED171outcount CDATA #IMPLIED>172173<!ELEMENT inptr (struct, nullok?)>174175<!ELEMENT inbuf ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread|176jthreadGroup|jobject|jvalue|enum|jint|jlong|jfloat|jdouble|177jlocation|jboolean|char|uchar|size_t|void), nullok?)>178<!ATTLIST inbuf incount CDATA #IMPLIED>179180<!ELEMENT outbuf ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread|181jthreadGroup|jobject|jvalue|enum|jint|jlong|jfloat|jdouble|182jlocation|jboolean|char|uchar|size_t|void|outbuf), nullok?)>183<!ATTLIST outbuf incount CDATA #IMPLIED184outcount CDATA #IMPLIED>185186<!ELEMENT vmbuf ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread|187jthreadGroup|jobject|jvalue|enum|jchar|jint|jlong|jfloat|jdouble|188jlocation|jboolean|char|uchar|size_t|void), nullok?)>189<!ATTLIST vmbuf incount CDATA #IMPLIED190outcount CDATA #IMPLIED>191192<!ELEMENT agentbuf ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread|193jthreadGroup|jobject|jvalue|enum|jint|jlong|jfloat|jdouble|194jlocation|jboolean|char|uchar|size_t|void), nullok?)>195<!ATTLIST agentbuf incount CDATA #IMPLIED196outcount CDATA #IMPLIED>197198<!ELEMENT allocfieldbuf ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread|199jthreadGroup|jobject|jvalue|enum|jint|jlong|jfloat|jdouble|200jlocation|jboolean|char|uchar|size_t|void))>201<!ATTLIST allocfieldbuf outcount CDATA #IMPLIED>202203<!ELEMENT errors (error*)>204205<!ELEMENT error ANY>206<!ATTLIST error id CDATA #REQUIRED>207208<!ELEMENT errorsection (intro*, errorcategory*)>209<!ATTLIST errorsection label CDATA #REQUIRED>210211<!ELEMENT errorcategory (intro*, errorid*)>212<!ATTLIST errorcategory id CDATA #REQUIRED213label CDATA #REQUIRED>214215<!ELEMENT errorid ANY>216<!ATTLIST errorid id CDATA #REQUIRED217num CDATA #REQUIRED>218219<!ELEMENT datasection (intro*, basetypes*)>220221<!ELEMENT basetypes (intro*, basetype*)>222<!ATTLIST basetypes id CDATA #REQUIRED223label CDATA #REQUIRED>224225<!ELEMENT basetype (definition?,description)>226<!ATTLIST basetype id CDATA #REQUIRED227name CDATA #IMPLIED>228229<!ELEMENT definition (#PCDATA|jvmti)*>230231<!ELEMENT eventsection (intro*, (event|elide)*)>232<!ATTLIST eventsection label CDATA #REQUIRED>233234<!ELEMENT event (description, origin, typedef*, capabilities, parameters)>235<!ATTLIST event id CDATA #REQUIRED236label CDATA #REQUIRED237const CDATA #REQUIRED238num CDATA #REQUIRED239phase (onload|start|live|any) #IMPLIED240filtered (thread|global) #IMPLIED241since CDATA "1.0">242243<!ELEMENT issuessection (intro*)>244<!ATTLIST issuessection label CDATA #REQUIRED>245246<!ELEMENT changehistory (intro*, change*)>247<!ATTLIST changehistory update CDATA #REQUIRED248id CDATA #REQUIRED>249250<!ELEMENT change ANY>251<!ATTLIST change date CDATA #REQUIRED252version CDATA #IMPLIED>253254<!ELEMENT functionlink (#PCDATA|jvmti|code|i|b)*>255<!ATTLIST functionlink id CDATA #REQUIRED>256257<!ELEMENT datalink (#PCDATA|jvmti|code|i|b)*>258<!ATTLIST datalink id CDATA #REQUIRED>259260<!ELEMENT typelink (#PCDATA|jvmti|code|i|b)*>261<!ATTLIST typelink id CDATA #REQUIRED>262263<!ELEMENT fieldlink (#PCDATA|jvmti|code|i|b)*>264<!ATTLIST fieldlink id CDATA #REQUIRED265struct CDATA #REQUIRED>266267<!ELEMENT paramlink (#PCDATA|jvmti|code|i|b)*>268<!ATTLIST paramlink id CDATA #REQUIRED>269270<!ELEMENT eventlink (#PCDATA|jvmti|code|i|b)*>271<!ATTLIST eventlink id CDATA #REQUIRED>272273<!ELEMENT errorlink (#PCDATA|jvmti|code|i|b|tm)*>274<!ATTLIST errorlink id CDATA #REQUIRED>275276<!ELEMENT externallink (#PCDATA|jvmti|code|i|b|tm)*>277<!ATTLIST externallink id CDATA #REQUIRED>278279<!ELEMENT vmspec EMPTY>280<!ATTLIST vmspec chapter CDATA #IMPLIED>281282<!ELEMENT internallink (#PCDATA|jvmti|code|i|b)*>283<!ATTLIST internallink id CDATA #REQUIRED>284285<!ELEMENT functionphaselist EMPTY>286<!ATTLIST functionphaselist phase (onload|onloadOnly|start|live|any) #REQUIRED>287288<!ELEMENT eventphaselist EMPTY>289<!ATTLIST eventphaselist phase (onload|start|live|any) #REQUIRED>290291<!ELEMENT issue ANY>292293<!ELEMENT rationale ANY>294295<!ELEMENT todo ANY>296297<!ELEMENT origin (#PCDATA)*>298299<!ELEMENT elide (intro|function|callback|event)*>300<!ATTLIST elide why CDATA #IMPLIED>301302<!ELEMENT constants (constant*)>303<!ATTLIST constants id CDATA #REQUIRED304label CDATA #REQUIRED305kind (enum|bits|const) #REQUIRED306since CDATA "1.0">307308<!ELEMENT constant ANY>309<!ATTLIST constant id CDATA #REQUIRED310num CDATA #REQUIRED>311312<!ELEMENT tm (#PCDATA)>313314<!ELEMENT i (#PCDATA|jvmti|tm)*>315316<!ELEMENT b (#PCDATA|jvmti|code)*>317318<!ELEMENT code (#PCDATA|space)*>319320<!ELEMENT pre ANY>321322<!ELEMENT space EMPTY>323324<!ELEMENT jvmti EMPTY>325326<!ELEMENT example (#PCDATA|i)*>327328<!ELEMENT br EMPTY>329330<!ELEMENT p EMPTY>331332<!ELEMENT blockquote ANY>333334<!ELEMENT dl (dt|dd)+>335336<!ELEMENT dd ANY>337338<!ELEMENT dt (#PCDATA|jvmti|code|i|b)*>339340<!ELEMENT table (tr)+>341342<!ELEMENT tr (td|th)*>343<!ATTLIST tr class CDATA #IMPLIED>344345<!ELEMENT td ANY>346<!ATTLIST td class CDATA #IMPLIED>347348<!ELEMENT th ANY>349<!ATTLIST th class CDATA #IMPLIED350scope (col|row) #IMPLIED>351352<!ELEMENT ul (li)+>353<!ATTLIST ul type (disc|circle|square) "disc">354355<!ELEMENT li ANY>356]>357358<specification label="JVM(TM) Tool Interface">359<title subtitle="Version">360<tm>JVM</tm> Tool Interface361</title>362363<intro id="whatIs" label="What is the JVM Tool Interface?">364The <tm>JVM</tm> Tool Interface (<jvmti/>)365is a programming interface used by development and monitoring tools.366It provides both a way to inspect the state and367to control the execution of applications running in the368<tm>Java</tm> virtual machine (VM).369<p/>370<jvmti/> is intended to provide a VM interface for the full breadth of tools371that need access to VM state, including but not limited to: profiling,372debugging, monitoring, thread analysis, and coverage analysis tools.373<p/>374<jvmti/> may not be available in all implementations of the <tm>Java</tm> virtual375machine.376<p/>377<jvmti/> is a two-way interface.378A client of <jvmti/>, hereafter called an <i>agent</i>,379can be notified of380interesting occurrences through <internallink id="EventSection">events</internallink>.381<jvmti/>382can query and control the application through many383<internallink id="FunctionSection">functions</internallink>,384either in response to events or385independent of them.386<p/>387Agents run in the same process with and communicate directly with388the virtual machine executing389the application being examined. This communication is390through a native interface (<jvmti/>). The native in-process interface allows391maximal control with minimal intrusion on the part of a tool.392Typically, agents are relatively compact. They can be controlled393by a separate process which implements the bulk of a tool's394function without interfering with the target application's normal execution.395</intro>396397<intro id="architecture" label="Architecture">398Tools can be written directly to <jvmti/> or indirectly399through higher level interfaces.400The Java Platform Debugger Architecture includes <jvmti/>, but also401contains higher-level, out-of-process debugger interfaces. The higher-level402interfaces are more appropriate than <jvmti/> for many tools.403For more information on the Java Platform Debugger Architecture,404see the405<externallink id="jpda/architecture.html">Java406Platform Debugger Architecture website</externallink>.407</intro>408409<intro id="writingAgents" label="Writing Agents">410Agents can be written in any native language that supports C411language calling conventions and C or C++412definitions.413<p/>414The function, event, data type, and constant definitions needed for415using <jvmti/> are defined in the include file <code>jvmti.h</code>.416To use these definitions add the <tm>J2SE</tm> include directory417to your include path and add418<example>419#include <jvmti.h>420</example>421to your source code.422</intro>423424<intro id="deployingAgents" label="Deploying Agents">425An agent is deployed in a platform specific manner but is typically the426platform equivalent of a dynamic library. On the <tm>Windows</tm> operating427system, for example, an agent library is a "Dynamic Linked Library" (DLL).428On <tm>Linux</tm> Operating Environment, an agent library is a shared object429(<code>.so</code> file).430<p/>431432An agent may be started at VM startup by specifying the agent library433name using a <internallink id="starting">command line option</internallink>.434Some implementations may support a mechanism to <internallink id="onattach">435start agents</internallink> in the live <functionlink id="GetPhase">phase</functionlink>.436The details of how this is initiated are implementation specific.437</intro>438439<intro id="entryPoint" label="Statically Linked Agents (since version 1.2.3)">440441A native JVMTI Agent may be <i>statically linked</i> with the VM.442The manner in which the library and VM image are combined is443implementation-dependent.444An agent L whose image has been combined with the VM is defined as445<i>statically linked</i> if and only if the agent exports a function446called Agent_OnLoad_L.447<p/>448If a <i>statically linked</i> agent L exports a function called449Agent_OnLoad_L and a function called Agent_OnLoad, the Agent_OnLoad450function will be ignored.451If an agent L is <i>statically linked</i>, an Agent_OnLoad_L452function will be invoked with the same arguments and expected return453value as specified for the Agent_OnLoad function.454An agent L that is <i>statically linked</i> will prohibit an agent of455the same name from being loaded dynamically.456<p/>457The VM will invoke the Agent_OnUnload_L function of the agent, if such458a function is exported, at the same point during VM execution as it would459have called the dynamic entry point Agent_OnUnLoad. A statically loaded460agent cannot be unloaded. The Agent_OnUnload_L function will still be461called to do any other agent shutdown related tasks.462If a <i>statically linked</i> agent L exports a function called463Agent_OnUnLoad_L and a function called Agent_OnUnLoad, the Agent_OnUnLoad464function will be ignored.465<p/>466If an agent L is <i>statically linked</i>, an Agent_OnAttach_L function467will be invoked with the same arguments and expected return value as468specified for the Agent_OnAttach function.469If a <i>statically linked</i> agent L exports a function called470Agent_OnAttach_L and a function called Agent_OnAttach, the Agent_OnAttach471function will be ignored.472</intro>473474<intro id="starting" label="Agent Command Line Options">475The term "command-line option" is used below to476mean options supplied in the <code>JavaVMInitArgs</code> argument477to the <code>JNI_CreateJavaVM</code> function of the JNI478Invocation API.479<p/>480One of the two following481command-line options is used on VM startup to482properly load and run agents.483These arguments identify the library containing484the agent as well as an options485string to be passed in at startup.486<dl>487<dt><code>-agentlib:</code><i><agent-lib-name></i><code>=</code><i><options></i></dt>488<dd>489The name following <code>-agentlib:</code> is the name of the490library to load. Lookup of the library, both its full name and location,491proceeds in a platform-specific manner.492Typically, the <i><agent-lib-name></i> is expanded to an493operating system specific file name.494The <i><options></i> will be passed to the agent on start-up.495For example, if the option496<code>-agentlib:foo=opt1,opt2</code> is specified, the VM will attempt to497load the shared library <code>foo.dll</code> from the system <code>PATH</code>498under <tm>Windows</tm> or <code>libfoo.so</code> from the499<code>LD_LIBRARY_PATH</code> under <tm>Linux</tm>.500If the agent library is statically linked into the executable501then no actual loading takes place.502<p/>503</dd>504<dt><code>-agentpath:</code><i><path-to-agent></i><code>=</code><i><options></i></dt>505<dd>506The path following <code>-agentpath:</code> is the absolute path from which507to load the library.508No library name expansion will occur.509The <i><options></i> will be passed to the agent on start-up.510For example, if the option511<code>-agentpath:c:\myLibs\foo.dll=opt1,opt2</code> is specified, the VM will attempt to512load the shared library <code>c:\myLibs\foo.dll</code>. If the agent513library is statically linked into the executable514then no actual loading takes place.515<p/>516</dd>517</dl>518For a dynamic shared library agent, the start-up routine519<internallink id="onload"><code>Agent_OnLoad</code></internallink>520in the library will be invoked. If the agent library is statically linked521into the executable then the system will attempt to invoke the522<code>Agent_OnLoad_<agent-lib-name></code> entry point where523<agent-lib-name> is the basename of the524agent. In the above example <code>-agentpath:c:\myLibs\foo.dll=opt1,opt2</code>,525the system will attempt to find and call the <code>Agent_OnLoad_foo</code> start-up routine.526<p/>527Libraries loaded with <code>-agentlib:</code> or <code>-agentpath:</code>528will be searched for JNI native method implementations to facilitate the529use of Java programming language code in tools, as is needed for530<internallink id="bci">bytecode instrumentation</internallink>.531<p/>532The agent libraries will be searched after all other libraries have been533searched (agents wishing to override or intercept the native method534implementations of non-agent methods can use the535<eventlink id="NativeMethodBind">NativeMethodBind event</eventlink>).536<p/>537These switches do the above and nothing more - they do not change the538state of the VM or <jvmti/>. No command line options are needed539to enable <jvmti/>540or aspects of <jvmti/>, this is handled programmatically541by the use of542<internallink id="capability">capabilities</internallink>.543</intro>544545<intro id="startup" label="Agent Start-Up">546The VM starts each agent by invoking a start-up function.547If the agent is started in the <code>OnLoad</code>548<functionlink id="GetPhase">phase</functionlink> the function549<internallink id="onload"><code>Agent_OnLoad</code></internallink>550or <internallink id="onload"><code>Agent_OnLoad_L</code></internallink>551for statically linked agents will be invoked.552If the agent is started in the live553<functionlink id="GetPhase">phase</functionlink> the function554<internallink id="onattach"><code>Agent_OnAttach</code></internallink>555or <internallink id="onattach"><code>Agent_OnAttach_L</code></internallink>556for statically linked agents will be invoked.557Exactly one call to a start-up function is made per agent.558</intro>559560<intro id="onload" label="Agent Start-Up (OnLoad phase)">561If an agent is started during the <code>OnLoad</code> phase then its562agent library must export a start-up function with the following prototype:563<example>564JNIEXPORT jint JNICALL565Agent_OnLoad(JavaVM *vm, char *options, void *reserved)</example>566Or for a statically linked agent named 'L':567<example>568JNIEXPORT jint JNICALL569Agent_OnLoad_L(JavaVM *vm, char *options, void *reserved)</example>570571The VM will start the agent by calling this function.572It will be called early enough in VM initialization that:573<ul>574<li><functionlink id="SetSystemProperty">system properties</functionlink>575may be set before they have been used in the start-up of the VM</li>576<li>the full set of577<internallink id="capability">capabilities</internallink>578is still available (note that capabilities that configure the VM579may only be available at this time--see the580<internallink id="capability">Capability function section</internallink>)</li>581<li>no bytecodes have executed</li>582<li>no classes have been loaded</li>583<li>no objects have been created</li>584</ul>585<p/>586The VM will call the <code>Agent_OnLoad</code> or587<code>Agent_OnLoad_<agent-lib-name></code> function with588<i><options></i> as the second argument -589that is, using the command-line option examples,590<code>"opt1,opt2"</code> will be passed to the <code>char *options</code>591argument of <code>Agent_OnLoad</code>.592The <code>options</code> argument is encoded as a593<internallink id="mUTF">modified UTF-8</internallink> string.594If <i>=<options></i> is not specified,595a zero length string is passed to <code>options</code>.596The lifespan of the <code>options</code> string is the597<code>Agent_OnLoad</code> or <code>Agent_OnLoad_<agent-lib-name></code>598call. If needed beyond this time the string or parts of the string must599be copied.600The period between when <code>Agent_OnLoad</code> is called and when it601returns is called the <i>OnLoad phase</i>.602Since the VM is not initialized during the OnLoad603<functionlink id="GetPhase">phase</functionlink>,604the set of allowed operations605inside <code>Agent_OnLoad</code> is restricted (see the function descriptions for the606functionality available at this time).607The agent can safely process the options and set608event callbacks with <functionlink id="SetEventCallbacks"></functionlink>. Once609the VM initialization event is received610(that is, the <eventlink id="VMInit">VMInit</eventlink>611callback is invoked), the agent612can complete its initialization.613<rationale>614Early startup is required so that agents can set the desired capabilities,615many of which must be set before the VM is initialized.616In JVMDI, the -Xdebug command-line option provided617very coarse-grain control of capabilities.618JVMPI implementations use various tricks to provide a single "JVMPI on" switch.619No reasonable command-line620option could provide the fine-grain of control required to balance needed capabilities vs621performance impact.622Early startup is also needed so that agents can control the execution623environment - modifying the file system and system properties to install624their functionality.625</rationale>626<p/>627The return value from <code>Agent_OnLoad</code> or628<code>Agent_OnLoad_<agent-lib-name></code> is used to indicate an error.629Any value other than zero indicates an error and causes termination of the VM.630</intro>631632<intro id="onattach" label="Agent Start-Up (Live phase)">633A VM may support a mechanism that allows agents to be started in the VM during the live634<functionlink id="GetPhase">phase</functionlink>. The details of how this is supported,635are implementation specific. For example, a tool may use some platform specific mechanism,636or implementation specific API, to attach to the running VM, and request it start a given637agent.638<p/>639If an agent is started during the live phase then its agent library640must export a start-up function641with the following prototype:642<example>643JNIEXPORT jint JNICALL644Agent_OnAttach(JavaVM* vm, char *options, void *reserved)</example>645Or for a statically linked agent named 'L':646<example>647JNIEXPORT jint JNICALL648Agent_OnAttach_L(JavaVM* vm, char *options, void *reserved)</example>649650<p/>651The VM will start the agent by calling this function.652It will be called in the context of a thread653that is attached to the VM. The first argument <i><vm></i> is the Java VM.654The <i><options></i> argument is the startup options provided to the agent.655<i><options></i> is encoded as a <internallink id="mUTF">modified UTF-8656</internallink> string.657If startup options were not provided, a zero length string is passed to658<code>options</code>. The lifespan of the <code>options</code> string is the659<code>Agent_OnAttach</code> or <code>Agent_OnAttach_<agent-lib-name></code> call.660If needed beyond this time the string or parts of the string must be copied.661<p/>662Note that some <internallink id="capability">capabilities</internallink>663may not be available in the live phase.664<p/>665The <code>Agent_OnAttach</code> or <code>Agent_OnAttach_<agent-lib-name666></code> function initializes the agent and returns a value667to the VM to indicate if an error occurred. Any value other than zero indicates an error.668An error does not cause the VM to terminate. Instead the VM ignores the error, or takes669some implementation specific action -- for example it might print an error to standard error,670or record the error in a system log.671</intro>672673<intro id="onunload" label="Agent Shutdown">674The library may optionally export a675shutdown function with the following prototype:676<example>677JNIEXPORT void JNICALL678Agent_OnUnload(JavaVM *vm)</example>679Or for a statically linked agent named 'L':680<example>681JNIEXPORT void JNICALL682Agent_OnUnload_L(JavaVM *vm)</example>683684This function will be called by the VM when the library is about to be unloaded.685The library will be unloaded (unless it is statically linked into the686executable) and this function will be called if some platform specific687mechanism causes the unload (an unload mechanism is not specified in this document)688or the library is (in effect) unloaded by the termination of the VM.689VM termination includes normal termination and VM failure, including start-up failure,690but not, of course, uncontrolled shutdown. An implementation may also691choose to not call this function if the <code>Agent_OnAttach</code>/692<code>Agent_OnAttach_L</code> function reported an error (returned a non-zero value).693Note the distinction between this function and the694<eventlink id="VMDeath">VM Death event</eventlink>: for the VM Death event695to be sent, the VM must have run at least to the point of initialization and a valid696<jvmti/> environment must exist which has set a callback for VMDeath697and enabled the event.698None of these are required for <code>Agent_OnUnload</code> or699<code>Agent_OnUnload_<agent-lib-name></code> and this function700is also called if the library is unloaded for other reasons.701In the case that a VM Death event is sent, it will be sent before this702function is called (assuming this function is called due to VM termination).703This function can be used to clean-up resources allocated by the agent.704</intro>705706<intro id="tooloptions" label="JAVA_TOOL_OPTIONS">707Since the command-line cannot always be accessed or modified, for example in embedded VMs708or simply VMs launched deep within scripts, a <code>JAVA_TOOL_OPTIONS</code> variable is709provided so that agents may be launched in these cases.710<p/>711Platforms which support environment variables or other named strings, may support the712<code>JAVA_TOOL_OPTIONS</code> variable. This variable will be broken into options at white-space713boundaries. White-space characters include space, tab, carriage-return, new-line,714vertical-tab, and form-feed. Sequences of white-space characters are considered715equivalent to a single white-space character. No white-space is included in the options716unless quoted. Quoting is as follows:717<ul>718<li>All characters enclosed between a pair of single quote marks (''), except a single719quote, 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 double722quote, 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 in726the 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 supplied730in its <code>JavaVMInitArgs</code> argument. Platforms may disable this feature in cases where security is731a concern; for example, the Reference Implementation disables this feature on Unix systems when732the effective user or group ID differs from the real ID.733This feature is intended to support the initialization of tools -- specifically including the734launching of native or Java programming language agents. Multiple tools may wish to use this735feature, so the variable should not be overwritten, instead, options should be appended to736the variable. Note that since the variable is processed at the time of the JNI Invocation737API create VM call, options processed by a launcher (e.g., VM selection options) will not be handled.738</intro>739740<intro id="environments" label="Environments">741The <jvmti/> specification supports the use of multiple simultaneous742<jvmti/> agents.743Each agent has its own <jvmti/> environment.744That is, the <jvmti/> state is745separate for each agent - changes to one environment do not affect the746others. The state of a <jvmti/>747environment 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>754Although their <jvmti/> state755is separate, agents inspect and modify the shared state756of the VM, they also share the native environment in which they execute.757As such, an agent can perturb the results of other agents or cause them758to fail. It is the responsibility of the agent writer to specify the level759of compatibility with other agents. <jvmti/> implementations are not capable760of preventing destructive interactions between agents. Techniques to reduce761the likelihood of these occurrences are beyond the scope of this document.762<p/>763An agent creates a <jvmti/> environment764by passing a <jvmti/> version765as the interface ID to the JNI Invocation API function766<externallink id="jni/invocation.html#getenv">767<code>GetEnv</code></externallink>.768See <internallink id="jvmtiEnvAccess">Accessing <jvmti/> Functions</internallink>769for more details on the creation and use of770<jvmti/> environments.771Typically, <jvmti/> environments are created by calling <code>GetEnv</code> from772<internallink id="onload"><code>Agent_OnLoad</code></internallink>.773</intro>774775<intro id="bci" label="Bytecode Instrumentation">776This interface does not include some events that one might expect in an interface with777profiling support. Some examples include full speed778method enter and exit events. The interface instead provides support for779<i>bytecode instrumentation</i>, the ability to alter the Java virtual machine780bytecode instructions which comprise the target program. Typically, these alterations781are to add "events" to the code of a method - for example, to add, at the beginning of a method,782a call to <code>MyProfiler.methodEntered()</code>.783Since the changes are purely additive, they do not modify application784state or behavior.785Because the inserted agent code is standard bytecodes, the VM can run at full speed,786optimizing not only the target program but also the instrumentation. If the787instrumentation does not involve switching from bytecode execution, no expensive788state transitions are needed. The result is high performance events.789This approach also provides complete control to the agent: instrumentation can be790restricted to "interesting" portions of the code (e.g., the end user's code) and791can be conditional. Instrumentation can run entirely in Java programming language792code or can call into the native agent. Instrumentation can simply maintain793counters or can statistically sample events.794<p/>795Instrumentation can be inserted in one of three ways:796<ul>797<li>798Static Instrumentation: The class file is instrumented before it799is loaded into the VM - for example, by creating a duplicate directory of800<code>*.class</code> files which have been modified to add the instrumentation.801This method is extremely awkward and, in general, an agent cannot know802the origin of the class files which will be loaded.803</li>804<li>805Load-Time Instrumentation: When a class file is loaded by the VM, the raw806bytes of the class file are sent for instrumentation to the agent.807The <eventlink id="ClassFileLoadHook"/>808event, triggered by the class load,809provides this functionality. This mechanism provides efficient810and complete access to one-time instrumentation.811</li>812<li>813Dynamic Instrumentation: A class which is already loaded (and possibly814even running) is modified. This optional feature is provided by the815<eventlink id="ClassFileLoadHook"/> event, triggered by calling the816<functionlink id="RetransformClasses"/> function.817Classes can be modified multiple times and can be returned to their818original state.819The mechanism allows instrumentation which changes during the820course of execution.821</li>822</ul>823<p/>824The class modification functionality provided in this interface825is intended to provide a mechanism for instrumentation826(the <eventlink id="ClassFileLoadHook"/> event827and the <functionlink id="RetransformClasses"/> function)828and, during development, for fix-and-continue debugging829(the <functionlink id="RedefineClasses"/> function).830<p/>831Care must be taken to avoid perturbing dependencies, especially when832instrumenting core classes. For example, an approach to getting notification833of every object allocation is to instrument the constructor on834<code>Object</code>. Assuming that the constructor is initially835empty, the constructor could be changed to:836<example>837public Object() {838MyProfiler.allocationTracker(this);839}840</example>841However, if this change was made using the842<eventlink id="ClassFileLoadHook"/>843event then this might impact a typical VM as follows:844the first created object will call the constructor causing a class load of845<code>MyProfiler</code>; which will then cause846object creation, and since <code>MyProfiler</code> isn't loaded yet,847infinite recursion; resulting in a stack overflow. A refinement of this848would be to delay invoking the tracking method until a safe time. For849example, <code>trackAllocations</code> could be set in the850handler for the <code>VMInit</code> event.851<example>852static boolean trackAllocations = false;853854public Object() {855if (trackAllocations) {856MyProfiler.allocationTracker(this);857}858}859</example>860<p/>861The <functionlink id="SetNativeMethodPrefix"/> allows native methods862to be instrumented by the use of wrapper methods.863</intro>864865<intro id="bcimodules" label="Bytecode Instrumentation of code in modules">866Agents can use the functions <functionlink id="AddModuleReads"/>,867<functionlink id="AddModuleExports"/>, <functionlink id="AddModuleOpens"/>,868<functionlink id="AddModuleUses"/> and <functionlink id="AddModuleProvides"/>869to update a module to expand the set of modules that it reads, the set of870packages that it exports or opens to other modules, or the services that it871uses and provides.872<p/>873As an aid to agents that deploy supporting classes on the search path of874the bootstrap class loader, or the search path of the class loader that875loads the main class, the Java virtual machine arranges for the module876of classes transformed by the <eventlink id="ClassFileLoadHook"/> event to877read the unnamed module of both class loaders.878</intro>879880<intro id="mUTF" label="Modified UTF-8 String Encoding">881<jvmti/> uses modified UTF-8 to encode character strings.882This is the same encoding used by JNI.883Modified UTF-8 differs884from standard UTF-8 in the representation of supplementary characters885and of the null character. See the886<externallink id="jni/types.html#modified-utf-8-strings">887Modified UTF-8 Strings</externallink>888section of the JNI specification for details.889</intro>890891<intro id="context" label="Specification Context">892Since this interface provides access to the state of applications running in the893Java virtual machine;894terminology refers to the Java platform and not the native895platform (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/>904Sun, Sun Microsystems, the Sun logo, Java, and JVM905are trademarks or registered trademarks of Oracle906and/or its affiliates, in the U.S. and other countries.907</intro>908909910<functionsection label="Functions">911<intro id="jvmtiEnvAccess" label="Accessing Functions">912Native code accesses <jvmti/> features913by calling <jvmti/> functions.914Access to <jvmti/> functions is by use of an interface pointer915in the same manner as916<externallink id="jni/design.html">Java917Native Interface (JNI) functions</externallink> are accessed.918The <jvmti/> interface pointer is called the919<i>environment pointer</i>.920<p/>921An environment pointer is a pointer to an environment and has922the type <code>jvmtiEnv*</code>.923An environment has information about its <jvmti/> connection.924The first value in the environment is a pointer to the function table.925The function table is an array of pointers to <jvmti/> functions.926Every function pointer is at a predefined offset inside the927array.928<p/>929When used from the C language:930double indirection is used to access the functions;931the environment pointer provides context and is the first932parameter of each function call; for example:933<example>934jvmtiEnv *jvmti;935...936jvmtiError err = (*jvmti)->GetLoadedClasses(jvmti, &class_count, &classes);937</example>938<p/>939When used from the C++ language:940functions are accessed as member functions of <code>jvmtiEnv</code>;941the 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>947Unless otherwise stated, all examples and declarations in this948specification use the C language.949<p/>950A <jvmti/> environment can be obtained through the JNI Invocation API951<code>GetEnv</code> function:952<example>953jvmtiEnv *jvmti;954...955(*jvm)->GetEnv(jvm, &jvmti, JVMTI_VERSION_1_0);956</example>957Each call to <code>GetEnv</code>958creates a new <jvmti/> connection and thus959a new <jvmti/> environment.960The <code>version</code> argument of <code>GetEnv</code> must be961a <jvmti/> version.962The returned environment may have a different version than the963requested version but the returned environment must be compatible.964<code>GetEnv</code> will return <code>JNI_EVERSION</code> if a965compatible version is not available, if <jvmti/> is not supported or966<jvmti/> is not supported in the current VM configuration.967Other interfaces may be added for creating <jvmti/> environments968in specific contexts.969Each environment has its own state (for example,970<functionlink id="SetEventNotificationMode">desired events</functionlink>,971<functionlink id="SetEventCallbacks">event handling functions</functionlink>, and972<functionlink id="AddCapabilities">capabilities</functionlink>).973An environment is released with974<functionlink id="DisposeEnvironment"></functionlink>.975Thus, unlike JNI which has one environment per thread, <jvmti/> environments work976across threads and are created dynamically.977</intro>978979<intro id="functionReturn" label="Function Return Values">980<jvmti/> functions always return an981<internallink id="ErrorSection">error code</internallink> via the982<datalink id="jvmtiError"/> function return value.983Some functions can return additional984values through pointers provided by the calling function.985In some cases, <jvmti/> functions allocate memory that your program must986explicitly deallocate. This is indicated in the individual <jvmti/>987function descriptions. Empty lists, arrays, sequences, etc are988returned as <code>NULL</code>.989<p/>990In the event that the <jvmti/> function encounters991an error (any return value other than <code>JVMTI_ERROR_NONE</code>) the values992of memory referenced by argument pointers is undefined, but no memory993will have been allocated and no global references will have been allocated.994If the error occurs because of invalid input, no action will have occurred.995</intro>996997<intro id="refs" label="Managing JNI Object References">998<jvmti/> functions identify objects with JNI references999(<datalink id="jobject"/> and <datalink id="jclass"/>)1000and their derivatives1001(<datalink id="jthread"/> and <datalink id="jthreadGroup"/>).1002References passed to1003<jvmti/> functions can be either global or local, but they must be1004strong references. All references returned by <jvmti/> functions are1005local references--these local references are created1006during the <jvmti/> call.1007Local references are a resource that must be managed (see the1008<externallink id="jni/functions.html#local-references">1009JNI Documentation</externallink>).1010When threads return from native code all local references1011are freed. Note that some threads, including typical1012agent threads, will never return from native code.1013A thread is ensured the ability to create sixteen local1014references without the need for any explicit management.1015For threads executing a limited number of <jvmti/> calls before1016returning from native code1017(for example, threads processing events),1018it may be determined that no explicit management1019is needed.1020However, long running agent threads will need explicit1021local reference management--usually with the JNI functions1022<code>PushLocalFrame</code> and <code>PopLocalFrame</code>.1023Conversely, to preserve references beyond the1024return from native code, they must be converted to global references.1025These rules do not apply to <datalink id="jmethodID"/> and <datalink id="jfieldID"/>1026as they are not <datalink id="jobject"/>s.1027</intro>10281029<intro id="prereqState" label="Prerequisite State for Calling Functions">1030Unless the function explicitly states that the agent must bring1031a thread or the VM to a particular state (for example, suspended),1032the <jvmti/> implementation is responsible for bringing the VM to a1033safe and consistent state for performing the function.1034</intro>10351036<intro id="functionsExceptions" label="Exceptions and Functions">1037<jvmti/> functions never throw exceptions; error conditions are1038communicated via the1039<internallink id="functionReturn">function return value</internallink>.1040Any existing exception state is preserved across a call to a1041<jvmti/> function.1042See the1043<externallink1044id="jni/design.html#java-exceptions"1045>Java Exceptions</externallink>1046section of the JNI specification for information on handling exceptions.1047</intro>10481049<category id="memory" label="Memory Management">1050<intro>1051These functions provide for the allocation and deallocation of1052memory used by <jvmti/> functionality and can be used to provide1053working memory for agents.1054Memory managed by <jvmti/> is not compatible with other memory1055allocation libraries and mechanisms.1056</intro>10571058<function id="Allocate" jkernel="yes" phase="any" callbacksafe="safe" impl="notrace" num="46">1059<synopsis>Allocate</synopsis>1060<description>1061Allocate an area of memory through the <jvmti/> allocator.1062The allocated1063memory 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>1072The 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>1081On return, a pointer to the beginning of the allocated memory.1082If <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">1088Memory 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>10951096<function id="Deallocate" jkernel="yes" phase="any" callbacksafe="safe" impl="notrace" num="47">1097<synopsis>Deallocate</synopsis>1098<description>1099Deallocate <code>mem</code> using the <jvmti/> allocator.1100This function should1101be used to deallocate any memory allocated and returned1102by a <jvmti/> function1103(including memory allocated with <functionlink id="Allocate"></functionlink>).1104All allocated memory must be deallocated1105or 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>1117A pointer to the beginning of the allocated memory.1118Please 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>11271128<category id="threadCategory" label="Thread">1129<intro>1130</intro>11311132<function id="GetThreadState" num="17">1133<synopsis>Get Thread State</synopsis>1134<description>1135Get the state of a thread. The state of the thread is represented by the1136answers 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 (<datalink1146id="JVMTI_THREAD_STATE_TERMINATED"><code>JVMTI_THREAD_STATE_TERMINATED</code></datalink>)</li>1147</ul>1148</li>1149</ul>1150</li>1151<li>Alive (<datalink1152id="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 (<datalink1157id="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 (<datalink1164id="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 (<datalink1171id="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 (<datalink1178id="JVMTI_THREAD_STATE_RUNNABLE"><code>JVMTI_THREAD_STATE_RUNNABLE</code></datalink>)</li>1179<li>Blocked (<datalink1180id="JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER"><code>JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER</code></datalink>)</li>1181<li>Waiting (<datalink1182id="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 (<datalink1187id="JVMTI_THREAD_STATE_WAITING_INDEFINITELY"><code>JVMTI_THREAD_STATE_WAITING_INDEFINITELY</code></datalink></li>1188<li>Timed (<datalink1189id="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 (<datalink1195id="JVMTI_THREAD_STATE_IN_OBJECT_WAIT"><code>JVMTI_THREAD_STATE_IN_OBJECT_WAIT</code></datalink>)</li>1196<li>LockSupport.park (<datalink1197id="JVMTI_THREAD_STATE_PARKED"><code>JVMTI_THREAD_STATE_PARKED</code></datalink>)</li>1198<li>Sleeping (<datalink1199id="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/>1212The 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">1215Thread is alive. Zero if thread is new (not started) or terminated.1216</constant>1217<constant id="JVMTI_THREAD_STATE_TERMINATED" num="0x0002">1218Thread has completed execution.1219</constant>1220<constant id="JVMTI_THREAD_STATE_RUNNABLE" num="0x0004">1221Thread is runnable.1222</constant>1223<constant id="JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER" num="0x0400">1224Thread is waiting to enter a synchronization block/method or,1225after an <code>Object.wait()</code>, waiting to re-enter a1226synchronization block/method.1227</constant>1228<constant id="JVMTI_THREAD_STATE_WAITING" num="0x0080">1229Thread is waiting.1230</constant>1231<constant id="JVMTI_THREAD_STATE_WAITING_INDEFINITELY" num="0x0010">1232Thread is waiting without a timeout.1233For example, <code>Object.wait()</code>.1234</constant>1235<constant id="JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT" num="0x0020">1236Thread is waiting with a maximum time to wait specified.1237For example, <code>Object.wait(long)</code>.1238</constant>1239<constant id="JVMTI_THREAD_STATE_SLEEPING" num="0x0040">1240Thread is sleeping -- <code>Thread.sleep(long)</code>.1241</constant>1242<constant id="JVMTI_THREAD_STATE_IN_OBJECT_WAIT" num="0x0100">1243Thread is waiting on an object monitor -- <code>Object.wait</code>.1244</constant>1245<constant id="JVMTI_THREAD_STATE_PARKED" num="0x0200">1246Thread 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">1250Thread suspended.1251<code>java.lang.Thread.suspend()</code>1252or a <jvmti/> suspend function1253(such as <functionlink id="SuspendThread"></functionlink>)1254has been called on the thread. If this bit1255is set, the other bits refer to the thread state before suspension.1256</constant>1257<constant id="JVMTI_THREAD_STATE_INTERRUPTED" num="0x200000">1258Thread has been interrupted.1259</constant>1260<constant id="JVMTI_THREAD_STATE_IN_NATIVE" num="0x400000">1261Thread is in native code--that is, a native method is running1262which has not called back into the VM or Java programming1263language code.1264<p/>1265This flag is not set when running VM compiled Java programming1266language code nor is it set when running VM code or1267VM support code. Native VM interface functions, such as JNI and1268<jvmti/> functions, may be implemented as VM code.1269</constant>1270<constant id="JVMTI_THREAD_STATE_VENDOR_1" num="0x10000000">1271Defined by VM vendor.1272</constant>1273<constant id="JVMTI_THREAD_STATE_VENDOR_2" num="0x20000000">1274Defined by VM vendor.1275</constant>1276<constant id="JVMTI_THREAD_STATE_VENDOR_3" num="0x40000000">1277Defined by VM vendor.1278</constant>1279</constants>1280The following definitions are used to convert <jvmti/> thread state1281to <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"1284num="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">1285Mask the state with this before comparison1286</constant>1287<constant id="JVMTI_JAVA_LANG_THREAD_STATE_NEW"1288num="0">1289<code>java.lang.Thread.State.NEW</code>1290</constant>1291<constant id="JVMTI_JAVA_LANG_THREAD_STATE_TERMINATED"1292num="JVMTI_THREAD_STATE_TERMINATED">1293<code>java.lang.Thread.State.TERMINATED</code>1294</constant>1295<constant id="JVMTI_JAVA_LANG_THREAD_STATE_RUNNABLE"1296num="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"1300num="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"1304num="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"1308num="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/>1314There can be no more than one answer to a question, although there can be no1315answer (because the answer is unknown, does not apply, or none of the answers is1316correct). An answer is set only when the enclosing answers match.1317That is, no more than one of1318<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>1323can be set (a <tm>J2SE</tm> compliant implementation will always set1324one of these if <code>JVMTI_THREAD_STATE_ALIVE</code> is set).1325And if any of these are set, the enclosing answer1326<code>JVMTI_THREAD_STATE_ALIVE</code> is set.1327No more than one of1328<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>1332can be set (a <tm>J2SE</tm> compliant implementation will always set1333one of these if <code>JVMTI_THREAD_STATE_WAITING</code> is set).1334And if either is set, the enclosing answers1335<code>JVMTI_THREAD_STATE_ALIVE</code> and1336<code>JVMTI_THREAD_STATE_WAITING</code> are set.1337No more than one of1338<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>1343can be set. And if any of these is set, the enclosing answers1344<code>JVMTI_THREAD_STATE_ALIVE</code> and1345<code>JVMTI_THREAD_STATE_WAITING</code> are set.1346Also, if <code>JVMTI_THREAD_STATE_SLEEPING</code> is set,1347then <code>JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT</code> is set.1348If a state <i>A</i> is implemented using the mechanism of1349state <i>B</i> then it is state <i>A</i> which1350is returned by this function.1351For example, if <code>Thread.sleep(long)</code>1352is implemented using <code>Object.wait(long)</code>1353then it is still <code>JVMTI_THREAD_STATE_SLEEPING</code>1354which is returned.1355More than one of1356<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>1361can be set, but if any is set,1362<code>JVMTI_THREAD_STATE_ALIVE</code> is set.1363<p/>1364And finally,1365<code>JVMTI_THREAD_STATE_TERMINATED</code> cannot be set unless1366<code>JVMTI_THREAD_STATE_ALIVE</code> is not set.1367<p/>1368The thread state representation is designed for extension in future versions1369of the specification; thread state values should be used accordingly, that is1370they should not be used as ordinals.1371Most queries can be made by testing a single bit, if use in a switch statement is desired,1372the state bits should be masked with the interesting bits.1373All bits not defined above are reserved for future use.1374A VM, compliant to the current specification, must set reserved bits to zero.1375An agent should ignore reserved bits --1376they should not be assumed to be zero and thus should not be included in comparisons.1377<p/>1378<b>Examples</b>1379<p/>1380Note that the values below exclude reserved and vendor bits.1381<p/>1382The state of a thread blocked at a <code>synchronized</code>-statement would be:1383<example>1384JVMTI_THREAD_STATE_ALIVE + JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER1385</example>1386The state of a thread which hasn't started yet would be:1387<example>138801389</example>1390The state of a thread at a <code>Object.wait(3000)</code> would be:1391<example>1392JVMTI_THREAD_STATE_ALIVE + JVMTI_THREAD_STATE_WAITING +1393JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT +1394JVMTI_THREAD_STATE_MONITOR_WAITING1395</example>1396The state of a thread suspended while runnable would be:1397<example>1398JVMTI_THREAD_STATE_ALIVE + JVMTI_THREAD_STATE_RUNNABLE + JVMTI_THREAD_STATE_SUSPENDED1399</example>1400<p/>1401<b>Testing the State</b>1402<p/>1403In most cases, the thread state can be determined by testing the one bit corresponding1404to that question. For example, the code to test if a thread is sleeping:1405<example>1406jint state;1407jvmtiError err;14081409err = (*jvmti)->GetThreadState(jvmti, thread, &state);1410if (err == JVMTI_ERROR_NONE) {1411if (state & JVMTI_THREAD_STATE_SLEEPING) { ...1412</example>1413<p/>1414For waiting (that is, in <code>Object.wait</code>, parked, or sleeping) it would be:1415<example>1416if (state & JVMTI_THREAD_STATE_WAITING) { ...1417</example>1418For some states, more than one bit will need to be tested as is the case1419when testing if a thread has not yet been started:1420<example>1421if ((state & (JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_TERMINATED)) == 0) { ...1422</example>1423To distinguish timed from untimed <code>Object.wait</code>:1424<example>1425if (state & JVMTI_THREAD_STATE_IN_OBJECT_WAIT) {1426if (state & JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT) {1427printf("in Object.wait(long timeout)\n");1428} else {1429printf("in Object.wait()\n");1430}1431}1432</example>1433<p/>1434<b>Relationship to <code>java.lang.Thread.State</code></b>1435<p/>1436The thread state represented by <code>java.lang.Thread.State</code>1437returned from <code>java.lang.Thread.getState()</code> is a subset of the1438information returned from this function.1439The corresponding <code>java.lang.Thread.State</code> can be determined1440by using the provided conversion masks.1441For example, this returns the name of the <code>java.lang.Thread.State</code> thread state:1442<example>1443err = (*jvmti)->GetThreadState(jvmti, thread, &state);1444abortOnError(err);1445switch (state & JVMTI_JAVA_LANG_THREAD_STATE_MASK) {1446case JVMTI_JAVA_LANG_THREAD_STATE_NEW:1447return "NEW";1448case JVMTI_JAVA_LANG_THREAD_STATE_TERMINATED:1449return "TERMINATED";1450case JVMTI_JAVA_LANG_THREAD_STATE_RUNNABLE:1451return "RUNNABLE";1452case JVMTI_JAVA_LANG_THREAD_STATE_BLOCKED:1453return "BLOCKED";1454case JVMTI_JAVA_LANG_THREAD_STATE_WAITING:1455return "WAITING";1456case JVMTI_JAVA_LANG_THREAD_STATE_TIMED_WAITING:1457return "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>1468The thread to query.1469</description>1470</param>1471<param id="thread_state_ptr">1472<outptr><jint/></outptr>1473<description>1474On return, points to state flags,1475as defined by the <internallink id="jvmtiThreadState">Thread State Flags</internallink>.1476</description>1477</param>1478</parameters>1479<errors>1480</errors>1481</function>14821483<function id="GetCurrentThread" phase="start" num="18" since="1.1">1484<synopsis>Get Current Thread</synopsis>1485<description>1486Get the current thread.1487The current thread is the Java programming language thread which has called the function.1488The function may return <code>NULL</code> in the start phase if the1489<internallink id="jvmtiCapabilities.can_generate_early_vmstart">1490<code>can_generate_early_vmstart</code></internallink> capability is enabled1491and the <code>java.lang.Thread</code> class has not been initialized yet.1492<p/>1493Note that most <jvmti/> functions that take a thread1494as an argument will accept <code>NULL</code> to mean1495the 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>1504On return, points to the current thread, or <code>NULL</code>.1505</description>1506</param>1507</parameters>1508<errors>1509</errors>1510</function>15111512<function id="GetAllThreads" num="4">1513<synopsis>Get All Threads</synopsis>1514<description>1515Get all live threads.1516The threads are Java programming language threads;1517that is, threads that are attached to the VM.1518A thread is live if <code>java.lang.Thread.isAlive()</code>1519would return <code>true</code>, that is, the thread has1520been started and has not yet died.1521The universe of threads is determined by the context of the <jvmti/>1522environment, which typically is all threads attached to the VM.1523Note that this includes <jvmti/> agent threads1524(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>1533On 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>1539On return, points to an array of references, one1540for each running thread.1541</description>1542</param>1543</parameters>1544<errors>1545</errors>1546</function>15471548<function id="SuspendThread" num="5">1549<synopsis>Suspend Thread</synopsis>1550<description>1551Suspend the specified thread. If the calling thread is specified,1552this function will not return until some other thread calls1553<functionlink id="ResumeThread"></functionlink>.1554If the thread is currently suspended, this function1555does 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>1565The thread to suspend.1566</description>1567</param>1568</parameters>1569<errors>1570<error id="JVMTI_ERROR_THREAD_SUSPENDED">1571Thread already suspended.1572</error>1573</errors>1574</function>15751576<elide>1577<function id="SuspendAllThreads" num="101">1578<synopsis>Suspend All Threads</synopsis>1579<description>1580<issue>1581There has been no explicit call for this function, and it will1582thus be removed if there is no interest.1583</issue>1584Suspend 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 determined1589by the VM implementation</li>1590</ul>1591The threads are Java programming language threads;1592native threads which are not attached to the VM are not1593Java programming language threads.1594A thread is live if <code>java.lang.Thread.isAlive()</code>1595would return <code>true</code>, that is, the thread has1596been started and has not yet died.1597The universe of threads is determined1598by the context of the <jvmti/>1599environment, which, typically, is all threads attached to the VM,1600except critical VM internal threads and <jvmti/> agent threads1601(see <functionlink id="RunAgentThread"/>).1602<p/>1603If the calling thread is specified,1604all other threads are suspended first then the caller thread is suspended -1605this function will not return until some other thread calls1606<functionlink id="ResumeThread"></functionlink>.1607<p/>1608The list of actually1609suspended threads is returned in1610<paramlink id="suspended_list_ptr"></paramlink>.1611Suspension is as defined in <functionlink id="SuspendThread"></functionlink>.1612<functionlink id="ResumeThreadList"></functionlink>1613can 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>1623The 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>1632The list of threads not to be suspended.1633</description>1634</param>1635<param id="suspended_count_ptr">1636<outptr><jint/></outptr>1637<description>1638On 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>1644On return, points to an array of references, one1645for each thread suspended.1646</description>1647</param>1648</parameters>1649<errors>1650<error id="JVMTI_ERROR_INVALID_THREAD">1651A thread in <paramlink id="except_list"></paramlink> was invalid.1652</error>1653<error id="JVMTI_ERROR_NULL_POINTER">1654Both <paramlink id="except_list"></paramlink> was <code>NULL</code>1655and <paramlink id="except_count"></paramlink> was non-zero.1656</error>1657</errors>1658</function>1659</elide>16601661<function id="SuspendThreadList" num="92">1662<synopsis>Suspend Thread List</synopsis>1663<description>1664Suspend the <paramlink id="request_count"></paramlink>1665threads specified in the1666<paramlink id="request_list"></paramlink> array.1667Threads may be resumed with1668<functionlink id="ResumeThreadList"></functionlink> or1669<functionlink id="ResumeThread"></functionlink>.1670If the calling thread is specified in the1671<paramlink id="request_list"></paramlink> array, this function will1672not return until some other thread resumes it.1673Errors encountered in the suspension of a thread1674are returned in the <paramlink id="results"></paramlink>1675array, <b>not</b> in the return value of this function.1676Threads 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>1686The number of threads to suspend.1687</description>1688</param>1689<param id="request_list">1690<inbuf incount="request_count"><jthread/></inbuf>1691<description>1692The list of threads to suspend.1693</description>1694</param>1695<param id="results">1696<outbuf incount="request_count"><enum>jvmtiError</enum></outbuf>1697<description>1698An agent supplied array of1699<paramlink id="request_count"></paramlink> elements.1700On return, filled with the error code for1701the suspend of the corresponding thread.1702The error code will be1703<errorlink id="JVMTI_ERROR_NONE"></errorlink>1704if the thread was suspended by this call.1705Possible error codes are those specified1706for <functionlink id="SuspendThread"></functionlink>.1707</description>1708</param>1709</parameters>1710<errors>1711</errors>1712</function>17131714<function id="ResumeThread" num="6">1715<synopsis>Resume Thread</synopsis>1716<description>1717Resume a suspended thread.1718Any threads currently suspended through1719a <jvmti/> suspend function (eg.1720<functionlink id="SuspendThread"></functionlink>)1721or <code>java.lang.Thread.suspend()</code>1722will resume execution;1723all 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>1733The thread to resume.1734</description>1735</param>1736</parameters>1737<errors>1738<error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">1739Thread was not suspended.1740</error>1741<error id="JVMTI_ERROR_INVALID_TYPESTATE">1742The state of the thread has been modified, and is now inconsistent.1743</error>1744</errors>1745</function>17461747<function id="ResumeThreadList" num="93">1748<synopsis>Resume Thread List</synopsis>1749<description>1750Resume the <paramlink id="request_count"></paramlink>1751threads specified in the1752<paramlink id="request_list"></paramlink> array.1753Any thread suspended through1754a <jvmti/> suspend function (eg.1755<functionlink id="SuspendThreadList"></functionlink>)1756or <code>java.lang.Thread.suspend()</code>1757will 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>1767The number of threads to resume.1768</description>1769</param>1770<param id="request_list">1771<inbuf incount="request_count"><jthread/></inbuf>1772<description>1773The threads to resume.1774</description>1775</param>1776<param id="results">1777<outbuf incount="request_count"><enum>jvmtiError</enum></outbuf>1778<description>1779An agent supplied array of1780<paramlink id="request_count"></paramlink> elements.1781On return, filled with the error code for1782the resume of the corresponding thread.1783The error code will be1784<errorlink id="JVMTI_ERROR_NONE"></errorlink>1785if the thread was suspended by this call.1786Possible error codes are those specified1787for <functionlink id="ResumeThread"></functionlink>.1788</description>1789</param>1790</parameters>1791<errors>1792</errors>1793</function>17941795<function id="StopThread" num="7">1796<synopsis>Stop Thread</synopsis>1797<description>1798Send the specified asynchronous exception to the specified thread.1799Normally, this function is used to kill the specified thread with an1800instance of the exception <code>ThreadDeath</code>, similar to1801<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>1811The thread to stop.1812</description>1813</param>1814<param id="exception">1815<jobject/>1816<description>1817The asynchronous exception object.1818</description>1819</param>1820</parameters>1821<errors>1822</errors>1823</function>18241825<function id="InterruptThread" num="8">1826<synopsis>Interrupt Thread</synopsis>1827<description>1828Interrupt the specified thread1829(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>1839The thread to interrupt.1840</description>1841</param>1842</parameters>1843<errors>1844</errors>1845</function>18461847<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>1853The thread name, encoded as a1854<internallink id="mUTF">modified UTF-8</internallink> string.1855</description>1856</field>1857<field id="priority">1858<jint/>1859<description>1860The 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>1867Is this a daemon thread?1868</description>1869</field>1870<field id="thread_group">1871<jthreadGroup/>1872<description>1873The 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>1880The context class loader associated with this thread.1881</description>1882</field>1883</typedef>1884<description>1885Get thread information. The fields of the <datalink id="jvmtiThreadInfo"/> structure1886are 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>1895The thread to query.1896</description>1897</param>1898<param id="info_ptr">1899<outptr><struct>jvmtiThreadInfo</struct></outptr>1900<description>1901On return, filled with information describing the specified thread.1902</description>1903</param>1904</parameters>1905<errors>1906</errors>1907</function>19081909<function id="GetOwnedMonitorInfo" num="10">1910<synopsis>Get Owned Monitor Info</synopsis>1911<description>1912Get information about the monitors owned by the1913specified 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>1923The thread to query.1924</description>1925</param>1926<param id="owned_monitor_count_ptr">1927<outptr><jint/></outptr>1928<description>1929The 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>1935The array of owned monitors.1936</description>1937</param>1938</parameters>1939<errors>1940</errors>1941</function>19421943<function id="GetOwnedMonitorStackDepthInfo" num="153" since="1.1">1944<synopsis>Get Owned Monitor Stack Depth Info</synopsis>1945<typedef id="jvmtiMonitorStackDepthInfo"1946label="Monitor stack depth information structure">1947<field id="monitor">1948<jobject/>1949<description>1950The owned monitor.1951</description>1952</field>1953<field id="stack_depth">1954<jint/>1955<description>1956The stack depth. Corresponds to the stack depth used in the1957<internallink id="stack">Stack Frame functions</internallink>.1958That is, zero is the current frame, one is the frame which1959called the current frame. And it is negative one if the1960implementation cannot determine the stack depth (e.g., for1961monitors acquired by JNI <code>MonitorEnter</code>).1962</description>1963</field>1964</typedef>1965<description>1966Get information about the monitors owned by the1967specified 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>1977The thread to query.1978</description>1979</param>1980<param id="monitor_info_count_ptr">1981<outptr><jint/></outptr>1982<description>1983The 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>1991The array of owned monitor depth information.1992</description>1993</param>1994</parameters>1995<errors>1996</errors>1997</function>19981999<function id="GetCurrentContendedMonitor" num="11">2000<synopsis>Get Current Contended Monitor</synopsis>2001<description>2002Get the object, if any, whose monitor the specified thread is waiting to2003enter 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>2013The thread to query.2014</description>2015</param>2016<param id="monitor_ptr">2017<outptr><jobject/></outptr>2018<description>2019On return, filled with the current contended monitor, or2020NULL if there is none.2021</description>2022</param>2023</parameters>2024<errors>2025</errors>2026</function>20272028<callback id="jvmtiStartFunction">2029<void/>2030<synopsis>Agent Start Function</synopsis>2031<description>2032Agent supplied callback function.2033This function is the entry point for an agent thread2034started with2035<functionlink id="RunAgentThread"></functionlink>.2036</description>2037<parameters>2038<param id="jvmti_env">2039<outptr>2040<struct>jvmtiEnv</struct>2041</outptr>2042<description>2043The <jvmti/> environment.2044</description>2045</param>2046<param id="jni_env">2047<outptr>2048<struct>JNIEnv</struct>2049</outptr>2050<description>2051The JNI environment.2052</description>2053</param>2054<param id="arg">2055<outptr>2056<void/>2057</outptr>2058<description>2059The <code>arg</code> parameter passed to2060<functionlink id="RunAgentThread"></functionlink>.2061</description>2062</param>2063</parameters>2064</callback>20652066<function id="RunAgentThread" num="12">2067<synopsis>Run Agent Thread</synopsis>2068<description>2069Starts the execution of an agent thread. with the specified native function.2070The parameter <paramlink id="arg"></paramlink> is forwarded on to the2071<functionlink id="jvmtiStartFunction">start function</functionlink>2072(specified with <paramlink id="proc"></paramlink>) as its single argument.2073This function allows the creation of agent threads2074for handling communication with another process or for handling events2075without the need to load a special subclass of <code>java.lang.Thread</code> or2076implementer of <code>java.lang.Runnable</code>.2077Instead, the created thread can run entirely in native code.2078However, the created thread does require a newly created instance2079of <code>java.lang.Thread</code> (referenced by the argument <code>thread</code>) to2080which it will be associated.2081The thread object can be created with JNI calls.2082<p/>2083The 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">2086Minimum possible thread priority2087</constant>2088<constant id="JVMTI_THREAD_NORM_PRIORITY" num="5">2089Normal thread priority2090</constant>2091<constant id="JVMTI_THREAD_MAX_PRIORITY" num="10">2092Maximum possible thread priority2093</constant>2094</constants>2095<p/>2096The new thread is started as a daemon thread with the specified2097<paramlink id="priority"></paramlink>.2098If enabled, a <eventlink id="ThreadStart"/> event will be sent.2099<p/>2100Since the thread has been started, the thread will be live when this function2101returns, unless the thread has died immediately.2102<p/>2103The thread group of the thread is ignored -- specifically, the thread is not2104added to the thread group and the thread is not seen on queries of the thread2105group at either the Java programming language or <jvmti/> levels.2106<p/>2107The thread is not visible to Java programming language queries but is2108included in <jvmti/> queries (for example,2109<functionlink id="GetAllThreads"/> and2110<functionlink id="GetAllStackTraces"/>).2111<p/>2112Upon execution of <code>proc</code>, the new thread will be attached to the2113VM -- see the JNI documentation on2114<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>2124The thread to run.2125</description>2126</param>2127<param id="proc">2128<ptrtype>2129<struct>jvmtiStartFunction</struct>2130</ptrtype>2131<description>2132The 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>2141The argument to the start function.2142</description>2143</param>2144<param id="priority">2145<jint/>2146<description>2147The priority of the started thread. Any thread2148priority allowed by <code>java.lang.Thread.setPriority</code> can be used including2149those 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 than2156<datalink id="JVMTI_THREAD_MIN_PRIORITY"/>2157or greater than2158<datalink id="JVMTI_THREAD_MAX_PRIORITY"/>2159</error>2160</errors>2161</function>21622163<function id="SetThreadLocalStorage" jkernel="yes" impl="notrace" phase="start" num="103">2164<synopsis>Set Thread Local Storage</synopsis>2165<description>2166The VM stores a pointer value associated with each environment-thread2167pair. This pointer value is called <i>thread-local storage</i>.2168This value is <code>NULL</code> unless set with this function.2169Agents can allocate memory in which they store thread specific2170information. By setting thread-local storage it can then be2171accessed with2172<functionlink id="GetThreadLocalStorage"></functionlink>.2173<p/>2174This function is called by the agent to set the value of the <jvmti/>2175thread-local storage. <jvmti/> supplies to the agent a pointer-size2176thread-local storage that can be used to record per-thread2177information.2178</description>2179<origin>jvmpi</origin>2180<capabilities>2181</capabilities>2182<parameters>2183<param id="thread">2184<jthread null="current"/>2185<description>2186Store 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>2195The value to be entered into the thread-local storage.2196</description>2197</param>2198</parameters>2199<errors>2200</errors>2201</function>22022203<function id="GetThreadLocalStorage" jkernel="yes" impl="innative notrace" phase="start" num="102">2204<synopsis>Get Thread Local Storage</synopsis>2205<description>2206Called by the agent to get the value of the <jvmti/> thread-local2207storage.2208</description>2209<origin>jvmpi</origin>2210<capabilities>2211</capabilities>2212<parameters>2213<param id="thread">2214<jthread null="current" impl="noconvert"/>2215<description>2216Retrieve from this thread.2217</description>2218</param>2219<param id="data_ptr">2220<agentbuf><void/></agentbuf>2221<description>2222Pointer through which the value of the thread local2223storage is returned.2224If thread-local storage has not been set with2225<functionlink id="SetThreadLocalStorage"></functionlink> the returned2226pointer is <code>NULL</code>.2227</description>2228</param>2229</parameters>2230<errors>2231</errors>2232</function>22332234</category>22352236<category id="thread_groups" label="Thread Group">2237<intro>2238</intro>22392240<function id="GetTopThreadGroups" num="13">2241<synopsis>Get Top Thread Groups</synopsis>2242<description>2243Return 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>2252On 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>2258On return, refers to a pointer to the top-level thread group array.2259</description>2260</param>2261</parameters>2262<errors>2263</errors>2264</function>22652266<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>2272The parent thread group.2273</description>2274</field>2275<field id="name">2276<allocfieldbuf><char/></allocfieldbuf>2277<description>2278The thread group's name, encoded as a2279<internallink id="mUTF">modified UTF-8</internallink> string.2280</description>2281</field>2282<field id="max_priority">2283<jint/>2284<description>2285The maximum priority for this thread group.2286</description>2287</field>2288<field id="is_daemon">2289<jboolean/>2290<description>2291Is this a daemon thread group?2292</description>2293</field>2294</typedef>2295<description>2296Get information about the thread group. The fields of the2297<functionlink id="jvmtiThreadGroupInfo"></functionlink> structure2298are 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>2307The thread group to query.2308</description>2309</param>2310<param id="info_ptr">2311<outptr><struct>jvmtiThreadGroupInfo</struct></outptr>2312<description>2313On return, filled with information describing the specified2314thread group.2315</description>2316</param>2317</parameters>2318<errors>2319</errors>2320</function>23212322<function id="GetThreadGroupChildren" num="15">2323<synopsis>Get Thread Group Children</synopsis>2324<description>2325Get 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>2334The group to query.2335</description>2336</param>2337<param id="thread_count_ptr">2338<outptr><jint/></outptr>2339<description>2340On 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>2346On 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>2352On return, points to the number of active child thread groups2353</description>2354</param>2355<param id="groups_ptr">2356<allocbuf outcount="group_count_ptr"><jthreadGroup/></allocbuf>2357<description>2358On 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>23662367<category id="stack" label="Stack Frame">2368<intro>2369These functions provide information about the stack of a thread.2370Stack frames are referenced by depth.2371The frame at depth zero is the current frame.2372<p/>2373Stack frames are as described in2374<vmspec chapter="3.6"/>,2375That is, they correspond to method2376invocations (including native methods) but do not correspond to platform native or2377VM internal frames.2378<p/>2379A <jvmti/> implementation may use method invocations to launch a thread and2380the corresponding frames may be included in the stack as presented by these functions --2381that is, there may be frames shown2382deeper than <code>main()</code> and <code>run()</code>.2383However this presentation must be consistent across all <jvmti/> functionality which2384uses stack frames or stack depth.2385</intro>23862387<typedef id="jvmtiFrameInfo" label="Stack frame information structure">2388<description>2389Information about a stack frame is returned in this structure.2390</description>2391<field id="method">2392<jmethodID/>2393<description>2394The method executing in this frame.2395</description>2396</field>2397<field id="location">2398<jlocation/>2399<description>2400The 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>24052406<typedef id="jvmtiStackInfo" label="Stack information structure">2407<description>2408Information about a set of stack frames is returned in this structure.2409</description>2410<field id="thread">2411<jthread/>2412<description>2413On return, the thread traced.2414</description>2415</field>2416<field id="state">2417<jint/>2418<description>2419On 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>2427On return, this agent allocated buffer is filled2428with stack frame information.2429</description>2430</field>2431<field id="frame_count">2432<jint/>2433<description>2434On return, the number of records filled into2435<code>frame_buffer</code>.2436This will be2437min(<code>max_frame_count</code>, <i>stackDepth</i>).2438</description>2439</field>2440</typedef>24412442<function id="GetStackTrace" num="104">2443<synopsis>Get Stack Trace</synopsis>2444<description>2445Get information about the stack of a thread.2446If <paramlink id="max_frame_count"></paramlink> is less than the depth of the stack,2447the <paramlink id="max_frame_count"></paramlink> topmost frames are returned,2448otherwise the entire stack is returned.2449The topmost frames, those most recently invoked, are at the beginning of the returned buffer.2450<p/>2451The following example causes up to five of the topmost frames2452to be returned and (if there are any frames) the currently2453executing method name to be printed.2454<example>2455jvmtiFrameInfo frames[5];2456jint count;2457jvmtiError err;24582459err = (*jvmti)->GetStackTrace(jvmti, aThread, 0, 5,2460frames, &count);2461if (err == JVMTI_ERROR_NONE && count >= 1) {2462char *methodName;2463err = (*jvmti)->GetMethodName(jvmti, frames[0].method,2464&methodName, NULL, NULL);2465if (err == JVMTI_ERROR_NONE) {2466printf("Executing method: %s", methodName);2467}2468}2469</example>2470<todo>2471check example code.2472</todo>2473<p/>2474The <paramlink id="thread"></paramlink> need not be suspended2475to call this function.2476<p/>2477The <functionlink id="GetLineNumberTable"></functionlink>2478function can be used to map locations to line numbers. Note that2479this 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>2488Fetch the stack trace of this thread.2489</description>2490</param>2491<param id="start_depth">2492<jint/>2493<description>2494Begin retrieving frames at this depth.2495If non-negative, count from the current frame,2496the first frame retrieved is at depth <code>start_depth</code>.2497For example, if zero, start from the current frame; if one, start from the2498caller of the current frame; if two, start from the caller of the2499caller of the current frame; and so on.2500If negative, count from below the oldest frame,2501the first frame retrieved is at depth <i>stackDepth</i><code> + start_depth</code>,2502where <i>stackDepth</i> is the count of frames on the stack.2503For example, if negative one, only the oldest frame is retrieved;2504if 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>2510The 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>2518On return, this agent allocated buffer is filled2519with stack frame information.2520</description>2521</param>2522<param id="count_ptr">2523<outptr><jint/></outptr>2524<description>2525On return, points to the number of records filled in.2526For non-negative <code>start_depth</code>, this will be2527min(<code>max_frame_count</code>, <i>stackDepth</i><code> - start_depth</code>).2528For negative <code>start_depth</code>, this will be2529min(<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>.2536Or <paramlink id="start_depth"/> is negative and less than <i>-stackDepth</i>.2537</error>2538</errors>2539</function>254025412542<function id="GetAllStackTraces" num="100">2543<synopsis>Get All Stack Traces</synopsis>2544<description>2545Get information about the stacks of all live threads2546(including <internallink id="RunAgentThread">agent threads</internallink>).2547If <paramlink id="max_frame_count"/> is less than the depth of a stack,2548the <paramlink id="max_frame_count"/> topmost frames are returned for that thread,2549otherwise the entire stack is returned.2550The topmost frames, those most recently invoked, are at the beginning of the returned buffer.2551<p/>2552All stacks are collected simultaneously, that is, no changes will occur to the2553thread state or stacks between the sampling of one thread and the next.2554The threads need not be suspended.25552556<example>2557jvmtiStackInfo *stack_info;2558jint thread_count;2559int ti;2560jvmtiError err;25612562err = (*jvmti)->GetAllStackTraces(jvmti, MAX_FRAMES, &stack_info, &thread_count);2563if (err != JVMTI_ERROR_NONE) {2564...2565}2566for (ti = 0; ti < thread_count; ++ti) {2567jvmtiStackInfo *infop = &stack_info[ti];2568jthread thread = infop->thread;2569jint state = infop->state;2570jvmtiFrameInfo *frames = infop->frame_buffer;2571int fi;25722573myThreadAndStatePrinter(thread, state);2574for (fi = 0; fi < infop->frame_count; fi++) {2575myFramePrinter(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>2582check example code.2583</todo>25842585</description>2586<origin>new</origin>2587<capabilities>2588</capabilities>2589<parameters>2590<param id="max_frame_count">2591<jint min="0"/>2592<description>2593The 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>2601On return, this buffer is filled2602with stack information for each thread.2603The number of <datalink id="jvmtiStackInfo"/> records is determined2604by <paramlink id="thread_count_ptr"/>.2605<p/>2606Note that this buffer is allocated to include the <datalink id="jvmtiFrameInfo"/>2607buffers pointed to by <datalink id="jvmtiStackInfo.frame_buffer"/>.2608These buffers must not be separately deallocated.2609</description>2610</param>2611<param id="thread_count_ptr">2612<outptr><jint/></outptr>2613<description>2614The number of threads traced.2615</description>2616</param>2617</parameters>2618<errors>2619</errors>2620</function>26212622<function id="GetThreadListStackTraces" num="101">2623<synopsis>Get Thread List Stack Traces</synopsis>2624<description>2625Get information about the stacks of the supplied threads.2626If <paramlink id="max_frame_count"/> is less than the depth of a stack,2627the <paramlink id="max_frame_count"/> topmost frames are returned for that thread,2628otherwise the entire stack is returned.2629The topmost frames, those most recently invoked, are at the beginning of the returned buffer.2630<p/>2631All stacks are collected simultaneously, that is, no changes will occur to the2632thread state or stacks between the sampling one thread and the next.2633The threads need not be suspended.2634<p/>2635If a thread has not yet started or terminates before the stack information is collected,2636a zero length stack (<datalink id="jvmtiStackInfo.frame_count"/> will be zero)2637will be returned and the thread <datalink id="jvmtiStackInfo.state"/> can be checked.2638<p/>2639See the example for the similar function2640<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>2649The number of threads to trace.2650</description>2651</param>2652<param id="thread_list">2653<inbuf incount="thread_count"><jthread/></inbuf>2654<description>2655The list of threads to trace.2656</description>2657</param>2658<param id="max_frame_count">2659<jint min="0"/>2660<description>2661The 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>2669On return, this buffer is filled2670with stack information for each thread.2671The number of <datalink id="jvmtiStackInfo"/> records is determined2672by <paramlink id="thread_count"/>.2673<p/>2674Note that this buffer is allocated to include the <datalink id="jvmtiFrameInfo"/>2675buffers pointed to by <datalink id="jvmtiStackInfo.frame_buffer"/>.2676These buffers must not be separately deallocated.2677</description>2678</param>2679</parameters>2680<errors>2681<error id="JVMTI_ERROR_INVALID_THREAD">2682An element in <paramlink id="thread_list"/> is not a thread object.2683</error>2684</errors>2685</function>26862687<elide>2688<function id="AsyncGetStackTrace" num="1000">2689<synopsis>Get Stack Trace--Asynchronous</synopsis>2690<description>2691Get information about the entire stack of a thread (or a sub-section of it).2692This is the asynchronous version of <functionlink id="GetStackTrace"></functionlink>2693and is reentrant and safe to call2694from asynchronous signal handlers.2695The stack trace is returned only for the calling thread.2696<p/>2697The <functionlink id="GetLineNumberTable"></functionlink>2698function can be used to map locations to line numbers. Note that2699this 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">2705If <code>false</code>,2706<paramlink id="use_java_stack"></paramlink>2707must be <code>false</code>.2708</capability>2709</capabilities>2710<parameters>2711<param id="use_java_stack">2712<jboolean/>2713<description>2714Return the stack showing <vmspec/>2715model of the stack;2716otherwise, show the internal representation of the stack with2717inlined and optimized methods missing. If the virtual machine2718is using the <i>Java Virtual Machine Specification</i> stack model2719internally, this flag is ignored.2720</description>2721</param>2722<param id="max_count">2723<jint min="0"/>2724<description>2725The maximum number of <datalink id="jvmtiFrameInfo"/> records to retrieve.2726Retrieve 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>2735The agent passes in a buffer2736large enough to hold <code>max_count</code> records of2737<datalink id="jvmtiFrameInfo"></datalink>. This buffer must be2738pre-allocated by the agent.2739</description>2740</param>2741<param id="count_ptr">2742<outptr><jint/></outptr>2743<description>2744On return, points to the number of records filled in..2745</description>2746</param>2747</parameters>2748<errors>2749<error id="JVMTI_ERROR_UNATTACHED_THREAD">2750The thread being used to call this function is not attached2751to the virtual machine. Calls must be made from attached threads.2752</error>2753</errors>2754</function>2755</elide>27562757<function id="GetFrameCount" num="16">2758<synopsis>Get Frame Count</synopsis>2759<description>2760Get the number of frames currently in the specified thread's call stack.2761<p/>2762If this function is called for a thread actively executing bytecodes (for example,2763not 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>2772The thread to query.2773</description>2774</param>2775<param id="count_ptr">2776<outptr><jint/></outptr>2777<description>2778On return, points to the number of frames in the call stack.2779</description>2780</param>2781</parameters>2782<errors>2783</errors>2784</function>27852786<function id="PopFrame" num="80">2787<synopsis>Pop Frame</synopsis>2788<description>2789Pop the current frame of <code>thread</code>'s stack.2790Popping a frame takes you to the previous frame.2791When the thread is resumed, the execution2792state of the thread is reset to the state2793immediately before the called method was invoked.2794That 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 back2798and 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 opcode2801of the invoke instruction</li>2802</ul>2803Note however, that any changes to the arguments, which2804occurred in the called method, remain;2805when execution continues, the first instruction to2806execute will be the invoke.2807<p/>2808Between calling <code>PopFrame</code> and resuming the2809thread the state of the stack is undefined.2810To pop frames beyond the first,2811these 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/>2818A lock acquired by calling the called method2819(if it is a <code>synchronized</code> method)2820and locks acquired by entering <code>synchronized</code>2821blocks within the called method are released.2822Note: this does not apply to native locks or2823<code>java.util.concurrent.locks</code> locks.2824<p/>2825Finally blocks are not executed.2826<p/>2827Changes to global state are not addressed and thus remain changed.2828<p/>2829The specified thread must be suspended or must be the current thread.2830<p/>2831Both the called method and calling method must be non-native Java programming2832language methods.2833<p/>2834No <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>2844The thread whose current frame is to be popped.2845</description>2846</param>2847</parameters>2848<errors>2849<error id="JVMTI_ERROR_OPAQUE_FRAME">2850Called or calling method is a native method.2851The implementation is unable to pop this frame.2852</error>2853<error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">2854Thread was not suspended and was not the current thread.2855</error>2856<error id="JVMTI_ERROR_NO_MORE_FRAMES">2857There are less than two stack frames on the call stack.2858</error>2859</errors>2860</function>28612862<function id="GetFrameLocation" num="19">2863<synopsis>Get Frame Location</synopsis>2864<description>2865<p/>2866For a Java programming language frame, return the location of the instruction2867currently 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>2876The thread of the frame to query.2877</description>2878</param>2879<param id="depth">2880<jframeID thread="thread"/>2881<description>2882The depth of the frame to query.2883</description>2884</param>2885<param id="method_ptr">2886<outptr><jmethodID/></outptr>2887<description>2888On return, points to the method for the current location.2889</description>2890</param>2891<param id="location_ptr">2892<outptr><jlocation/></outptr>2893<description>2894On return, points to the index of the currently2895executing instruction.2896Is set to <code>-1</code> if the frame is executing2897a native method.2898</description>2899</param>2900</parameters>2901<errors>2902</errors>2903</function>29042905<function id="NotifyFramePop" num="20">2906<synopsis>Notify Frame Pop</synopsis>2907<description>2908When the frame that is currently at <paramlink id="depth"></paramlink>2909is popped from the stack, generate a2910<eventlink id="FramePop"></eventlink> event. See the2911<eventlink id="FramePop"></eventlink> event for details.2912Only frames corresponding to non-native Java programming language2913methods can receive notification.2914<p/>2915The 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>2925The 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>2931The 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">2937The frame at <code>depth</code> is executing a2938native method.2939</error>2940<error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">2941Thread was not suspended and was not the current thread.2942</error>2943</errors>2944</function>29452946</category>29472948<category id="ForceEarlyReturn" label="Force Early Return">2949<intro>2950These functions allow an agent to force a method2951to return at any point during its execution.2952The method which will return early is referred to as the <i>called method</i>.2953The called method is the current method2954(as defined by2955<vmspec chapter="3.6"/>)2956for the specified thread at2957the time the function is called.2958<p/>2959The specified thread must be suspended or must be the current thread.2960The return occurs when execution of Java programming2961language code is resumed on this thread.2962Between calling one of these functions and resumption2963of thread execution, the state of the stack is undefined.2964<p/>2965No further instructions are executed in the called method.2966Specifically, finally blocks are not executed.2967Note: this can cause inconsistent states in the application.2968<p/>2969A lock acquired by calling the called method2970(if it is a <code>synchronized</code> method)2971and locks acquired by entering <code>synchronized</code>2972blocks within the called method are released.2973Note: this does not apply to native locks or2974<code>java.util.concurrent.locks</code> locks.2975<p/>2976Events, such as <eventlink id="MethodExit"></eventlink>,2977are generated as they would be in a normal return.2978<p/>2979The called method must be a non-native Java programming2980language method.2981Forcing return on a thread with only one frame on the2982stack causes the thread to exit when resumed.2983</intro>29842985<function id="ForceEarlyReturnObject" num="81" since="1.1">2986<synopsis>Force Early Return - Object</synopsis>2987<description>2988This function can be used to return from a method whose2989result type is <code>Object</code>2990or 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>3000The thread whose current frame is to return early.3001</description>3002</param>3003<param id="value">3004<jobject/>3005<description>3006The return value for the called frame.3007An object or <code>NULL</code>.3008</description>3009</param>3010</parameters>3011<errors>3012<error id="JVMTI_ERROR_OPAQUE_FRAME">3013Attempted to return early from a frame3014corresponding to a native method.3015Or the implementation is unable to provide3016this functionality on this frame.3017</error>3018<error id="JVMTI_ERROR_TYPE_MISMATCH">3019The result type of the called method is not3020<code>Object</code> or a subclass of <code>Object</code>.3021</error>3022<error id="JVMTI_ERROR_TYPE_MISMATCH">3023The supplied <paramlink id="value"/> is not compatible with the3024result type of the called method.3025</error>3026<error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">3027Thread was not suspended and was not the current thread.3028</error>3029<error id="JVMTI_ERROR_NO_MORE_FRAMES">3030There are no more frames on the call stack.3031</error>3032</errors>3033</function>30343035<function id="ForceEarlyReturnInt" num="82" since="1.1">3036<synopsis>Force Early Return - Int</synopsis>3037<description>3038This function can be used to return from a method whose3039result type is <code>int</code>, <code>short</code>,3040<code>char</code>, <code>byte</code>, or3041<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>3051The thread whose current frame is to return early.3052</description>3053</param>3054<param id="value">3055<jint/>3056<description>3057The return value for the called frame.3058</description>3059</param>3060</parameters>3061<errors>3062<error id="JVMTI_ERROR_OPAQUE_FRAME">3063Attempted to return early from a frame3064corresponding to a native method.3065Or the implementation is unable to provide3066this functionality on this frame.3067</error>3068<error id="JVMTI_ERROR_TYPE_MISMATCH">3069The result type of the called method is not3070<code>int</code>, <code>short</code>,3071<code>char</code>, <code>byte</code>, or3072<code>boolean</code>.3073</error>3074<error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">3075Thread was not suspended and was not the current thread.3076</error>3077<error id="JVMTI_ERROR_NO_MORE_FRAMES">3078There are no frames on the call stack.3079</error>3080</errors>3081</function>30823083<function id="ForceEarlyReturnLong" num="83" since="1.1">3084<synopsis>Force Early Return - Long</synopsis>3085<description>3086This function can be used to return from a method whose3087result 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>3097The thread whose current frame is to return early.3098</description>3099</param>3100<param id="value">3101<jlong/>3102<description>3103The return value for the called frame.3104</description>3105</param>3106</parameters>3107<errors>3108<error id="JVMTI_ERROR_OPAQUE_FRAME">3109Attempted to return early from a frame3110corresponding to a native method.3111Or the implementation is unable to provide3112this functionality on this frame.3113</error>3114<error id="JVMTI_ERROR_TYPE_MISMATCH">3115The result type of the called method is not <code>long</code>.3116</error>3117<error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">3118Thread was not suspended and was not the current thread.3119</error>3120<error id="JVMTI_ERROR_NO_MORE_FRAMES">3121There are no frames on the call stack.3122</error>3123</errors>3124</function>31253126<function id="ForceEarlyReturnFloat" num="84" since="1.1">3127<synopsis>Force Early Return - Float</synopsis>3128<description>3129This function can be used to return from a method whose3130result 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>3140The thread whose current frame is to return early.3141</description>3142</param>3143<param id="value">3144<jfloat/>3145<description>3146The return value for the called frame.3147</description>3148</param>3149</parameters>3150<errors>3151<error id="JVMTI_ERROR_OPAQUE_FRAME">3152Attempted to return early from a frame3153corresponding to a native method.3154Or the implementation is unable to provide3155this functionality on this frame.3156</error>3157<error id="JVMTI_ERROR_TYPE_MISMATCH">3158The result type of the called method is not <code>float</code>.3159</error>3160<error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">3161Thread was not suspended and was not the current thread.3162</error>3163<error id="JVMTI_ERROR_NO_MORE_FRAMES">3164There are no frames on the call stack.3165</error>3166</errors>3167</function>31683169<function id="ForceEarlyReturnDouble" num="85" since="1.1">3170<synopsis>Force Early Return - Double</synopsis>3171<description>3172This function can be used to return from a method whose3173result 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>3183The thread whose current frame is to return early.3184</description>3185</param>3186<param id="value">3187<jdouble/>3188<description>3189The return value for the called frame.3190</description>3191</param>3192</parameters>3193<errors>3194<error id="JVMTI_ERROR_OPAQUE_FRAME">3195Attempted to return early from a frame corresponding to a native method.3196Or the implementation is unable to provide this functionality on this frame.3197</error>3198<error id="JVMTI_ERROR_TYPE_MISMATCH">3199The result type of the called method is not <code>double</code>.3200</error>3201<error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">3202Thread was not suspended and was not the current thread.3203</error>3204<error id="JVMTI_ERROR_NO_MORE_FRAMES">3205There are no frames on the call stack.3206</error>3207</errors>3208</function>32093210<function id="ForceEarlyReturnVoid" num="86" since="1.1">3211<synopsis>Force Early Return - Void</synopsis>3212<description>3213This function can be used to return from a method with no result type.3214That 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>3224The thread whose current frame is to return early.3225</description>3226</param>3227</parameters>3228<errors>3229<error id="JVMTI_ERROR_OPAQUE_FRAME">3230Attempted to return early from a frame3231corresponding to a native method.3232Or the implementation is unable to provide3233this functionality on this frame.3234</error>3235<error id="JVMTI_ERROR_TYPE_MISMATCH">3236The called method has a result type.3237</error>3238<error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">3239Thread was not suspended and was not the current thread.3240</error>3241<error id="JVMTI_ERROR_NO_MORE_FRAMES">3242There are no frames on the call stack.3243</error>3244</errors>3245</function>32463247</category>32483249<category id="Heap" label="Heap">3250<intro>3251These functions are used to analyze the heap.3252Functionality includes the ability to view the objects in the3253heap and to tag these objects.3254</intro>32553256<intro id="objectTags" label="Object Tags">3257A <i>tag</i> is a value associated with an object.3258Tags are explicitly set by the agent using the3259<functionlink id="SetTag"></functionlink> function or by3260callback functions such as <functionlink id="jvmtiHeapIterationCallback"/>.3261<p/>3262Tags are local to the environment; that is, the tags of one3263environment are not visible in another.3264<p/>3265Tags are <code>jlong</code> values which can be used3266simply to mark an object or to store a pointer to more detailed3267information. Objects which have not been tagged have a3268tag of zero.3269Setting a tag to zero makes the object untagged.3270</intro>32713272<intro id="heapCallbacks" label="Heap Callback Functions">3273Heap functions which iterate through the heap and recursively3274follow object references use agent supplied callback functions3275to deliver the information.3276<p/>3277These heap callback functions must adhere to the following restrictions --3278These callbacks must not use JNI functions.3279These callbacks must not use <jvmti/> functions except3280<i>callback safe</i> functions which3281specifically allow such use (see the raw monitor, memory management,3282and environment local storage functions).3283<p/>3284An implementation may invoke a callback on an internal thread or3285the thread which called the iteration function.3286Heap callbacks are single threaded -- no more than one callback will3287be invoked at a time.3288<p/>3289The Heap Filter Flags can be used to prevent reporting3290based on the tag status of an object or its class.3291If no flags are set (the <code>jint</code> is zero), objects3292will not be filtered out.32933294<constants id="jvmtiHeapFilter" label="Heap Filter Flags" kind="bits">3295<constant id="JVMTI_HEAP_FILTER_TAGGED" num="0x4">3296Filter out tagged objects. Objects which are tagged are not included.3297</constant>3298<constant id="JVMTI_HEAP_FILTER_UNTAGGED" num="0x8">3299Filter out untagged objects. Objects which are not tagged are not included.3300</constant>3301<constant id="JVMTI_HEAP_FILTER_CLASS_TAGGED" num="0x10">3302Filter 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">3305Filter out objects with untagged classes. Objects whose class is not tagged are not included.3306</constant>3307</constants>33083309<p/>3310The Heap Visit Control Flags are returned by the heap callbacks3311and can be used to abort the iteration. For the3312<functionlink id="jvmtiHeapReferenceCallback">Heap3313Reference Callback</functionlink>, it can also be used3314to prune the graph of traversed references3315(<code>JVMTI_VISIT_OBJECTS</code> is not set).33163317<constants id="jvmtiHeapVisitControl"3318label="Heap Visit Control Flags"3319kind="bits"3320since="1.1">3321<constant id="JVMTI_VISIT_OBJECTS" num="0x100">3322If we are visiting an object and if this callback3323was initiated by <functionlink id="FollowReferences"/>,3324traverse the references of this object.3325Otherwise ignored.3326</constant>3327<constant id="JVMTI_VISIT_ABORT" num="0x8000">3328Abort the iteration. Ignore all other bits.3329</constant>3330</constants>33313332<p/>3333The Heap Reference Enumeration is provided by the3334<functionlink id="jvmtiHeapReferenceCallback">Heap3335Reference Callback</functionlink> and3336<functionlink id="jvmtiPrimitiveFieldCallback">Primitive Field3337Callback</functionlink> to3338describe the kind of reference3339being reported.33403341<constants id="jvmtiHeapReferenceKind"3342label="Heap Reference Enumeration"3343kind="enum"3344since="1.1">3345<constant id="JVMTI_HEAP_REFERENCE_CLASS" num="1">3346Reference from an object to its class.3347</constant>3348<constant id="JVMTI_HEAP_REFERENCE_FIELD" num="2">3349Reference from an object to the value of one of its instance fields.3350</constant>3351<constant id="JVMTI_HEAP_REFERENCE_ARRAY_ELEMENT" num="3">3352Reference from an array to one of its elements.3353</constant>3354<constant id="JVMTI_HEAP_REFERENCE_CLASS_LOADER" num="4">3355Reference from a class to its class loader.3356</constant>3357<constant id="JVMTI_HEAP_REFERENCE_SIGNERS" num="5">3358Reference from a class to its signers array.3359</constant>3360<constant id="JVMTI_HEAP_REFERENCE_PROTECTION_DOMAIN" num="6">3361Reference from a class to its protection domain.3362</constant>3363<constant id="JVMTI_HEAP_REFERENCE_INTERFACE" num="7">3364Reference from a class to one of its interfaces.3365Note: interfaces are defined via a constant pool reference,3366so the referenced interfaces may also be reported with a3367<code>JVMTI_HEAP_REFERENCE_CONSTANT_POOL</code> reference kind.3368</constant>3369<constant id="JVMTI_HEAP_REFERENCE_STATIC_FIELD" num="8">3370Reference from a class to the value of one of its static fields.3371</constant>3372<constant id="JVMTI_HEAP_REFERENCE_CONSTANT_POOL" num="9">3373Reference from a class to a resolved entry in the constant pool.3374</constant>3375<constant id="JVMTI_HEAP_REFERENCE_SUPERCLASS" num="10">3376Reference from a class to its superclass.3377A callback is not sent if the superclass is <code>java.lang.Object</code>.3378Note: loaded classes define superclasses via a constant pool3379reference, so the referenced superclass may also be reported with3380a <code>JVMTI_HEAP_REFERENCE_CONSTANT_POOL</code> reference kind.3381</constant>3382<constant id="JVMTI_HEAP_REFERENCE_JNI_GLOBAL" num="21">3383Heap root reference: JNI global reference.3384</constant>3385<constant id="JVMTI_HEAP_REFERENCE_SYSTEM_CLASS" num="22">3386Heap root reference: System class.3387</constant>3388<constant id="JVMTI_HEAP_REFERENCE_MONITOR" num="23">3389Heap root reference: monitor.3390</constant>3391<constant id="JVMTI_HEAP_REFERENCE_STACK_LOCAL" num="24">3392Heap root reference: local variable on the stack.3393</constant>3394<constant id="JVMTI_HEAP_REFERENCE_JNI_LOCAL" num="25">3395Heap root reference: JNI local reference.3396</constant>3397<constant id="JVMTI_HEAP_REFERENCE_THREAD" num="26">3398Heap root reference: Thread.3399</constant>3400<constant id="JVMTI_HEAP_REFERENCE_OTHER" num="27">3401Heap root reference: other heap root reference.3402</constant>3403</constants>34043405<p/>3406Definitions for the single character type descriptors of3407primitive types.34083409<constants id="jvmtiPrimitiveType"3410label="Primitive Type Enumeration"3411kind="enum"3412since="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>34393440<typedef id="jvmtiHeapReferenceInfoField"3441label="Reference information structure for Field references"3442since="1.1">3443<description>3444Reference information returned for3445<datalink id="JVMTI_HEAP_REFERENCE_FIELD"/> and3446<datalink id="JVMTI_HEAP_REFERENCE_STATIC_FIELD"/> references.3447</description>3448<field id="index">3449<jint/>3450<description>3451For <datalink id="JVMTI_HEAP_REFERENCE_FIELD"/>, the3452referrer object is not a class or an interface.3453In this case, <code>index</code> is the index of the field3454in the class of the referrer object.3455This class is referred to below as <i>C</i>.3456<p/>3457For <datalink id="JVMTI_HEAP_REFERENCE_STATIC_FIELD"/>,3458the referrer object is a class (referred to below as <i>C</i>)3459or an interface (referred to below as <i>I</i>).3460In this case, <code>index</code> is the index of the field in3461that class or interface.3462<p/>3463If the referrer object is not an interface, then the field3464indices are determined as follows:3465<ul>3466<li>make a list of all the fields in <i>C</i> and its3467superclasses, starting with all the fields in3468<code>java.lang.Object</code> and ending with all the3469fields in <i>C</i>.</li>3470<li>Within this list, put3471the fields for a given class in the order returned by3472<functionlink id="GetClassFields"/>.</li>3473<li>Assign the fields in this list indices3474<i>n</i>, <i>n</i>+1, ..., in order, where <i>n</i>3475is the count of the fields in all the interfaces3476implemented by <i>C</i>.3477Note that <i>C</i> implements all interfaces3478directly implemented by its superclasses; as well3479as all superinterfaces of these interfaces.</li>3480</ul>3481If the referrer object is an interface, then the field3482indices are determined as follows:3483<ul>3484<li>make a list of the fields directly declared in3485<i>I</i>.</li>3486<li>Within this list, put3487the fields in the order returned by3488<functionlink id="GetClassFields"/>.</li>3489<li>Assign the fields in this list indices3490<i>n</i>, <i>n</i>+1, ..., in order, where <i>n</i>3491is the count of the fields in all the superinterfaces3492of <i>I</i>.</li>3493</ul>3494All fields are included in this computation, regardless of3495field modifier (static, public, private, etc).3496<p/>3497For example, given the following classes and interfaces:3498<example>3499interface I0 {3500int p = 0;3501}35023503interface I1 extends I0 {3504int x = 1;3505}35063507interface I2 extends I0 {3508int y = 2;3509}35103511class C1 implements I1 {3512public static int a = 3;3513private int b = 4;3514}35153516class C2 extends C1 implements I2 {3517static int q = 5;3518final int r = 6;3519}3520</example>3521Assume that <functionlink id="GetClassFields"/> called on3522<code>C1</code> returns the fields of <code>C1</code> in the3523order: a, b; and that the fields of <code>C2</code> are3524returned in the order: q, r.3525An instance of class <code>C1</code> will have the3526following 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">3535a3536</th>3537<td class="centered">353823539</td>3540<td>3541The count of the fields in the interfaces3542implemented by <code>C1</code> is two (<i>n</i>=2):3543<code>p</code> of <code>I0</code>3544and <code>x</code> of <code>I1</code>.3545</td>3546</tr>3547<tr>3548<th class="centered" scope="row">3549b3550</th>3551<td class="centered">355233553</td>3554<td>3555the subsequent index.3556</td>3557</tr>3558</table></blockquote>3559The class <code>C1</code> will have the same field indices.3560<p/>3561An instance of class <code>C2</code> will have the3562following 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">3571a3572</th>3573<td class="centered">357433575</td>3576<td>3577The count of the fields in the interfaces3578implemented 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>3582of <code>I0</code> is only included once.3583</td>3584</tr>3585<tr>3586<th class="centered" scope="row">3587b3588</th>3589<td class="centered">359043591</td>3592<td>3593the subsequent index to "a".3594</td>3595</tr>3596<tr>3597<th class="centered" scope="row">3598q3599</th>3600<td class="centered">360153602</td>3603<td>3604the subsequent index to "b".3605</td>3606</tr>3607<tr>3608<th class="centered" scope="row">3609r3610</th>3611<td class="centered">361263613</td>3614<td>3615the subsequent index to "q".3616</td>3617</tr>3618</table></blockquote>3619The class <code>C2</code> will have the same field indices.3620Note that a field may have a different index depending on the3621object that is viewing it -- for example field "a" above.3622Note also: not all field indices may be visible from the3623callbacks, but all indices are shown for illustrative purposes.3624<p/>3625The interface <code>I1</code> will have the3626following 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">3635x3636</th>3637<td class="centered">363813639</td>3640<td>3641The count of the fields in the superinterfaces3642of <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>36503651<typedef id="jvmtiHeapReferenceInfoArray"3652label="Reference information structure for Array references"3653since="1.1">3654<description>3655Reference information returned for3656<datalink id="JVMTI_HEAP_REFERENCE_ARRAY_ELEMENT"/> references.3657</description>3658<field id="index">3659<jint/>3660<description>3661The array index.3662</description>3663</field>3664</typedef>36653666<typedef id="jvmtiHeapReferenceInfoConstantPool"3667label="Reference information structure for Constant Pool references"3668since="1.1">3669<description>3670Reference information returned for3671<datalink id="JVMTI_HEAP_REFERENCE_CONSTANT_POOL"/> references.3672</description>3673<field id="index">3674<jint/>3675<description>3676The index into the constant pool of the class. See the description in3677<vmspec chapter="4.4"/>.3678</description>3679</field>3680</typedef>36813682<typedef id="jvmtiHeapReferenceInfoStackLocal"3683label="Reference information structure for Local Variable references"3684since="1.1">3685<description>3686Reference information returned for3687<datalink id="JVMTI_HEAP_REFERENCE_STACK_LOCAL"/> references.3688</description>3689<field id="thread_tag">3690<jlong/>3691<description>3692The 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>3698The unique thread ID of the thread corresponding to this stack.3699</description>3700</field>3701<field id="depth">3702<jint/>3703<description>3704The depth of the frame.3705</description>3706</field>3707<field id="method">3708<jmethodID/>3709<description>3710The method executing in this frame.3711</description>3712</field>3713<field id="location">3714<jlocation/>3715<description>3716The currently executing location in this frame.3717</description>3718</field>3719<field id="slot">3720<jint/>3721<description>3722The slot number of the local variable.3723</description>3724</field>3725</typedef>37263727<typedef id="jvmtiHeapReferenceInfoJniLocal"3728label="Reference information structure for JNI local references"3729since="1.1">3730<description>3731Reference information returned for3732<datalink id="JVMTI_HEAP_REFERENCE_JNI_LOCAL"/> references.3733</description>3734<field id="thread_tag">3735<jlong/>3736<description>3737The 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>3743The unique thread ID of the thread corresponding to this stack.3744</description>3745</field>3746<field id="depth">3747<jint/>3748<description>3749The depth of the frame.3750</description>3751</field>3752<field id="method">3753<jmethodID/>3754<description>3755The method executing in this frame.3756</description>3757</field>3758</typedef>37593760<typedef id="jvmtiHeapReferenceInfoReserved"3761label="Reference information structure for Other references"3762since="1.1">3763<description>3764Reference information returned for other references.3765</description>3766<field id="reserved1">3767<jlong/>3768<description>3769reserved for future use.3770</description>3771</field>3772<field id="reserved2">3773<jlong/>3774<description>3775reserved for future use.3776</description>3777</field>3778<field id="reserved3">3779<jlong/>3780<description>3781reserved for future use.3782</description>3783</field>3784<field id="reserved4">3785<jlong/>3786<description>3787reserved for future use.3788</description>3789</field>3790<field id="reserved5">3791<jlong/>3792<description>3793reserved for future use.3794</description>3795</field>3796<field id="reserved6">3797<jlong/>3798<description>3799reserved for future use.3800</description>3801</field>3802<field id="reserved7">3803<jlong/>3804<description>3805reserved for future use.3806</description>3807</field>3808<field id="reserved8">3809<jlong/>3810<description>3811reserved for future use.3812</description>3813</field>3814</typedef>38153816<uniontypedef id="jvmtiHeapReferenceInfo"3817label="Reference information structure"3818since="1.1">3819<description>3820The information returned about referrers.3821Represented as a union of the various kinds of reference information.3822</description>3823<field id="field">3824<struct>jvmtiHeapReferenceInfoField</struct>3825<description>3826The referrer information for3827<datalink id="JVMTI_HEAP_REFERENCE_FIELD"/>3828and <datalink id="JVMTI_HEAP_REFERENCE_STATIC_FIELD"/> references.3829</description>3830</field>3831<field id="array">3832<struct>jvmtiHeapReferenceInfoArray</struct>3833<description>3834The referrer information for3835For <datalink id="JVMTI_HEAP_REFERENCE_ARRAY_ELEMENT"/> references.3836</description>3837</field>3838<field id="constant_pool">3839<struct>jvmtiHeapReferenceInfoConstantPool</struct>3840<description>3841The referrer information for3842For <datalink id="JVMTI_HEAP_REFERENCE_CONSTANT_POOL"/> references.3843</description>3844</field>3845<field id="stack_local">3846<struct>jvmtiHeapReferenceInfoStackLocal</struct>3847<description>3848The referrer information for3849For <datalink id="JVMTI_HEAP_REFERENCE_STACK_LOCAL"/> references.3850</description>3851</field>3852<field id="jni_local">3853<struct>jvmtiHeapReferenceInfoJniLocal</struct>3854<description>3855The referrer information for3856For <datalink id="JVMTI_HEAP_REFERENCE_JNI_LOCAL"/> references.3857</description>3858</field>3859<field id="other">3860<struct>jvmtiHeapReferenceInfoReserved</struct>3861<description>3862reserved for future use.3863</description>3864</field>3865</uniontypedef>38663867<typedef id="jvmtiHeapCallbacks"3868label="Heap callback function structure"3869since="1.1">3870<field id="heap_iteration_callback">3871<ptrtype>3872<struct>jvmtiHeapIterationCallback</struct>3873</ptrtype>3874<description>3875The callback to be called to describe an3876object in the heap. Used by the3877<functionlink id="IterateThroughHeap"/> function, ignored by the3878<functionlink id="FollowReferences"/> function.3879</description>3880</field>3881<field id="heap_reference_callback">3882<ptrtype>3883<struct>jvmtiHeapReferenceCallback</struct>3884</ptrtype>3885<description>3886The callback to be called to describe an3887object reference. Used by the3888<functionlink id="FollowReferences"/> function, ignored by the3889<functionlink id="IterateThroughHeap"/> function.3890</description>3891</field>3892<field id="primitive_field_callback">3893<ptrtype>3894<struct>jvmtiPrimitiveFieldCallback</struct>3895</ptrtype>3896<description>3897The callback to be called to describe a3898primitive field.3899</description>3900</field>3901<field id="array_primitive_value_callback">3902<ptrtype>3903<struct>jvmtiArrayPrimitiveValueCallback</struct>3904</ptrtype>3905<description>3906The callback to be called to describe an3907array of primitive values.3908</description>3909</field>3910<field id="string_primitive_value_callback">3911<ptrtype>3912<struct>jvmtiStringPrimitiveValueCallback</struct>3913</ptrtype>3914<description>3915The 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>3923Reserved for future use..3924</description>3925</field>3926<field id="reserved6">3927<ptrtype>3928<struct>jvmtiReservedCallback</struct>3929</ptrtype>3930<description>3931Reserved for future use..3932</description>3933</field>3934<field id="reserved7">3935<ptrtype>3936<struct>jvmtiReservedCallback</struct>3937</ptrtype>3938<description>3939Reserved for future use..3940</description>3941</field>3942<field id="reserved8">3943<ptrtype>3944<struct>jvmtiReservedCallback</struct>3945</ptrtype>3946<description>3947Reserved for future use..3948</description>3949</field>3950<field id="reserved9">3951<ptrtype>3952<struct>jvmtiReservedCallback</struct>3953</ptrtype>3954<description>3955Reserved for future use..3956</description>3957</field>3958<field id="reserved10">3959<ptrtype>3960<struct>jvmtiReservedCallback</struct>3961</ptrtype>3962<description>3963Reserved for future use..3964</description>3965</field>3966<field id="reserved11">3967<ptrtype>3968<struct>jvmtiReservedCallback</struct>3969</ptrtype>3970<description>3971Reserved for future use..3972</description>3973</field>3974<field id="reserved12">3975<ptrtype>3976<struct>jvmtiReservedCallback</struct>3977</ptrtype>3978<description>3979Reserved for future use..3980</description>3981</field>3982<field id="reserved13">3983<ptrtype>3984<struct>jvmtiReservedCallback</struct>3985</ptrtype>3986<description>3987Reserved for future use..3988</description>3989</field>3990<field id="reserved14">3991<ptrtype>3992<struct>jvmtiReservedCallback</struct>3993</ptrtype>3994<description>3995Reserved for future use..3996</description>3997</field>3998<field id="reserved15">3999<ptrtype>4000<struct>jvmtiReservedCallback</struct>4001</ptrtype>4002<description>4003Reserved for future use..4004</description>4005</field>4006</typedef>400740084009<intro>4010<rationale>4011The heap dumping functionality (below) uses a callback4012for each object. While it would seem that a buffered approach4013would provide better throughput, tests do4014not show this to be the case--possibly due to locality of4015memory reference or array access overhead.4016</rationale>40174018<issue>4019Still under investigation as to if java.lang.ref references4020are reported as a different type of reference.4021</issue>40224023<issue>4024Should or can an indication of the cost or relative cost of4025these operations be included?4026</issue>40274028</intro>40294030<callback id="jvmtiHeapIterationCallback" since="1.1">4031<jint/>4032<synopsis>Heap Iteration Callback</synopsis>4033<description>4034Agent supplied callback function.4035Describes (but does not pass in) an object in the heap.4036<p/>4037This function should return a bit vector of the desired4038<datalink id="jvmtiHeapVisitControl">visit control flags</datalink>.4039This will determine if the entire iteration should be aborted4040(the <code>JVMTI_VISIT_OBJECTS</code> flag is ignored).4041<p/>4042See the <internallink id="heapCallbacks">heap callback4043function restrictions</internallink>.4044</description>4045<parameters>4046<param id="class_tag">4047<jlong/>4048<description>4049The tag of the class of object (zero if the class is not tagged).4050If the object represents a runtime class,4051the <code>class_tag</code> is the tag4052associated 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>4059Size of the object (in bytes). See <functionlink id="GetObjectSize"/>.4060</description>4061</param>4062<param id="tag_ptr">4063<outptr><jlong/></outptr>4064<description>4065The object tag value, or zero if the object is not tagged.4066To set the tag value to be associated with the object4067the agent sets the <code>jlong</code> pointed to by the parameter.4068</description>4069</param>4070<param id="length">4071<jint/>4072<description>4073If 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>4079The user supplied data that was passed into the iteration function.4080</description>4081</param>4082</parameters>4083</callback>40844085<callback id="jvmtiHeapReferenceCallback" since="1.1">4086<jint/>4087<synopsis>Heap Reference Callback</synopsis>4088<description>4089Agent supplied callback function.4090Describes a reference from an object or the VM (the referrer) to another object4091(the referree) or a heap root to a referree.4092<p/>4093This function should return a bit vector of the desired4094<datalink id="jvmtiHeapVisitControl">visit control flags</datalink>.4095This will determine if the objects referenced by the referree4096should be visited or if the entire iteration should be aborted.4097<p/>4098See the <internallink id="heapCallbacks">heap callback4099function restrictions</internallink>.4100</description>4101<parameters>4102<param id="reference_kind">4103<enum>jvmtiHeapReferenceKind</enum>4104<description>4105The kind of reference.4106</description>4107</param>4108<param id="reference_info">4109<inptr>4110<struct>jvmtiHeapReferenceInfo</struct>4111</inptr>4112<description>4113Details about the reference.4114Set when the <datalink id="jvmtiHeapReferenceCallback.reference_kind">reference_kind</datalink> is4115<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"/>,4120or <datalink id="JVMTI_HEAP_REFERENCE_JNI_LOCAL"/>.4121Otherwise <code>NULL</code>.4122</description>4123</param>4124<param id="class_tag">4125<jlong/>4126<description>4127The tag of the class of referree object (zero if the class is not tagged).4128If the referree object represents a runtime class,4129the <code>class_tag</code> is the tag4130associated 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>4137The tag of the class of the referrer object (zero if the class is not tagged4138or the referree is a heap root). If the referrer object represents a runtime4139class, the <code>referrer_class_tag</code> is the tag associated with4140the <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>4147Size of the referree object (in bytes).4148See <functionlink id="GetObjectSize"/>.4149</description>4150</param>4151<param id="tag_ptr">4152<outptr><jlong/></outptr>4153<description>4154Points to the referree object tag value, or zero if the object is not4155tagged.4156To set the tag value to be associated with the object4157the 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>4163Points to the tag of the referrer object, or4164points to the zero if the referrer4165object is not tagged.4166<code>NULL</code> if the referrer in not an object (that is,4167this callback is reporting a heap root).4168To set the tag value to be associated with the referrer object4169the agent sets the <code>jlong</code> pointed to by the parameter.4170If 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>4177If 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>4183The user supplied data that was passed into the iteration function.4184</description>4185</param>4186</parameters>4187</callback>41884189<callback id="jvmtiPrimitiveFieldCallback" since="1.1">4190<jint/>4191<synopsis>Primitive Field Callback</synopsis>4192<description>4193Agent supplied callback function which4194describes a primitive field of an object (<i>the object</i>).4195A primitive field is a field whose type is a primitive type.4196This callback will describe a static field if the object is a class,4197and otherwise will describe an instance field.4198<p/>4199This function should return a bit vector of the desired4200<datalink id="jvmtiHeapVisitControl">visit control flags</datalink>.4201This will determine if the entire iteration should be aborted4202(the <code>JVMTI_VISIT_OBJECTS</code> flag is ignored).4203<p/>4204See the <internallink id="heapCallbacks">heap callback4205function restrictions</internallink>.4206</description>4207<parameters>4208<param id="kind">4209<enum>jvmtiHeapReferenceKind</enum>4210<description>4211The kind of field -- instance or static (<datalink id="JVMTI_HEAP_REFERENCE_FIELD"/> or4212<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>4220Which field (the field index).4221</description>4222</param>4223<param id="object_class_tag">4224<jlong/>4225<description>4226The tag of the class of the object (zero if the class is not tagged).4227If the object represents a runtime class, the4228<code>object_class_tag</code> is the tag4229associated 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>4236Points to the tag of the object, or zero if the object is not4237tagged.4238To set the tag value to be associated with the object4239the agent sets the <code>jlong</code> pointed to by the parameter.4240</description>4241</param>4242<param id="value">4243<jvalue/>4244<description>4245The value of the field.4246</description>4247</param>4248<param id="value_type">4249<enum>jvmtiPrimitiveType</enum>4250<description>4251The type of the field.4252</description>4253</param>4254<param id="user_data">4255<outptr><void/></outptr>4256<description>4257The user supplied data that was passed into the iteration function.4258</description>4259</param>4260</parameters>4261</callback>42624263<callback id="jvmtiArrayPrimitiveValueCallback" since="1.1">4264<jint/>4265<synopsis>Array Primitive Value Callback</synopsis>4266<description>4267Agent supplied callback function.4268Describes the values in an array of a primitive type.4269<p/>4270This function should return a bit vector of the desired4271<datalink id="jvmtiHeapVisitControl">visit control flags</datalink>.4272This will determine if the entire iteration should be aborted4273(the <code>JVMTI_VISIT_OBJECTS</code> flag is ignored).4274<p/>4275See the <internallink id="heapCallbacks">heap callback4276function restrictions</internallink>.4277</description>4278<parameters>4279<param id="class_tag">4280<jlong/>4281<description>4282The 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>4288Size of the array (in bytes).4289See <functionlink id="GetObjectSize"/>.4290</description>4291</param>4292<param id="tag_ptr">4293<outptr><jlong/></outptr>4294<description>4295Points to the tag of the array object, or zero if the object is not4296tagged.4297To set the tag value to be associated with the object4298the agent sets the <code>jlong</code> pointed to by the parameter.4299</description>4300</param>4301<param id="element_count">4302<jint/>4303<description>4304The length of the primitive array.4305</description>4306</param>4307<param id="element_type">4308<enum>jvmtiPrimitiveType</enum>4309<description>4310The type of the elements of the array.4311</description>4312</param>4313<param id="elements">4314<vmbuf><void/></vmbuf>4315<description>4316The elements of the array in a packed array of <code>element_count</code>4317items of <code>element_type</code> size each.4318</description>4319</param>4320<param id="user_data">4321<outptr><void/></outptr>4322<description>4323The user supplied data that was passed into the iteration function.4324</description>4325</param>4326</parameters>4327</callback>43284329<callback id="jvmtiStringPrimitiveValueCallback" since="1.1">4330<jint/>4331<synopsis>String Primitive Value Callback</synopsis>4332<description>4333Agent supplied callback function.4334Describes the value of a java.lang.String.4335<p/>4336This function should return a bit vector of the desired4337<datalink id="jvmtiHeapVisitControl">visit control flags</datalink>.4338This will determine if the entire iteration should be aborted4339(the <code>JVMTI_VISIT_OBJECTS</code> flag is ignored).4340<p/>4341See the <internallink id="heapCallbacks">heap callback4342function restrictions</internallink>.4343</description>4344<parameters>4345<param id="class_tag">4346<jlong/>4347<description>4348The 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>4355Size of the string (in bytes).4356See <functionlink id="GetObjectSize"/>.4357</description>4358</param>4359<param id="tag_ptr">4360<outptr><jlong/></outptr>4361<description>4362Points to the tag of the String object, or zero if the object is not4363tagged.4364To set the tag value to be associated with the object4365the 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>4371The value of the String, encoded as a Unicode string.4372</description>4373</param>4374<param id="value_length">4375<jint/>4376<description>4377The length of the string.4378The length is equal to the number of 16-bit Unicode4379characters in the string.4380</description>4381</param>4382<param id="user_data">4383<outptr><void/></outptr>4384<description>4385The user supplied data that was passed into the iteration function.4386</description>4387</param>4388</parameters>4389</callback>439043914392<callback id="jvmtiReservedCallback" since="1.1">4393<jint/>4394<synopsis>reserved for future use Callback</synopsis>4395<description>4396Placeholder -- reserved for future use.4397</description>4398<parameters>4399</parameters>4400</callback>44014402<function id="FollowReferences" num="115" since="1.1">4403<synopsis>Follow References</synopsis>4404<description>4405This function initiates a traversal over the objects that are4406directly and indirectly reachable from the specified object or,4407if <code>initial_object</code> is not specified, all objects4408reachable from the heap roots.4409The heap root are the set of system classes,4410JNI globals, references from thread stacks, and other objects used as roots4411for the purposes of garbage collection.4412<p/>4413This function operates by traversing the reference graph.4414Let <i>A</i>, <i>B</i>, ... represent objects.4415When a reference from <i>A</i> to <i>B</i> is traversed,4416when a reference from a heap root to <i>B</i> is traversed,4417or when <i>B</i> is specified as the <paramlink id="initial_object"/>,4418then <i>B</i> is said to be <i>visited</i>.4419A reference from <i>A</i> to <i>B</i> is not traversed until <i>A</i>4420is visited.4421References are reported in the same order that the references are traversed.4422Object references are reported by invoking the agent supplied4423callback function <functionlink id="jvmtiHeapReferenceCallback"/>.4424In a reference from <i>A</i> to <i>B</i>, <i>A</i> is known4425as the <i>referrer</i> and <i>B</i> as the <i>referree</i>.4426The callback is invoked exactly once for each reference from a referrer;4427this is true even if there are reference cycles or multiple paths to4428the referrer.4429There may be more than one reference between a referrer and a referree,4430each reference is reported.4431These references may be distinguished by examining the4432<datalink4433id="jvmtiHeapReferenceCallback.reference_kind"><code>reference_kind</code></datalink>4434and4435<datalink4436id="jvmtiHeapReferenceCallback.reference_info"><code>reference_info</code></datalink>4437parameters of the <functionlink id="jvmtiHeapReferenceCallback"/> callback.4438<p/>4439This function reports a Java programming language view of object references,4440not a virtual machine implementation view. The following object references4441are reported when they are non-null:4442<ul>4443<li>Instance objects report references to each non-primitive instance fields4444(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 directly4447implemented/extended interfaces.</li>4448<li>Classes report a reference to the class loader, protection domain,4449signers, and resolved entries in the constant pool.</li>4450<li>Classes report a reference to each directly declared non-primitive4451static field.</li>4452<li>Arrays report a reference to the array type (class) and each4453array element.</li>4454<li>Primitive arrays report a reference to the array type.</li>4455</ul>4456<p/>4457This function can also be used to examine primitive (non-object) values.4458The primitive value of an array or String4459is reported after the object has been visited;4460it is reported by invoking the agent supplied callback function4461<functionlink id="jvmtiArrayPrimitiveValueCallback"/> or4462<functionlink id="jvmtiStringPrimitiveValueCallback"/>.4463A primitive field4464is reported after the object with that field is visited;4465it is reported by invoking the agent supplied callback function4466<functionlink id="jvmtiPrimitiveFieldCallback"/>.4467<p/>4468Whether a callback is provided or is <code>NULL</code> only determines4469whether the callback will be invoked, it does not influence4470which objects are visited nor does it influence whether other callbacks4471will be invoked.4472However, the4473<datalink id="jvmtiHeapVisitControl">visit control flags</datalink>4474returned by <functionlink id="jvmtiHeapReferenceCallback"/>4475do determine if the objects referenced by the4476current object as visited.4477The <datalink id="jvmtiHeapFilter">heap filter flags</datalink>4478and <paramlink id="klass"/> provided as parameters to this function4479do not control which objects are visited but they do control which4480objects and primitive values are reported by the callbacks.4481For example, if the only callback that was set is4482<fieldlink id="array_primitive_value_callback" struct="jvmtiHeapCallbacks"/> and <code>klass</code>4483is set to the array of bytes class, then only arrays of byte will be4484reported.4485The 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">4496the4497<datalink id="jvmtiHeapVisitControl">Heap Visit Control Flags</datalink>4498returned 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 controlled4505</td>4506<td class="centered">4507<b>Yes</b>, since visits are controlled4508</td>4509</tr>4510<tr>4511<th scope="row">4512<fieldlink id="array_primitive_value_callback" struct="jvmtiHeapCallbacks"/>4513in <paramlink id="callbacks"/> set4514</th>4515<td class="centered">4516No4517</td>4518<td class="centered">4519<b>Yes</b>4520</td>4521<td class="centered">4522No4523</td>4524</tr>4525<tr>4526<th scope="row">4527<paramlink id="heap_filter"/>4528</th>4529<td class="centered">4530No4531</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">4544No4545</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/>4555During the execution of this function the state of the heap4556does not change: no objects are allocated, no objects are4557garbage collected, and the state of objects (including4558held values) does not change.4559As a result, threads executing Java4560programming language code, threads attempting to resume the4561execution of Java programming language code, and threads4562attempting 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>4572This bit vector of4573<datalink id="jvmtiHeapFilter">heap filter flags</datalink>.4574restricts the objects for which the callback function is called.4575This 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 particular4582class</nullok>4583</ptrtype>4584<description>4585Callbacks are only reported when the object is an instance of4586this class.4587Objects which are instances of a subclass of <code>klass</code>4588are not reported.4589If <code>klass</code> is an interface, no objects are reported.4590This 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>4599The object to follow4600</description>4601</param>4602<param id="callbacks">4603<inptr>4604<struct>jvmtiHeapCallbacks</struct>4605</inptr>4606<description>4607Structure 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>4616User 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>462946304631<function id="IterateThroughHeap" num="116" since="1.1">4632<synopsis>Iterate Through Heap</synopsis>4633<description>4634Initiate an iteration over all objects in the heap.4635This includes both reachable and4636unreachable objects. Objects are visited in no particular order.4637<p/>4638Heap objects are reported by invoking the agent supplied4639callback function <functionlink id="jvmtiHeapIterationCallback"/>.4640References between objects are not reported.4641If only reachable objects are desired, or if object reference information4642is needed, use <functionlink id="FollowReferences"/>.4643<p/>4644This function can also be used to examine primitive (non-object) values.4645The primitive value of an array or String4646is reported after the object has been visited;4647it is reported by invoking the agent supplied callback function4648<functionlink id="jvmtiArrayPrimitiveValueCallback"/> or4649<functionlink id="jvmtiStringPrimitiveValueCallback"/>.4650A primitive field4651is reported after the object with that field is visited;4652it is reported by invoking the agent supplied4653callback function4654<functionlink id="jvmtiPrimitiveFieldCallback"/>.4655<p/>4656Unless the iteration is aborted by the4657<datalink id="jvmtiHeapVisitControl">Heap Visit Control Flags</datalink>4658returned by a callback, all objects in the heap are visited.4659Whether a callback is provided or is <code>NULL</code> only determines4660whether the callback will be invoked, it does not influence4661which objects are visited nor does it influence whether other callbacks4662will be invoked.4663The <datalink id="jvmtiHeapFilter">heap filter flags</datalink>4664and <paramlink id="klass"/> provided as parameters to this function4665do not control which objects are visited but they do control which4666objects and primitive values are reported by the callbacks.4667For example, if the only callback that was set is4668<fieldlink id="array_primitive_value_callback" struct="jvmtiHeapCallbacks"/> and <code>klass</code>4669is set to the array of bytes class, then only arrays of byte will be4670reported. The table below summarizes this (contrast this with4671<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">4682the4683<datalink id="jvmtiHeapVisitControl">Heap Visit Control Flags</datalink>4684returned by <functionlink id="jvmtiHeapIterationCallback"/>4685</th>4686<td class="centered">4687No<br/>(unless they abort the iteration)4688</td>4689<td class="centered">4690No<br/>(unless they abort the iteration)4691</td>4692<td class="centered">4693No<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"/>4699in <paramlink id="callbacks"/> set4700</th>4701<td class="centered">4702No4703</td>4704<td class="centered">4705<b>Yes</b>4706</td>4707<td class="centered">4708No4709</td>4710</tr>4711<tr>4712<th scope="row">4713<paramlink id="heap_filter"/>4714</th>4715<td class="centered">4716No4717</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">4730No4731</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/>4741During the execution of this function the state of the heap4742does not change: no objects are allocated, no objects are4743garbage collected, and the state of objects (including4744held values) does not change.4745As a result, threads executing Java4746programming language code, threads attempting to resume the4747execution of Java programming language code, and threads4748attempting 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>4758This bit vector of4759<datalink id="jvmtiHeapFilter">heap filter flags</datalink>.4760restricts the objects for which the callback function is called.4761This 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>4770Callbacks are only reported when the object is an instance of4771this class.4772Objects which are instances of a subclass of <code>klass</code>4773are not reported.4774If <code>klass</code> is an interface, no objects are reported.4775This 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>4783Structure 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>4792User 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>48024803<function id="GetTag" phase="start" num="106">4804<synopsis>Get Tag</synopsis>4805<description>4806Retrieve the tag associated with an object.4807The tag is a long value typically used to store a4808unique identifier or pointer to object information.4809The tag is set with4810<functionlink id="SetTag"></functionlink>.4811Objects for which no tags have been set return a4812tag 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>4822The object whose tag is to be retrieved.4823</description>4824</param>4825<param id="tag_ptr">4826<outptr><jlong/></outptr>4827<description>4828On return, the referenced long is set to the value4829of the tag.4830</description>4831</param>4832</parameters>4833<errors>4834</errors>4835</function>48364837<function id="SetTag" phase="start" num="107">4838<synopsis>Set Tag</synopsis>4839<description>4840Set the tag associated with an object.4841The tag is a long value typically used to store a4842unique identifier or pointer to object information.4843The tag is visible with4844<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>4854The object whose tag is to be set.4855</description>4856</param>4857<param id="tag">4858<jlong/>4859<description>4860The new value of the tag.4861</description>4862</param>4863</parameters>4864<errors>4865</errors>4866</function>48674868<function id="GetObjectsWithTags" num="114">4869<synopsis>Get Objects With Tags</synopsis>4870<description>4871Return objects in the heap with the specified tags.4872The 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>4882Number of tags to scan for.4883</description>4884</param>4885<param id="tags">4886<inbuf incount="tag_count">4887<jlong/>4888</inbuf>4889<description>4890Scan for objects with these tags.4891Zero is not permitted in this array.4892</description>4893</param>4894<param id="count_ptr">4895<outptr>4896<jint/>4897</outptr>4898<description>4899Return the number of objects with any of the tags4900in <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>4909Returns the array of objects with any of the tags4910in <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>4919For each object in <paramlink id="object_result_ptr"/>,4920return the tag at the corresponding index.4921</description>4922</param>4923</parameters>4924<errors>4925<error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">4926Zero is present in <paramlink id="tags"></paramlink>.4927</error>4928</errors>4929</function>49304931<function id="ForceGarbageCollection" num="108">4932<synopsis>Force Garbage Collection</synopsis>4933<description>4934Force the VM to perform a garbage collection.4935The garbage collection is as complete as possible.4936This function does not cause finalizers to be run.4937This function does not return until the garbage collection4938is finished.4939<p/>4940Although garbage collection is as complete4941as possible there is no guarantee that all4942<eventlink id="ObjectFree"/>4943events will have been4944sent by the time that this function4945returns. In particular, an object may be4946prevented from being freed because it4947is awaiting finalization.4948</description>4949<origin>new</origin>4950<capabilities>4951</capabilities>4952<parameters>4953</parameters>4954<errors>4955</errors>4956</function>495749584959</category>49604961<category id="Heap_1_0" label="Heap (1.0)">4962<intro>4963<b>4964These functions and data types were introduced in the original4965<jvmti/> version 1.0. They are deprecated and will be changed4966to return an error in a future release. They were superseded in4967<jvmti/> version 1.2 (Java SE 6) by more4968</b>4969<internallink id="Heap"><b>powerful and flexible versions</b></internallink>4970<b>4971which:4972</b>4973<ul>4974<li>4975<b>4976Allow access to primitive values (the value of Strings, arrays,4977and primitive fields)4978</b>4979</li>4980<li>4981<b>4982Allow the tag of the referrer to be set, thus enabling more4983efficient localized reference graph building4984</b>4985</li>4986<li>4987<b>4988Provide more extensive filtering abilities4989</b>4990</li>4991<li>4992<b>4993Are extensible, allowing their abilities to grow in future versions of <jvmti/>4994</b>4995</li>4996</ul>4997<p/>4998<b>Please use the </b>4999<internallink id="Heap"><b>current Heap functions</b></internallink>.5000<p/>5001<constants id="jvmtiHeapObjectFilter" label="Heap Object Filter Enumeration" kind="enum">5002<constant id="JVMTI_HEAP_OBJECT_TAGGED" num="1">5003Tagged objects only.5004</constant>5005<constant id="JVMTI_HEAP_OBJECT_UNTAGGED" num="2">5006Untagged objects only.5007</constant>5008<constant id="JVMTI_HEAP_OBJECT_EITHER" num="3">5009Either tagged or untagged objects.5010</constant>5011</constants>50125013<constants id="jvmtiHeapRootKind" label="Heap Root Kind Enumeration" kind="enum">5014<constant id="JVMTI_HEAP_ROOT_JNI_GLOBAL" num="1">5015JNI global reference.5016</constant>5017<constant id="JVMTI_HEAP_ROOT_SYSTEM_CLASS" num="2">5018System class.5019</constant>5020<constant id="JVMTI_HEAP_ROOT_MONITOR" num="3">5021Monitor.5022</constant>5023<constant id="JVMTI_HEAP_ROOT_STACK_LOCAL" num="4">5024Stack local.5025</constant>5026<constant id="JVMTI_HEAP_ROOT_JNI_LOCAL" num="5">5027JNI local reference.5028</constant>5029<constant id="JVMTI_HEAP_ROOT_THREAD" num="6">5030Thread.5031</constant>5032<constant id="JVMTI_HEAP_ROOT_OTHER" num="7">5033Other.5034</constant>5035</constants>50365037<constants id="jvmtiObjectReferenceKind" label="Object Reference Enumeration" kind="enum">5038<constant id="JVMTI_REFERENCE_CLASS" num="1">5039Reference from an object to its class.5040</constant>5041<constant id="JVMTI_REFERENCE_FIELD" num="2">5042Reference from an object to the value of one of its instance fields.5043For references of this kind the <code>referrer_index</code>5044parameter to the <internallink id="jvmtiObjectReferenceCallback">5045jvmtiObjectReferenceCallback</internallink> is the index of the5046the instance field. The index is based on the order of all the5047object's fields. This includes all fields of the directly declared5048static and instance fields in the class, and includes all fields (both5049public and private) fields declared in superclasses and superinterfaces.5050The index is thus calculated by summing the index of the field in the directly5051declared class (see <functionlink id="GetClassFields"/>), with the total5052number of fields (both public and private) declared in all superclasses5053and superinterfaces. The index starts at zero.5054</constant>5055<constant id="JVMTI_REFERENCE_ARRAY_ELEMENT" num="3">5056Reference from an array to one of its elements.5057For references of this kind the <code>referrer_index</code>5058parameter to the <internallink id="jvmtiObjectReferenceCallback">5059jvmtiObjectReferenceCallback</internallink> is the array index.5060</constant>5061<constant id="JVMTI_REFERENCE_CLASS_LOADER" num="4">5062Reference from a class to its class loader.5063</constant>5064<constant id="JVMTI_REFERENCE_SIGNERS" num="5">5065Reference from a class to its signers array.5066</constant>5067<constant id="JVMTI_REFERENCE_PROTECTION_DOMAIN" num="6">5068Reference from a class to its protection domain.5069</constant>5070<constant id="JVMTI_REFERENCE_INTERFACE" num="7">5071Reference from a class to one of its interfaces.5072</constant>5073<constant id="JVMTI_REFERENCE_STATIC_FIELD" num="8">5074Reference from a class to the value of one of its static fields.5075For references of this kind the <code>referrer_index</code>5076parameter to the <internallink id="jvmtiObjectReferenceCallback">5077jvmtiObjectReferenceCallback</internallink> is the index of the5078the static field. The index is based on the order of all the5079object's fields. This includes all fields of the directly declared5080static and instance fields in the class, and includes all fields (both5081public and private) fields declared in superclasses and superinterfaces.5082The index is thus calculated by summing the index of the field in the directly5083declared class (see <functionlink id="GetClassFields"/>), with the total5084number of fields (both public and private) declared in all superclasses5085and superinterfaces. The index starts at zero.5086Note: this definition differs from that in the <jvmti/> 1.0 Specification.5087<rationale>No known implementations used the 1.0 definition.</rationale>5088</constant>5089<constant id="JVMTI_REFERENCE_CONSTANT_POOL" num="9">5090Reference from a class to a resolved entry in the constant pool.5091For references of this kind the <code>referrer_index</code>5092parameter to the <internallink id="jvmtiObjectReferenceCallback">5093jvmtiObjectReferenceCallback</internallink> is the index into5094constant pool table of the class, starting at 1. See5095<vmspec chapter="4.4"/>.5096</constant>5097</constants>50985099<constants id="jvmtiIterationControl" label="Iteration Control Enumeration" kind="enum">5100<constant id="JVMTI_ITERATION_CONTINUE" num="1">5101Continue the iteration.5102If this is a reference iteration, follow the references of this object.5103</constant>5104<constant id="JVMTI_ITERATION_IGNORE" num="2">5105Continue the iteration.5106If this is a reference iteration, ignore the references of this object.5107</constant>5108<constant id="JVMTI_ITERATION_ABORT" num="0">5109Abort the iteration.5110</constant>5111</constants>5112</intro>51135114<callback id="jvmtiHeapObjectCallback">5115<enum>jvmtiIterationControl</enum>5116<synopsis>Heap Object Callback</synopsis>5117<description>5118Agent supplied callback function.5119Describes (but does not pass in) an object in the heap.5120<p/>5121Return value should be <code>JVMTI_ITERATION_CONTINUE</code> to continue iteration,5122or <code>JVMTI_ITERATION_ABORT</code> to stop iteration.5123<p/>5124See the <internallink id="heapCallbacks">heap callback5125function restrictions</internallink>.5126</description>5127<parameters>5128<param id="class_tag">5129<jlong/>5130<description>5131The tag of the class of object (zero if the class is not tagged).5132If the object represents a runtime class,5133the <code>class_tag</code> is the tag5134associated with <code>java.lang.Class</code>5135(zero if <code>java.lang.Class</code> is not tagged).5136</description>5137</param>5138<param id="size">5139<jlong/>5140<description>5141Size of the object (in bytes). See <functionlink id="GetObjectSize"/>.5142</description>5143</param>5144<param id="tag_ptr">5145<outptr><jlong/></outptr>5146<description>5147The object tag value, or zero if the object is not tagged.5148To set the tag value to be associated with the object5149the agent sets the <code>jlong</code> pointed to by the parameter.5150</description>5151</param>5152<param id="user_data">5153<outptr><void/></outptr>5154<description>5155The user supplied data that was passed into the iteration function.5156</description>5157</param>5158</parameters>5159</callback>51605161<callback id="jvmtiHeapRootCallback">5162<enum>jvmtiIterationControl</enum>5163<synopsis>Heap Root Object Callback</synopsis>5164<description>5165Agent supplied callback function.5166Describes (but does not pass in) an object that is a root for the purposes5167of garbage collection.5168<p/>5169Return value should be <code>JVMTI_ITERATION_CONTINUE</code> to continue iteration,5170<code>JVMTI_ITERATION_IGNORE</code> to continue iteration without pursuing5171references from referree object or <code>JVMTI_ITERATION_ABORT</code> to stop iteration.5172<p/>5173See the <internallink id="heapCallbacks">heap callback5174function restrictions</internallink>.5175</description>5176<parameters>5177<param id="root_kind">5178<enum>jvmtiHeapRootKind</enum>5179<description>5180The kind of heap root.5181</description>5182</param>5183<param id="class_tag">5184<jlong/>5185<description>5186The tag of the class of object (zero if the class is not tagged).5187If the object represents a runtime class, the <code>class_tag</code> is the tag5188associated with <code>java.lang.Class</code>5189(zero if <code>java.lang.Class</code> is not tagged).5190</description>5191</param>5192<param id="size">5193<jlong/>5194<description>5195Size of the object (in bytes). See <functionlink id="GetObjectSize"/>.5196</description>5197</param>5198<param id="tag_ptr">5199<outptr><jlong/></outptr>5200<description>5201The object tag value, or zero if the object is not tagged.5202To set the tag value to be associated with the object5203the agent sets the <code>jlong</code> pointed to by the parameter.5204</description>5205</param>5206<param id="user_data">5207<outptr><void/></outptr>5208<description>5209The user supplied data that was passed into the iteration function.5210</description>5211</param>5212</parameters>5213</callback>52145215<callback id="jvmtiStackReferenceCallback">5216<enum>jvmtiIterationControl</enum>5217<synopsis>Stack Reference Object Callback</synopsis>5218<description>5219Agent supplied callback function.5220Describes (but does not pass in) an object on the stack that is a root for5221the purposes of garbage collection.5222<p/>5223Return value should be <code>JVMTI_ITERATION_CONTINUE</code> to continue iteration,5224<code>JVMTI_ITERATION_IGNORE</code> to continue iteration without pursuing5225references from referree object or <code>JVMTI_ITERATION_ABORT</code> to stop iteration.5226<p/>5227See the <internallink id="heapCallbacks">heap callback5228function restrictions</internallink>.5229</description>5230<parameters>5231<param id="root_kind">5232<enum>jvmtiHeapRootKind</enum>5233<description>5234The kind of root (either <code>JVMTI_HEAP_ROOT_STACK_LOCAL</code> or5235<code>JVMTI_HEAP_ROOT_JNI_LOCAL</code>).5236</description>5237</param>5238<param id="class_tag">5239<jlong/>5240<description>5241The tag of the class of object (zero if the class is not tagged).5242If the object represents a runtime class, the <code>class_tag</code> is the tag5243associated with <code>java.lang.Class</code>5244(zero if <code>java.lang.Class</code> is not tagged).5245</description>5246</param>5247<param id="size">5248<jlong/>5249<description>5250Size of the object (in bytes). See <functionlink id="GetObjectSize"/>.5251</description>5252</param>5253<param id="tag_ptr">5254<outptr><jlong/></outptr>5255<description>5256The object tag value, or zero if the object is not tagged.5257To set the tag value to be associated with the object5258the agent sets the <code>jlong</code> pointed to by the parameter.5259</description>5260</param>5261<param id="thread_tag">5262<jlong/>5263<description>5264The tag of the thread corresponding to this stack, zero if not tagged.5265</description>5266</param>5267<param id="depth">5268<jint/>5269<description>5270The depth of the frame.5271</description>5272</param>5273<param id="method">5274<jmethodID/>5275<description>5276The method executing in this frame.5277</description>5278</param>5279<param id="slot">5280<jint/>5281<description>5282The slot number.5283</description>5284</param>5285<param id="user_data">5286<outptr><void/></outptr>5287<description>5288The user supplied data that was passed into the iteration function.5289</description>5290</param>5291</parameters>5292</callback>52935294<callback id="jvmtiObjectReferenceCallback">5295<enum>jvmtiIterationControl</enum>5296<synopsis>Object Reference Callback</synopsis>5297<description>5298Agent supplied callback function.5299Describes a reference from an object (the referrer) to another object5300(the referree).5301<p/>5302Return value should be <code>JVMTI_ITERATION_CONTINUE</code> to continue iteration,5303<code>JVMTI_ITERATION_IGNORE</code> to continue iteration without pursuing5304references from referree object or <code>JVMTI_ITERATION_ABORT</code> to stop iteration.5305<p/>5306See the <internallink id="heapCallbacks">heap callback5307function restrictions</internallink>.5308</description>5309<parameters>5310<param id="reference_kind">5311<enum>jvmtiObjectReferenceKind</enum>5312<description>5313The type of reference.5314</description>5315</param>5316<param id="class_tag">5317<jlong/>5318<description>5319The tag of the class of referree object (zero if the class is not tagged).5320If the referree object represents a runtime class,5321the <code>class_tag</code> is the tag5322associated with <code>java.lang.Class</code>5323(zero if <code>java.lang.Class</code> is not tagged).5324</description>5325</param>5326<param id="size">5327<jlong/>5328<description>5329Size of the referree object (in bytes).5330See <functionlink id="GetObjectSize"/>.5331</description>5332</param>5333<param id="tag_ptr">5334<outptr><jlong/></outptr>5335<description>5336The referree object tag value, or zero if the object is not5337tagged.5338To set the tag value to be associated with the object5339the agent sets the <code>jlong</code> pointed to by the parameter.5340</description>5341</param>5342<param id="referrer_tag">5343<jlong/>5344<description>5345The tag of the referrer object, or zero if the referrer5346object is not tagged.5347</description>5348</param>5349<param id="referrer_index">5350<jint/>5351<description>5352For references of type <code>JVMTI_REFERENCE_FIELD</code> or5353<code>JVMTI_REFERENCE_STATIC_FIELD</code> the index5354of the field in the referrer object. The index is based on the5355order of all the object's fields - see <internallink5356id="JVMTI_REFERENCE_FIELD">JVMTI_REFERENCE_FIELD</internallink>5357or <internallink5358id="JVMTI_REFERENCE_STATIC_FIELD">JVMTI_REFERENCE_STATIC_FIELD5359</internallink> for further description.5360<p/>5361For references of type <code>JVMTI_REFERENCE_ARRAY_ELEMENT</code>5362the array index - see <internallink id="JVMTI_REFERENCE_ARRAY_ELEMENT">5363JVMTI_REFERENCE_ARRAY_ELEMENT</internallink> for further description.5364<p/>5365For references of type <code>JVMTI_REFERENCE_CONSTANT_POOL</code>5366the index into the constant pool of the class - see5367<internallink id="JVMTI_REFERENCE_CONSTANT_POOL">5368JVMTI_REFERENCE_CONSTANT_POOL</internallink> for further5369description.5370<p/>5371For references of other kinds the <code>referrer_index</code> is5372<code>-1</code>.5373</description>5374</param>5375<param id="user_data">5376<outptr><void/></outptr>5377<description>5378The user supplied data that was passed into the iteration function.5379</description>5380</param>5381</parameters>5382</callback>53835384<function id="IterateOverObjectsReachableFromObject" num="109">5385<synopsis>Iterate Over Objects Reachable From Object</synopsis>5386<description>5387This function iterates over all objects that are directly5388and indirectly reachable from the specified object.5389For each object <i>A</i> (known5390as the referrer) with a reference to object <i>B</i> the specified5391callback function is called to describe the object reference.5392The callback is called exactly once for each reference from a referrer;5393this is true even if there are reference cycles or multiple paths to5394the referrer.5395There may be more than one reference between a referrer and a referree,5396These may be distinguished by the5397<datalink id="jvmtiObjectReferenceCallback.reference_kind"></datalink> and5398<datalink id="jvmtiObjectReferenceCallback.referrer_index"></datalink>.5399The callback for an object will always occur after the callback for5400its referrer.5401<p/>5402See <functionlink id="FollowReferences"/> for the object5403references which are reported.5404<p/>5405During the execution of this function the state of the heap5406does not change: no objects are allocated, no objects are5407garbage collected, and the state of objects (including5408held values) does not change.5409As a result, threads executing Java5410programming language code, threads attempting to resume the5411execution of Java programming language code, and threads5412attempting to execute JNI functions are typically stalled.5413</description>5414<origin>new</origin>5415<capabilities>5416<required id="can_tag_objects"></required>5417</capabilities>5418<parameters>5419<param id="object">5420<jobject/>5421<description>5422The object5423</description>5424</param>5425<param id="object_reference_callback">5426<ptrtype>5427<struct>jvmtiObjectReferenceCallback</struct>5428</ptrtype>5429<description>5430The callback to be called to describe each5431object reference.5432</description>5433</param>5434<param id="user_data">5435<inbuf>5436<void/>5437<nullok><code>NULL</code> is passed as the user supplied data</nullok>5438</inbuf>5439<description>5440User supplied data to be passed to the callback.5441</description>5442</param>5443</parameters>5444<errors>5445</errors>5446</function>54475448<function id="IterateOverReachableObjects" num="110">5449<synopsis>Iterate Over Reachable Objects</synopsis>5450<description>5451This function iterates over the root objects and all objects that5452are directly and indirectly reachable from the root objects.5453The root objects comprise the set of system classes,5454JNI globals, references from thread stacks, and other objects used as roots5455for the purposes of garbage collection.5456<p/>5457For each root the <paramlink id="heap_root_callback"></paramlink>5458or <paramlink id="stack_ref_callback"></paramlink> callback is called.5459An object can be a root object for more than one reason and in that case5460the appropriate callback is called for each reason.5461<p/>5462For each object reference the <paramlink id="object_ref_callback"></paramlink>5463callback function is called to describe the object reference.5464The callback is called exactly once for each reference from a referrer;5465this is true even if there are reference cycles or multiple paths to5466the referrer.5467There may be more than one reference between a referrer and a referree,5468These may be distinguished by the5469<datalink id="jvmtiObjectReferenceCallback.reference_kind"></datalink> and5470<datalink id="jvmtiObjectReferenceCallback.referrer_index"></datalink>.5471The callback for an object will always occur after the callback for5472its referrer.5473<p/>5474See <functionlink id="FollowReferences"/> for the object5475references which are reported.5476<p/>5477Roots are always reported to the profiler before any object references5478are reported. In other words, the <paramlink id="object_ref_callback"></paramlink>5479callback will not be called until the appropriate callback has been called5480for all roots. If the <paramlink id="object_ref_callback"></paramlink> callback is5481specified as <code>NULL</code> then this function returns after5482reporting the root objects to the profiler.5483<p/>5484During the execution of this function the state of the heap5485does not change: no objects are allocated, no objects are5486garbage collected, and the state of objects (including5487held values) does not change.5488As a result, threads executing Java5489programming language code, threads attempting to resume the5490execution of Java programming language code, and threads5491attempting to execute JNI functions are typically stalled.5492</description>5493<origin>new</origin>5494<capabilities>5495<required id="can_tag_objects"></required>5496</capabilities>5497<parameters>5498<param id="heap_root_callback">5499<ptrtype>5500<struct>jvmtiHeapRootCallback</struct>5501<nullok>do not report heap roots</nullok>5502</ptrtype>5503<description>5504The callback function to be called for each heap root of type5505<code>JVMTI_HEAP_ROOT_JNI_GLOBAL</code>,5506<code>JVMTI_HEAP_ROOT_SYSTEM_CLASS</code>,5507<code>JVMTI_HEAP_ROOT_MONITOR</code>,5508<code>JVMTI_HEAP_ROOT_THREAD</code>, or5509<code>JVMTI_HEAP_ROOT_OTHER</code>.5510</description>5511</param>5512<param id="stack_ref_callback">5513<ptrtype>5514<struct>jvmtiStackReferenceCallback</struct>5515<nullok>do not report stack references</nullok>5516</ptrtype>5517<description>5518The callback function to be called for each heap root of5519<code>JVMTI_HEAP_ROOT_STACK_LOCAL</code> or5520<code>JVMTI_HEAP_ROOT_JNI_LOCAL</code>.5521</description>5522</param>5523<param id="object_ref_callback">5524<ptrtype>5525<struct>jvmtiObjectReferenceCallback</struct>5526<nullok>do not follow references from the root objects</nullok>5527</ptrtype>5528<description>5529The callback function to be called for each object reference.5530</description>5531</param>5532<param id="user_data">5533<inbuf>5534<void/>5535<nullok><code>NULL</code> is passed as the user supplied data</nullok>5536</inbuf>5537<description>5538User supplied data to be passed to the callback.5539</description>5540</param>5541</parameters>5542<errors>5543</errors>5544</function>55455546<function id="IterateOverHeap" num="111">5547<synopsis>Iterate Over Heap</synopsis>5548<description>5549Iterate over all objects in the heap. This includes both reachable and5550unreachable objects.5551<p/>5552The <paramlink id="object_filter"></paramlink> parameter indicates the5553objects for which the callback function is called. If this parameter5554is <code>JVMTI_HEAP_OBJECT_TAGGED</code> then the callback will only be5555called for every object that is tagged. If the parameter is5556<code>JVMTI_HEAP_OBJECT_UNTAGGED</code> then the callback will only be5557for objects that are not tagged. If the parameter5558is <code>JVMTI_HEAP_OBJECT_EITHER</code> then the callback will be5559called for every object in the heap, irrespective of whether it is5560tagged or not.5561<p/>5562During the execution of this function the state of the heap5563does not change: no objects are allocated, no objects are5564garbage collected, and the state of objects (including5565held values) does not change.5566As a result, threads executing Java5567programming language code, threads attempting to resume the5568execution of Java programming language code, and threads5569attempting to execute JNI functions are typically stalled.5570</description>5571<origin>new</origin>5572<capabilities>5573<required id="can_tag_objects"></required>5574</capabilities>5575<parameters>5576<param id="object_filter">5577<enum>jvmtiHeapObjectFilter</enum>5578<description>5579Indicates the objects for which the callback function is called.5580</description>5581</param>5582<param id="heap_object_callback">5583<ptrtype>5584<struct>jvmtiHeapObjectCallback</struct>5585</ptrtype>5586<description>5587The iterator function to be called for each5588object matching the <paramlink id="object_filter"/>.5589</description>5590</param>5591<param id="user_data">5592<inbuf>5593<void/>5594<nullok><code>NULL</code> is passed as the user supplied data</nullok>5595</inbuf>5596<description>5597User supplied data to be passed to the callback.5598</description>5599</param>5600</parameters>5601<errors>5602</errors>5603</function>56045605<function id="IterateOverInstancesOfClass" num="112">5606<synopsis>Iterate Over Instances Of Class</synopsis>5607<description>5608Iterate over all objects in the heap that are instances of the specified class.5609This includes direct instances of the specified class and5610instances of all subclasses of the specified class.5611This includes both reachable and unreachable objects.5612<p/>5613The <paramlink id="object_filter"></paramlink> parameter indicates the5614objects for which the callback function is called. If this parameter5615is <code>JVMTI_HEAP_OBJECT_TAGGED</code> then the callback will only be5616called for every object that is tagged. If the parameter is5617<code>JVMTI_HEAP_OBJECT_UNTAGGED</code> then the callback will only be5618called for objects that are not tagged. If the parameter5619is <code>JVMTI_HEAP_OBJECT_EITHER</code> then the callback will be5620called for every object in the heap, irrespective of whether it is5621tagged or not.5622<p/>5623During the execution of this function the state of the heap5624does not change: no objects are allocated, no objects are5625garbage collected, and the state of objects (including5626held values) does not change.5627As a result, threads executing Java5628programming language code, threads attempting to resume the5629execution of Java programming language code, and threads5630attempting to execute JNI functions are typically stalled.5631</description>5632<origin>new</origin>5633<capabilities>5634<required id="can_tag_objects"></required>5635</capabilities>5636<parameters>5637<param id="klass">5638<jclass/>5639<description>5640Iterate over objects of this class only.5641</description>5642</param>5643<param id="object_filter">5644<enum>jvmtiHeapObjectFilter</enum>5645<description>5646Indicates the objects for which the callback function is called.5647</description>5648</param>5649<param id="heap_object_callback">5650<ptrtype>5651<struct>jvmtiHeapObjectCallback</struct>5652</ptrtype>5653<description>5654The iterator function to be called for each5655<paramlink id="klass"/> instance matching5656the <paramlink id="object_filter"/>.5657</description>5658</param>5659<param id="user_data">5660<inbuf>5661<void/>5662<nullok><code>NULL</code> is passed as the user supplied data</nullok>5663</inbuf>5664<description>5665User supplied data to be passed to the callback.5666</description>5667</param>5668</parameters>5669<errors>5670</errors>5671</function>56725673</category>56745675<category id="local" label="Local Variable">56765677<intro>5678These functions are used to retrieve or set the value of a local variable.5679The variable is identified by the depth of the frame containing its5680value and the variable's slot number within that frame.5681The mapping of variables to5682slot numbers can be obtained with the function5683<functionlink id="GetLocalVariableTable"></functionlink>.5684</intro>56855686<function id="GetLocalObject" num="21">5687<synopsis>Get Local Variable - Object</synopsis>5688<description>5689This function can be used to retrieve the value of a local5690variable whose type is <code>Object</code> or a subclass of <code>Object</code>.5691</description>5692<origin>jvmdi</origin>5693<capabilities>5694<required id="can_access_local_variables"></required>5695</capabilities>5696<parameters>5697<param id="thread">5698<jthread null="current" frame="frame"/>5699<description>5700The thread of the frame containing the variable's value.5701</description>5702</param>5703<param id="depth">5704<jframeID thread="thread"/>5705<description>5706The depth of the frame containing the variable's value.5707</description>5708</param>5709<param id="slot">5710<jint/>5711<description>5712The variable's slot number.5713</description>5714</param>5715<param id="value_ptr">5716<outptr><jobject/></outptr>5717<description>5718On return, points to the variable's value.5719</description>5720</param>5721</parameters>5722<errors>5723<error id="JVMTI_ERROR_INVALID_SLOT">5724Invalid <code>slot</code>.5725</error>5726<error id="JVMTI_ERROR_TYPE_MISMATCH">5727The variable type is not5728<code>Object</code> or a subclass of <code>Object</code>.5729</error>5730<error id="JVMTI_ERROR_OPAQUE_FRAME">5731Not a visible frame5732</error>5733</errors>5734</function>57355736<function id="GetLocalInstance" num="155" since="1.2">5737<synopsis>Get Local Instance</synopsis>5738<description>5739This function can be used to retrieve the value of the local object5740variable at slot 0 (the "<code>this</code>" object) from non-static5741frames. This function can retrieve the "<code>this</code>" object from5742native method frames, whereas <code>GetLocalObject()</code> would5743return <code>JVMTI_ERROR_OPAQUE_FRAME</code> in those cases.5744</description>5745<origin>new</origin>5746<capabilities>5747<required id="can_access_local_variables"></required>5748</capabilities>5749<parameters>5750<param id="thread">5751<jthread null="current" frame="frame"/>5752<description>5753The thread of the frame containing the variable's value.5754</description>5755</param>5756<param id="depth">5757<jframeID thread="thread"/>5758<description>5759The depth of the frame containing the variable's value.5760</description>5761</param>5762<param id="value_ptr">5763<outptr><jobject/></outptr>5764<description>5765On return, points to the variable's value.5766</description>5767</param>5768</parameters>5769<errors>5770<error id="JVMTI_ERROR_INVALID_SLOT">5771If the specified frame is a static method frame.5772</error>5773</errors>5774</function>5775<function id="GetLocalInt" num="22">5776<synopsis>Get Local Variable - Int</synopsis>5777<description>5778This function can be used to retrieve the value of a local5779variable whose type is <code>int</code>,5780<code>short</code>, <code>char</code>, <code>byte</code>, or5781<code>boolean</code>.5782</description>5783<origin>jvmdi</origin>5784<capabilities>5785<required id="can_access_local_variables"></required>5786</capabilities>5787<parameters>5788<param id="thread">5789<jthread null="current" frame="frame"/>5790<description>5791The thread of the frame containing the variable's value.5792</description>5793</param>5794<param id="depth">5795<jframeID thread="thread"/>5796<description>5797The depth of the frame containing the variable's value.5798</description>5799</param>5800<param id="slot">5801<jint/>5802<description>5803The variable's slot number.5804</description>5805</param>5806<param id="value_ptr">5807<outptr><jint/></outptr>5808<description>5809On return, points to the variable's value.5810</description>5811</param>5812</parameters>5813<errors>5814<error id="JVMTI_ERROR_INVALID_SLOT">5815Invalid <code>slot</code>.5816</error>5817<error id="JVMTI_ERROR_TYPE_MISMATCH">5818The variable type is not5819<code>int</code>, <code>short</code>,5820<code>char</code>, <code>byte</code>, or5821<code>boolean</code>.5822</error>5823<error id="JVMTI_ERROR_OPAQUE_FRAME">5824Not a visible frame5825</error>5826</errors>5827</function>58285829<function id="GetLocalLong" num="23">5830<synopsis>Get Local Variable - Long</synopsis>5831<description>5832This function can be used to retrieve the value of a local5833variable whose type is <code>long</code>.5834</description>5835<origin>jvmdi</origin>5836<capabilities>5837<required id="can_access_local_variables"></required>5838</capabilities>5839<parameters>5840<param id="thread">5841<jthread null="current" frame="frame"/>5842<description>5843The thread of the frame containing the variable's value.5844</description>5845</param>5846<param id="depth">5847<jframeID thread="thread"/>5848<description>5849The depth of the frame containing the variable's value.5850</description>5851</param>5852<param id="slot">5853<jint/>5854<description>5855The variable's slot number.5856</description>5857</param>5858<param id="value_ptr">5859<outptr><jlong/></outptr>5860<description>5861On return, points to the variable's value.5862</description>5863</param>5864</parameters>5865<errors>5866<error id="JVMTI_ERROR_INVALID_SLOT">5867Invalid <code>slot</code>.5868</error>5869<error id="JVMTI_ERROR_TYPE_MISMATCH">5870The variable type is not <code>long</code>.5871</error>5872<error id="JVMTI_ERROR_OPAQUE_FRAME">5873Not a visible frame5874</error>5875</errors>5876</function>58775878<function id="GetLocalFloat" num="24">5879<synopsis>Get Local Variable - Float</synopsis>5880<description>5881This function can be used to retrieve the value of a local5882variable whose type is <code>float</code>.5883</description>5884<origin>jvmdi</origin>5885<capabilities>5886<required id="can_access_local_variables"></required>5887</capabilities>5888<parameters>5889<param id="thread">5890<jthread null="current" frame="frame"/>5891<description>5892The thread of the frame containing the variable's value.5893</description>5894</param>5895<param id="depth">5896<jframeID thread="thread"/>5897<description>5898The depth of the frame containing the variable's value.5899</description>5900</param>5901<param id="slot">5902<jint/>5903<description>5904The variable's slot number.5905</description>5906</param>5907<param id="value_ptr">5908<outptr><jfloat/></outptr>5909<description>5910On return, points to the variable's value.5911</description>5912</param>5913</parameters>5914<errors>5915<error id="JVMTI_ERROR_INVALID_SLOT">5916Invalid <code>slot</code>.5917</error>5918<error id="JVMTI_ERROR_TYPE_MISMATCH">5919The variable type is not <code>float</code>.5920</error>5921<error id="JVMTI_ERROR_OPAQUE_FRAME">5922Not a visible frame5923</error>5924</errors>5925</function>59265927<function id="GetLocalDouble" num="25">5928<synopsis>Get Local Variable - Double</synopsis>5929<description>5930This function can be used to retrieve the value of a local5931variable whose type is <code>long</code>.5932</description>5933<origin>jvmdi</origin>5934<capabilities>5935<required id="can_access_local_variables"></required>5936</capabilities>5937<parameters>5938<param id="thread">5939<jthread null="current" frame="frame"/>5940<description>5941The thread of the frame containing the variable's value.5942</description>5943</param>5944<param id="depth">5945<jframeID thread="thread"/>5946<description>5947The depth of the frame containing the variable's value.5948</description>5949</param>5950<param id="slot">5951<jint/>5952<description>5953The variable's slot number.5954</description>5955</param>5956<param id="value_ptr">5957<outptr><jdouble/></outptr>5958<description>5959On return, points to the variable's value.5960</description>5961</param>5962</parameters>5963<errors>5964<error id="JVMTI_ERROR_INVALID_SLOT">5965Invalid <code>slot</code>.5966</error>5967<error id="JVMTI_ERROR_TYPE_MISMATCH">5968The variable type is not <code>double</code>.5969</error>5970<error id="JVMTI_ERROR_OPAQUE_FRAME">5971Not a visible frame5972</error>5973</errors>5974</function>59755976<function id="SetLocalObject" num="26">5977<synopsis>Set Local Variable - Object</synopsis>5978<description>5979This function can be used to set the value of a local5980variable whose type is <code>Object</code> or a subclass of <code>Object</code>.5981</description>5982<origin>jvmdi</origin>5983<capabilities>5984<required id="can_access_local_variables"></required>5985</capabilities>5986<parameters>5987<param id="thread">5988<jthread null="current" frame="frame"/>5989<description>5990The thread of the frame containing the variable's value.5991</description>5992</param>5993<param id="depth">5994<jframeID thread="thread"/>5995<description>5996The depth of the frame containing the variable's value.5997</description>5998</param>5999<param id="slot">6000<jint/>6001<description>6002The variable's slot number.6003</description>6004</param>6005<param id="value">6006<jobject/>6007<description>6008The new value for the variable.6009</description>6010</param>6011</parameters>6012<errors>6013<error id="JVMTI_ERROR_INVALID_SLOT">6014Invalid <code>slot</code>.6015</error>6016<error id="JVMTI_ERROR_TYPE_MISMATCH">6017The variable type is not6018<code>Object</code> or a subclass of <code>Object</code>.6019</error>6020<error id="JVMTI_ERROR_TYPE_MISMATCH">6021The supplied <paramlink id="value"/> is not compatible6022with the variable type.6023</error>6024<error id="JVMTI_ERROR_OPAQUE_FRAME">6025Not a visible frame6026</error>6027</errors>6028</function>60296030<function id="SetLocalInt" num="27">6031<synopsis>Set Local Variable - Int</synopsis>6032<description>6033This function can be used to set the value of a local6034variable whose type is <code>int</code>,6035<code>short</code>, <code>char</code>, <code>byte</code>, or6036<code>boolean</code>.6037</description>6038<origin>jvmdi</origin>6039<capabilities>6040<required id="can_access_local_variables"></required>6041</capabilities>6042<parameters>6043<param id="thread">6044<jthread null="current" frame="frame"/>6045<description>6046The thread of the frame containing the variable's value.6047</description>6048</param>6049<param id="depth">6050<jframeID thread="thread"/>6051<description>6052The depth of the frame containing the variable's value.6053</description>6054</param>6055<param id="slot">6056<jint/>6057<description>6058The variable's slot number.6059</description>6060</param>6061<param id="value">6062<jint/>6063<description>6064The new value for the variable.6065</description>6066</param>6067</parameters>6068<errors>6069<error id="JVMTI_ERROR_INVALID_SLOT">6070Invalid <code>slot</code>.6071</error>6072<error id="JVMTI_ERROR_TYPE_MISMATCH">6073The variable type is not6074<code>int</code>, <code>short</code>,6075<code>char</code>, <code>byte</code>, or6076<code>boolean</code>.6077</error>6078<error id="JVMTI_ERROR_OPAQUE_FRAME">6079Not a visible frame6080</error>6081</errors>6082</function>60836084<function id="SetLocalLong" num="28">6085<synopsis>Set Local Variable - Long</synopsis>6086<description>6087This function can be used to set the value of a local6088variable whose type is <code>long</code>.6089</description>6090<origin>jvmdi</origin>6091<capabilities>6092<required id="can_access_local_variables"></required>6093</capabilities>6094<parameters>6095<param id="thread">6096<jthread null="current" frame="frame"/>6097<description>6098The thread of the frame containing the variable's value.6099</description>6100</param>6101<param id="depth">6102<jframeID thread="thread"/>6103<description>6104The depth of the frame containing the variable's value.6105</description>6106</param>6107<param id="slot">6108<jint/>6109<description>6110The variable's slot number.6111</description>6112</param>6113<param id="value">6114<jlong/>6115<description>6116The new value for the variable.6117</description>6118</param>6119</parameters>6120<errors>6121<error id="JVMTI_ERROR_INVALID_SLOT">6122Invalid <code>slot</code>.6123</error>6124<error id="JVMTI_ERROR_TYPE_MISMATCH">6125The variable type is not <code>long</code>.6126</error>6127<error id="JVMTI_ERROR_OPAQUE_FRAME">6128Not a visible frame6129</error>6130</errors>6131</function>61326133<function id="SetLocalFloat" num="29">6134<synopsis>Set Local Variable - Float</synopsis>6135<description>6136This function can be used to set the value of a local6137variable whose type is <code>float</code>.6138</description>6139<origin>jvmdi</origin>6140<capabilities>6141<required id="can_access_local_variables"></required>6142</capabilities>6143<parameters>6144<param id="thread">6145<jthread null="current" frame="frame"/>6146<description>6147The thread of the frame containing the variable's value.6148</description>6149</param>6150<param id="depth">6151<jframeID thread="thread"/>6152<description>6153The depth of the frame containing the variable's value.6154</description>6155</param>6156<param id="slot">6157<jint/>6158<description>6159The variable's slot number.6160</description>6161</param>6162<param id="value">6163<jfloat/>6164<description>6165The new value for the variable.6166</description>6167</param>6168</parameters>6169<errors>6170<error id="JVMTI_ERROR_INVALID_SLOT">6171Invalid <code>slot</code>.6172</error>6173<error id="JVMTI_ERROR_TYPE_MISMATCH">6174The variable type is not <code>float</code>.6175</error>6176<error id="JVMTI_ERROR_OPAQUE_FRAME">6177Not a visible frame6178</error>6179</errors>6180</function>61816182<function id="SetLocalDouble" num="30">6183<synopsis>Set Local Variable - Double</synopsis>6184<description>6185This function can be used to set the value of a local6186variable whose type is <code>double</code>.6187</description>6188<origin>jvmdi</origin>6189<capabilities>6190<required id="can_access_local_variables"></required>6191</capabilities>6192<parameters>6193<param id="thread">6194<jthread null="current" frame="frame"/>6195<description>6196The thread of the frame containing the variable's value.6197</description>6198</param>6199<param id="depth">6200<jframeID thread="thread"/>6201<description>6202The depth of the frame containing the variable's value.6203</description>6204</param>6205<param id="slot">6206<jint/>6207<description>6208The variable's slot number.6209</description>6210</param>6211<param id="value">6212<jdouble/>6213<description>6214The new value for the variable.6215</description>6216</param>6217</parameters>6218<errors>6219<error id="JVMTI_ERROR_INVALID_SLOT">6220Invalid <code>slot</code>.6221</error>6222<error id="JVMTI_ERROR_TYPE_MISMATCH">6223The variable type is not <code>double</code>.6224</error>6225<error id="JVMTI_ERROR_OPAQUE_FRAME">6226Not a visible frame6227</error>6228</errors>6229</function>6230</category>62316232<category id="breakpointCategory" label="Breakpoint">62336234<intro>6235</intro>62366237<function id="SetBreakpoint" num="38">6238<synopsis>Set Breakpoint</synopsis>6239<description>6240Set a breakpoint at the instruction indicated by6241<code>method</code> and <code>location</code>.6242An instruction can only have one breakpoint.6243<p/>6244Whenever the designated instruction is about to be executed, a6245<eventlink id="Breakpoint"></eventlink> event is generated.6246</description>6247<origin>jvmdi</origin>6248<capabilities>6249<required id="can_generate_breakpoint_events"></required>6250</capabilities>6251<parameters>6252<param id="klass">6253<jclass method="method"/>6254<description>6255The class in which to set the breakpoint6256</description>6257</param>6258<param id="method">6259<jmethodID class="klass"/>6260<description>6261The method in which to set the breakpoint6262</description>6263</param>6264<param id="location">6265<jlocation/>6266<description>6267the index of the instruction at which to set the breakpoint62686269</description>6270</param>6271</parameters>6272<errors>6273<error id="JVMTI_ERROR_DUPLICATE">6274The designated bytecode already has a breakpoint.6275</error>6276</errors>6277</function>62786279<function id="ClearBreakpoint" num="39">6280<synopsis>Clear Breakpoint</synopsis>6281<description>6282Clear the breakpoint at the bytecode indicated by6283<code>method</code> and <code>location</code>.6284</description>6285<origin>jvmdi</origin>6286<capabilities>6287<required id="can_generate_breakpoint_events"></required>6288</capabilities>6289<parameters>6290<param id="klass">6291<jclass method="method"/>6292<description>6293The class in which to clear the breakpoint6294</description>6295</param>6296<param id="method">6297<jmethodID class="klass"/>6298<description>6299The method in which to clear the breakpoint6300</description>6301</param>6302<param id="location">6303<jlocation/>6304<description>6305the index of the instruction at which to clear the breakpoint6306</description>6307</param>6308</parameters>6309<errors>6310<error id="JVMTI_ERROR_NOT_FOUND">6311There's no breakpoint at the designated bytecode.6312</error>6313</errors>6314</function>63156316</category>63176318<category id="fieldWatch" label="Watched Field">63196320<intro>6321</intro>63226323<function id="SetFieldAccessWatch" num="41">6324<synopsis>Set Field Access Watch</synopsis>6325<description>6326Generate a <eventlink id="FieldAccess"></eventlink> event6327when the field specified6328by <code>klass</code> and6329<code>field</code> is about to be accessed.6330An event will be generated for each access of the field6331until it is canceled with6332<functionlink id="ClearFieldAccessWatch"></functionlink>.6333Field accesses from Java programming language code or from JNI code are watched,6334fields modified by other means are not watched.6335Note that <jvmti/> users should be aware that their own field accesses6336will trigger the watch.6337A field can only have one field access watch set.6338Modification of a field is not considered an access--use6339<functionlink id="SetFieldModificationWatch"></functionlink>6340to monitor modifications.6341</description>6342<origin>jvmdi</origin>6343<capabilities>6344<required id="can_generate_field_access_events"></required>6345</capabilities>6346<parameters>6347<param id="klass">6348<jclass field="field"/>6349<description>6350The class containing the field to watch6351</description>6352</param>6353<param id="field">6354<jfieldID class="klass"/>6355<description>6356The field to watch63576358</description>6359</param>6360</parameters>6361<errors>6362<error id="JVMTI_ERROR_DUPLICATE">6363The designated field is already being watched for accesses.6364</error>6365</errors>6366</function>63676368<function id="ClearFieldAccessWatch" num="42">6369<synopsis>Clear Field Access Watch</synopsis>6370<description>6371Cancel a field access watch previously set by6372<functionlink id="SetFieldAccessWatch"></functionlink>, on the6373field specified6374by <code>klass</code> and6375<code>field</code>.6376</description>6377<origin>jvmdi</origin>6378<capabilities>6379<required id="can_generate_field_access_events"></required>6380</capabilities>6381<parameters>6382<param id="klass">6383<jclass field="field"/>6384<description>6385The class containing the field to watch6386</description>6387</param>6388<param id="field">6389<jfieldID class="klass"/>6390<description>6391The field to watch63926393</description>6394</param>6395</parameters>6396<errors>6397<error id="JVMTI_ERROR_NOT_FOUND">6398The designated field is not being watched for accesses.6399</error>6400</errors>6401</function>64026403<function id="SetFieldModificationWatch" num="43">6404<synopsis>Set Field Modification Watch</synopsis>6405<description>6406Generate a <eventlink id="FieldModification"></eventlink> event6407when the field specified6408by <code>klass</code> and6409<code>field</code> is about to be modified.6410An event will be generated for each modification of the field6411until it is canceled with6412<functionlink id="ClearFieldModificationWatch"></functionlink>.6413Field modifications from Java programming language code or from JNI code are watched,6414fields modified by other means are not watched.6415Note that <jvmti/> users should be aware that their own field modifications6416will trigger the watch.6417A field can only have one field modification watch set.6418</description>6419<origin>jvmdi</origin>6420<capabilities>6421<required id="can_generate_field_modification_events"></required>6422</capabilities>6423<parameters>6424<param id="klass">6425<jclass field="field"/>6426<description>6427The class containing the field to watch6428</description>6429</param>6430<param id="field">6431<jfieldID class="klass"/>6432<description>6433The field to watch64346435</description>6436</param>6437</parameters>6438<errors>6439<error id="JVMTI_ERROR_DUPLICATE">6440The designated field is already being watched for modifications.6441</error>6442</errors>6443</function>64446445<function id="ClearFieldModificationWatch" num="44">6446<synopsis>Clear Field Modification Watch</synopsis>6447<description>64486449Cancel a field modification watch previously set by6450<functionlink id="SetFieldModificationWatch"></functionlink>, on the6451field specified6452by <code>klass</code> and6453<code>field</code>.6454</description>6455<origin>jvmdi</origin>6456<capabilities>6457<required id="can_generate_field_modification_events"></required>6458</capabilities>6459<parameters>6460<param id="klass">6461<jclass field="field"/>6462<description>6463The class containing the field to watch6464</description>6465</param>6466<param id="field">6467<jfieldID class="klass"/>6468<description>6469The field to watch64706471</description>6472</param>6473</parameters>6474<errors>6475<error id="JVMTI_ERROR_NOT_FOUND">6476The designated field is not being watched for modifications.6477</error>6478</errors>6479</function>6480</category>64816482<category id="module" label="Module">64836484<intro>6485</intro>64866487<function id="GetAllModules" num="3" since="9">6488<synopsis>Get All Modules</synopsis>6489<description>6490Return an array of all modules loaded in the virtual machine.6491The array includes the unnamed module for each class loader.6492The number of modules in the array is returned via6493<code>module_count_ptr</code>, and the array itself via6494<code>modules_ptr</code>.6495<p/>6496</description>6497<origin>new</origin>6498<capabilities>6499</capabilities>6500<parameters>6501<param id="module_count_ptr">6502<outptr><jint/></outptr>6503<description>6504On return, points to the number of returned modules.6505</description>6506</param>6507<param id="modules_ptr">6508<allocbuf outcount="module_count_ptr"><jobject/></allocbuf>6509<description>6510On return, points to an array of references, one6511for each module.6512</description>6513</param>6514</parameters>6515<errors>6516</errors>6517</function>65186519<function id="GetNamedModule" num="40" since="9">6520<synopsis>Get Named Module</synopsis>6521<description>6522Return the <code>java.lang.Module</code> object for a named6523module defined to a class loader that contains a given package.6524The module is returned via <code>module_ptr</code>.6525<p/>6526If a named module is defined to the class loader and it6527contains the package then that named module is returned,6528otherwise <code>NULL</code> is returned.6529<p/>6530</description>6531<origin>new</origin>6532<capabilities>6533</capabilities>6534<parameters>6535<param id="class_loader">6536<ptrtype>6537<jobject/>6538<nullok>the bootstrap loader is assumed</nullok>6539</ptrtype>6540<description>6541A class loader.6542If the <code>class_loader</code> is not <code>NULL</code>6543or a subclass of <code>java.lang.ClassLoader</code>6544this function returns6545<errorlink id="JVMTI_ERROR_ILLEGAL_ARGUMENT"></errorlink>.6546</description>6547</param>6548<param id="package_name">6549<inbuf><char/></inbuf>6550<description>6551The name of the package, encoded as a6552<internallink id="mUTF">modified UTF-8</internallink> string.6553The package name is in internal form (JVMS 4.2.1);6554identifiers are separated by forward slashes rather than periods.6555</description>6556</param>6557<param id="module_ptr">6558<outptr><jobject/></outptr>6559<description>6560On return, points to a <code>java.lang.Module</code> object6561or points to <code>NULL</code>.6562</description>6563</param>6564</parameters>6565<errors>6566<error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">6567If class loader is not <code>NULL</code> and is not a class loader object.6568</error>6569</errors>6570</function>65716572<function id="AddModuleReads" num="94" since="9">6573<synopsis>Add Module Reads</synopsis>6574<description>6575Update a module to read another module. This function is a no-op6576when <paramlink id="module"></paramlink> is an unnamed module.6577This function facilitates the instrumentation of code6578in named modules where that instrumentation requires6579expanding the set of modules that a module reads.6580</description>6581<origin>new</origin>6582<capabilities>6583</capabilities>6584<parameters>6585<param id="module">6586<ptrtype><jobject/></ptrtype>6587<description>6588The module to update.6589</description>6590</param>6591<param id="to_module">6592<ptrtype><jobject/></ptrtype>6593<description>6594The additional module to read.6595</description>6596</param>6597</parameters>6598<errors>6599<error id="JVMTI_ERROR_INVALID_MODULE">6600If <paramlink id="module"></paramlink> is not a module object.6601</error>6602<error id="JVMTI_ERROR_INVALID_MODULE">6603If <paramlink id="to_module"></paramlink> is not a module object.6604</error>6605<error id="JVMTI_ERROR_UNMODIFIABLE_MODULE">6606if the module cannot be modified.6607See <functionlink id="IsModifiableModule"/>.6608</error>6609</errors>6610</function>66116612<function id="AddModuleExports" num="95" since="9">6613<synopsis>Add Module Exports</synopsis>6614<description>6615Update a module to export a package to another module.6616This function is a no-op when <paramlink id="module"></paramlink>6617is an unnamed module or an open module.6618This function facilitates the instrumentation of code6619in named modules where that instrumentation requires6620expanding the set of packages that a module exports.6621</description>6622<origin>new</origin>6623<capabilities>6624</capabilities>6625<parameters>6626<param id="module">6627<ptrtype><jobject/></ptrtype>6628<description>6629The module to update.6630</description>6631</param>6632<param id="pkg_name">6633<inbuf><char/></inbuf>6634<description>6635The exported package name.6636</description>6637</param>6638<param id="to_module">6639<ptrtype><jobject/></ptrtype>6640<description>6641The module the package is exported to.6642If the <code>to_module</code> is not a subclass of6643<code>java.lang.Module</code> this function returns6644<errorlink id="JVMTI_ERROR_INVALID_MODULE"></errorlink>.6645</description>6646</param>6647</parameters>6648<errors>6649<error id="JVMTI_ERROR_INVALID_MODULE">6650If <paramlink id="module"></paramlink> is not a module object.6651</error>6652<error id="JVMTI_ERROR_INVALID_MODULE">6653If <paramlink id="to_module"></paramlink> is not a module object.6654</error>6655<error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">6656If the package <paramlink id="pkg_name"></paramlink>6657does not belong to the module.6658</error>6659<error id="JVMTI_ERROR_UNMODIFIABLE_MODULE">6660if the module cannot be modified.6661See <functionlink id="IsModifiableModule"/>.6662</error>6663</errors>6664</function>66656666<function id="AddModuleOpens" num="96" since="9">6667<synopsis>Add Module Opens</synopsis>6668<description>6669Update a module to open a package to another module.6670This function is a no-op when <paramlink id="module"></paramlink>6671is an unnamed module or an open module.6672This function facilitates the instrumentation of code6673in modules where that instrumentation requires6674expanding the set of packages that a module opens to6675other modules.6676</description>6677<origin>new</origin>6678<capabilities>6679</capabilities>6680<parameters>6681<param id="module">6682<ptrtype><jobject/></ptrtype>6683<description>6684The module to update.6685</description>6686</param>6687<param id="pkg_name">6688<inbuf><char/></inbuf>6689<description>6690The package name of the package to open.6691</description>6692</param>6693<param id="to_module">6694<ptrtype><jobject/></ptrtype>6695<description>6696The module with the package to open.6697If the <code>to_module</code> is not a subclass of6698<code>java.lang.Module</code> this function returns6699<errorlink id="JVMTI_ERROR_INVALID_MODULE"></errorlink>.6700</description>6701</param>6702</parameters>6703<errors>6704<error id="JVMTI_ERROR_INVALID_MODULE">6705If <paramlink id="module"></paramlink> is not a module object.6706</error>6707<error id="JVMTI_ERROR_INVALID_MODULE">6708If <paramlink id="to_module"></paramlink> is not a module object.6709</error>6710<error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">6711If the package <paramlink id="pkg_name"></paramlink>6712does not belong to the module.6713</error>6714<error id="JVMTI_ERROR_UNMODIFIABLE_MODULE">6715if the module cannot be modified.6716See <functionlink id="IsModifiableModule"/>.6717</error>6718</errors>6719</function>67206721<function id="AddModuleUses" num="97" since="9">6722<synopsis>Add Module Uses</synopsis>6723<description>6724Updates a module to add a service to the set of services that6725a module uses. This function is a no-op when the module6726is an unnamed module.6727This function facilitates the instrumentation of code6728in named modules where that instrumentation requires6729expanding the set of services that a module is using.6730</description>6731<origin>new</origin>6732<capabilities>6733</capabilities>6734<parameters>6735<param id="module">6736<ptrtype><jobject/></ptrtype>6737<description>6738The module to update.6739</description>6740</param>6741<param id="service">6742<ptrtype><jclass/></ptrtype>6743<description>6744The service to use.6745</description>6746</param>6747</parameters>6748<errors>6749<error id="JVMTI_ERROR_INVALID_MODULE">6750If <paramlink id="module"></paramlink> is not a module object.6751</error>6752<error id="JVMTI_ERROR_INVALID_CLASS">6753If <paramlink id="service"></paramlink> is not a class object.6754</error>6755<error id="JVMTI_ERROR_UNMODIFIABLE_MODULE">6756if the module cannot be modified.6757See <functionlink id="IsModifiableModule"/>.6758</error>6759</errors>6760</function>67616762<function id="AddModuleProvides" num="98" since="9">6763<synopsis>Add Module Provides</synopsis>6764<description>6765Updates a module to add a service to the set of services that6766a module provides. This function is a no-op when the module6767is an unnamed module.6768This function facilitates the instrumentation of code6769in named modules where that instrumentation requires6770changes to the services that are provided.6771</description>6772<origin>new</origin>6773<capabilities>6774</capabilities>6775<parameters>6776<param id="module">6777<ptrtype><jobject/></ptrtype>6778<description>6779The module to update.6780</description>6781</param>6782<param id="service">6783<ptrtype><jclass/></ptrtype>6784<description>6785The service to provide.6786</description>6787</param>6788<param id="impl_class">6789<ptrtype><jclass/></ptrtype>6790<description>6791The implementation class for the provided service.6792</description>6793</param>6794</parameters>6795<errors>6796<error id="JVMTI_ERROR_INVALID_MODULE">6797If <paramlink id="module"></paramlink> is not a module object.6798</error>6799<error id="JVMTI_ERROR_INVALID_CLASS">6800If <paramlink id="service"></paramlink> is not a class object.6801</error>6802<error id="JVMTI_ERROR_INVALID_CLASS">6803If <paramlink id="impl_class"></paramlink> is not a class object.6804</error>6805<error id="JVMTI_ERROR_UNMODIFIABLE_MODULE">6806if the module cannot be modified.6807See <functionlink id="IsModifiableModule"/>.6808</error>6809</errors>6810</function>68116812<function id="IsModifiableModule" num="99" since="9">6813<synopsis>Is Modifiable Module</synopsis>6814<description>6815Determines whether a module is modifiable.6816If a module is modifiable then this module can be updated with6817<functionlink id="AddModuleReads"/>, <functionlink id="AddModuleExports"/>,6818<functionlink id="AddModuleOpens"/>, <functionlink id="AddModuleUses"/>,6819and <functionlink id="AddModuleProvides"/>. If a module is not modifiable6820then the module can not be updated with these functions. The result of6821this function is always <code>JNI_TRUE</code> when called to determine6822if an unnamed module is modifiable.6823</description>6824<origin>new</origin>6825<capabilities>6826</capabilities>6827<parameters>6828<param id="module">6829<ptrtype><jobject/></ptrtype>6830<description>6831The module to query.6832</description>6833</param>6834<param id="is_modifiable_module_ptr">6835<outptr><jboolean/></outptr>6836<description>6837On return, points to the boolean result of this function.6838</description>6839</param>6840</parameters>6841<errors>6842<error id="JVMTI_ERROR_INVALID_MODULE">6843If <paramlink id="module"></paramlink> is not a module object.6844</error>6845</errors>6846</function>68476848</category>68496850<category id="class" label="Class">6851<function id="GetLoadedClasses" jkernel="yes" num="78">6852<synopsis>Get Loaded Classes</synopsis>6853<description>6854Return an array of all classes loaded in the virtual machine.6855The number of classes in the array is returned via6856<code>class_count_ptr</code>, and the array itself via6857<code>classes_ptr</code>.6858<p/>6859A class or interface creation can be triggered by one of the following:6860<ul>6861<li>By loading and deriving a class from a <code>class</code> file representation6862using a class loader (see <vmspec chapter="5.3"/>).</li>6863<li>By invoking <externallink id="../api/java.base/java/lang/invoke/MethodHandles.Lookup.html#defineHiddenClass(byte[],boolean,java.lang.invoke.MethodHandles.Lookup.ClassOption...)">Lookup::defineHiddenClass</externallink>6864that creates a hidden class or interface from a <code>class</code> file representation.</li>6865<li>By invoking methods in certain Java SE Platform APIs such as reflection.</li>6866</ul>6867<p/>6868An array class is created directly by the Java virtual machine. The creation6869can be triggered by using class loaders or by invoking methods in certain6870Java SE Platform APIs such as reflection.6871<p/>6872The returned list includes all classes and interfaces, including6873<externallink id="../api/java.base/java/lang/Class.html#isHidden()">6874hidden classes or interfaces</externallink>,6875and also array classes of all types6876(including arrays of primitive types).6877Primitive classes (for example, <code>java.lang.Integer.TYPE</code>) are6878<i>not</i> included in the returned list.6879</description>6880<origin>jvmdi</origin>6881<capabilities>6882</capabilities>6883<parameters>6884<param id="class_count_ptr">6885<outptr><jint/></outptr>6886<description>6887On return, points to the number of classes.6888</description>6889</param>6890<param id="classes_ptr">6891<allocbuf outcount="class_count_ptr"><jclass/></allocbuf>6892<description>6893On return, points to an array of references, one6894for each class.6895</description>6896</param>6897</parameters>6898<errors>6899</errors>6900</function>69016902<function id="GetClassLoaderClasses" jkernel="yes" num="79">6903<synopsis>Get Classloader Classes</synopsis>6904<description>6905Returns an array of all classes which this class loader6906can find by name via6907<externallink id="../api/java.base/java/lang/ClassLoader.html#loadClass(java.lang.String,boolean)">ClassLoader::loadClass</externallink>,6908<externallink id="../api/java.base/java/lang/Class.html#forName(java.lang.String,boolean,java.lang.ClassLoader)">Class::forName</externallink> and bytecode linkage.6909That is, all classes for which <code>initiating_loader</code>6910has been recorded as an initiating loader.6911Each class in the returned array was created by this class loader,6912either by defining it directly or by delegation to another class loader.6913See <vmspec chapter="5.3"/>.6914<p/>6915The returned list does not include6916<externallink id="../api/java.base/java/lang/Class.html#isHidden()">hidden6917classes or interfaces</externallink> or array classes whose6918element type is a hidden class or interface as they cannot be discovered6919by any class loader.6920<p/>6921The number of classes in the array is returned via6922<code>class_count_ptr</code>, and the array itself via6923<code>classes_ptr</code>.6924<p/>6925See <externallink id="../api/java.base/java/lang/invoke/MethodHandles.Lookup.html#defineHiddenClass(byte[],boolean,java.lang.invoke.MethodHandles.Lookup.ClassOption...)">Lookup::defineHiddenClass</externallink>.6926</description>6927<origin>jvmdi</origin>6928<capabilities>6929</capabilities>6930<parameters>6931<param id="initiating_loader">6932<ptrtype>6933<jobject/>6934<nullok>the classes initiated by the bootstrap loader will be returned</nullok>6935</ptrtype>6936<description>6937An initiating class loader.6938</description>6939</param>6940<param id="class_count_ptr">6941<outptr><jint/></outptr>6942<description>6943On return, points to the number of classes.6944</description>6945</param>6946<param id="classes_ptr">6947<allocbuf outcount="class_count_ptr"><jclass/></allocbuf>6948<description>6949On return, points to an array of references, one6950for each class.6951</description>6952</param>6953</parameters>6954<errors>6955</errors>6956</function>69576958<function id="GetClassSignature" phase="start" num="48">6959<synopsis>Get Class Signature</synopsis>6960<description>6961Return the name and the generic signature of the class indicated by <code>klass</code>.6962<p/>6963If the class is a class or interface, then:6964<ul>6965<li>If the class or interface is not <externallink id="../api/java.base/java/lang/Class.html#isHidden()">hidden</externallink>,6966then the returned name is the <externallink id="jni/types.html#type-signatures">6967JNI type signature</externallink>.6968For example, java.util.List is "Ljava/util/List;"6969</li>6970<li>If the class or interface is <externallink id="../api/java.base/java/lang/Class.html#isHidden()">hidden</externallink>,6971then the returned name is a string of the form:6972<code>"L" + N + "." + S + ";"</code>6973where <code>N</code> is the binary name encoded in internal form (JVMS 4.2.1)6974indicated by the <code>class</code> file passed to6975<externallink id="../api/java.base/java/lang/invoke/MethodHandles.Lookup.html#defineHiddenClass(byte[],boolean,java.lang.invoke.MethodHandles.Lookup.ClassOption...)">Lookup::defineHiddenClass</externallink>,6976and <code>S</code> is an unqualified name.6977The returned name is not a type descriptor and does not conform to JVMS 4.3.2.6978For example, com.foo.Foo/AnySuffix is "Lcom/foo/Foo.AnySuffix;"6979</li>6980</ul>6981<p/>6982If the class indicated by <code>klass</code> represents an array class, then6983the returned name is a string consisting of one or more "<code>[</code>" characters6984representing the depth of the array nesting, followed by the class signature6985of the element type. For example the class signature of java.lang.String[] is6986"[Ljava/lang/String;" and that of int[] is "[I".6987<p/>6988If the class indicated by <code>klass</code> represents primitive type or <code>void</code>,6989then the returned name is the <externallink id="jni/types.html#type-signatures">6990type signature character of the corresponding primitive type</externallink>.6991For example, java.lang.Integer.TYPE is "I".6992</description>6993<origin>jvmdiClone</origin>6994<capabilities>6995</capabilities>6996<parameters>6997<param id="klass">6998<jclass/>6999<description>7000The class to query.7001</description>7002</param>7003<param id="signature_ptr">7004<allocbuf>7005<char/>7006<nullok>the signature is not returned</nullok>7007</allocbuf>7008<description>7009On return, points to the JNI type signature of the class, encoded as a7010<internallink id="mUTF">modified UTF-8</internallink> string.7011</description>7012</param>7013<param id="generic_ptr">7014<allocbuf>7015<char/>7016<nullok>the generic signature is not returned</nullok>7017</allocbuf>7018<description>7019On return, points to the generic signature of the class, encoded as a7020<internallink id="mUTF">modified UTF-8</internallink> string.7021If there is no generic signature attribute for the class, then,7022on return, points to <code>NULL</code>.7023</description>7024</param>7025</parameters>7026<errors>7027</errors>7028</function>70297030<function id="GetClassStatus" phase="start" num="49">7031<synopsis>Get Class Status</synopsis>7032<description>7033Get the status of the class. Zero or more of the following bits can be7034set.7035<constants id="jvmtiClassStatus" label="Class Status Flags" kind="bits">7036<constant id="JVMTI_CLASS_STATUS_VERIFIED" num="1">7037Class bytecodes have been verified7038</constant>7039<constant id="JVMTI_CLASS_STATUS_PREPARED" num="2">7040Class preparation is complete7041</constant>7042<constant id="JVMTI_CLASS_STATUS_INITIALIZED" num="4">7043Class initialization is complete. Static initializer has been run.7044</constant>7045<constant id="JVMTI_CLASS_STATUS_ERROR" num="8">7046Error during initialization makes class unusable7047</constant>7048<constant id="JVMTI_CLASS_STATUS_ARRAY" num="16">7049Class is an array. If set, all other bits are zero.7050</constant>7051<constant id="JVMTI_CLASS_STATUS_PRIMITIVE" num="32">7052Class is a primitive class (for example, <code>java.lang.Integer.TYPE</code>).7053If set, all other bits are zero.7054</constant>7055</constants>7056</description>7057<origin>jvmdi</origin>7058<capabilities>7059</capabilities>7060<parameters>7061<param id="klass">7062<jclass/>7063<description>7064The class to query.7065</description>7066</param>7067<param id="status_ptr">7068<outptr><jint/></outptr>7069<description>7070On return, points to the current state of this class as one or7071more of the <internallink id="jvmtiClassStatus">class status flags</internallink>.7072</description>7073</param>7074</parameters>7075<errors>7076</errors>7077</function>70787079<function id="GetSourceFileName" phase="start" num="50">7080<synopsis>Get Source File Name</synopsis>7081<description>7082For the class indicated by <code>klass</code>, return the source file7083name via <code>source_name_ptr</code>. The returned string7084is a file name only and never contains a directory name.7085<p/>7086For primitive classes (for example, <code>java.lang.Integer.TYPE</code>)7087and for arrays this function returns7088<errorlink id="JVMTI_ERROR_ABSENT_INFORMATION"></errorlink>.7089</description>7090<origin>jvmdi</origin>7091<capabilities>7092<required id="can_get_source_file_name"></required>7093</capabilities>7094<parameters>7095<param id="klass">7096<jclass/>7097<description>7098The class to query.7099</description>7100</param>7101<param id="source_name_ptr">7102<allocbuf><char/></allocbuf>7103<description>7104On return, points to the class's source file name, encoded as a7105<internallink id="mUTF">modified UTF-8</internallink> string.7106</description>7107</param>7108</parameters>7109<errors>7110<error id="JVMTI_ERROR_ABSENT_INFORMATION">7111Class information does not include a source file name. This includes7112cases where the class is an array class or primitive class.7113</error>7114</errors>7115</function>71167117<function id="GetClassModifiers" phase="start" num="51">7118<synopsis>Get Class Modifiers</synopsis>7119<description>7120For the class indicated by <code>klass</code>, return the access7121flags7122via <code>modifiers_ptr</code>.7123Access flags are defined in <vmspec chapter="4"/>.7124<p/>7125If the class is an array class, then its public, private, and protected7126modifiers are the same as those of its component type. For arrays of7127primitives, this component type is represented by one of the primitive7128classes (for example, <code>java.lang.Integer.TYPE</code>).7129<p/>7130If the class is a primitive class, its public modifier is always true,7131and its protected and private modifiers are always false.7132<p/>7133If the class is an array class or a primitive class then its final7134modifier is always true and its interface modifier is always false.7135The values of its other modifiers are not determined by this specification.71367137</description>7138<origin>jvmdi</origin>7139<capabilities>7140</capabilities>7141<parameters>7142<param id="klass">7143<jclass/>7144<description>7145The class to query.7146</description>7147</param>7148<param id="modifiers_ptr">7149<outptr><jint/></outptr>7150<description>7151On return, points to the current access flags of this class.71527153</description>7154</param>7155</parameters>7156<errors>7157</errors>7158</function>71597160<function id="GetClassMethods" phase="start" num="52">7161<synopsis>Get Class Methods</synopsis>7162<description>7163For the class indicated by <code>klass</code>, return a count of7164methods via <code>method_count_ptr</code> and a list of7165method IDs via <code>methods_ptr</code>. The method list contains7166constructors and static initializers as well as true methods.7167Only directly declared methods are returned (not inherited methods).7168An empty method list is returned for array classes and primitive classes7169(for example, <code>java.lang.Integer.TYPE</code>).7170</description>7171<origin>jvmdi</origin>7172<capabilities>7173<capability id="can_maintain_original_method_order"/>7174</capabilities>7175<parameters>7176<param id="klass">7177<jclass/>7178<description>7179The class to query.7180</description>7181</param>7182<param id="method_count_ptr">7183<outptr><jint/></outptr>7184<description>7185On return, points to the number of methods declared in this class.7186</description>7187</param>7188<param id="methods_ptr">7189<allocbuf outcount="method_count_ptr"><jmethodID class="klass"/></allocbuf>7190<description>7191On return, points to the method ID array.7192</description>7193</param>7194</parameters>7195<errors>7196<error id="JVMTI_ERROR_CLASS_NOT_PREPARED">7197<paramlink id="klass"></paramlink> is not prepared.7198</error>7199</errors>7200</function>72017202<function id="GetClassFields" phase="start" num="53">7203<synopsis>Get Class Fields</synopsis>7204<description>7205For the class indicated by <code>klass</code>, return a count of fields7206via <code>field_count_ptr</code> and a list of field IDs via7207<code>fields_ptr</code>.7208Only directly declared fields are returned (not inherited fields).7209Fields are returned in the order they occur in the class file.7210An empty field list is returned for array classes and primitive classes7211(for example, <code>java.lang.Integer.TYPE</code>).7212Use JNI to determine the length of an array.7213</description>7214<origin>jvmdi</origin>7215<capabilities>7216</capabilities>7217<parameters>7218<param id="klass">7219<jclass/>7220<description>7221The class to query.7222</description>7223</param>7224<param id="field_count_ptr">7225<outptr><jint/></outptr>7226<description>7227On return, points to the number of fields declared in this class.7228</description>7229</param>7230<param id="fields_ptr">7231<allocbuf outcount="field_count_ptr"><jfieldID/></allocbuf>7232<description>7233On return, points to the field ID array.7234</description>7235</param>7236</parameters>7237<errors>7238<error id="JVMTI_ERROR_CLASS_NOT_PREPARED">7239<paramlink id="klass"></paramlink> is not prepared.7240</error>7241</errors>7242</function>72437244<function id="GetImplementedInterfaces" phase="start" num="54">7245<synopsis>Get Implemented Interfaces</synopsis>7246<description>7247Return the direct super-interfaces of this class. For a class, this7248function returns the interfaces declared in its <code>implements</code>7249clause. For an interface, this function returns the interfaces declared in7250its <code>extends</code> clause.7251An empty interface list is returned for array classes and primitive classes7252(for example, <code>java.lang.Integer.TYPE</code>).7253</description>7254<origin>jvmdi</origin>7255<capabilities>7256</capabilities>7257<parameters>7258<param id="klass">7259<jclass/>7260<description>7261The class to query.7262</description>7263</param>7264<param id="interface_count_ptr">7265<outptr><jint/></outptr>7266<description>7267On return, points to the number of interfaces.7268</description>7269</param>7270<param id="interfaces_ptr">7271<allocbuf outcount="interface_count_ptr"><jclass/></allocbuf>7272<description>7273On return, points to the interface array.7274</description>7275</param>7276</parameters>7277<errors>7278<error id="JVMTI_ERROR_CLASS_NOT_PREPARED">7279<paramlink id="klass"></paramlink> is not prepared.7280</error>7281</errors>7282</function>72837284<function id="GetClassVersionNumbers" phase="start" num="145" since="1.1">7285<synopsis>Get Class Version Numbers</synopsis>7286<description>7287For the class indicated by <code>klass</code>,7288return the minor and major version numbers,7289as defined in7290<vmspec chapter="4"/>.7291</description>7292<origin>new</origin>7293<capabilities>7294</capabilities>7295<parameters>7296<param id="klass">7297<jclass/>7298<description>7299The class to query.7300</description>7301</param>7302<param id="minor_version_ptr">7303<outptr><jint/></outptr>7304<description>7305On return, points to the value of the7306<code>minor_version</code> item of the7307Class File Format.7308Note: to be consistent with the Class File Format,7309the minor version number is the first parameter.7310</description>7311</param>7312<param id="major_version_ptr">7313<outptr><jint/></outptr>7314<description>7315On return, points to the value of the7316<code>major_version</code> item of the7317Class File Format.7318</description>7319</param>7320</parameters>7321<errors>7322<error id="JVMTI_ERROR_ABSENT_INFORMATION">7323The class is a primitive or array class.7324</error>7325</errors>7326</function>73277328<function id="GetConstantPool" phase="start" num="146" since="1.1">7329<synopsis>Get Constant Pool</synopsis>7330<description>7331For the class indicated by <code>klass</code>,7332return the raw bytes of the constant pool in the format of the7333<code>constant_pool</code> item of7334<vmspec chapter="4"/>.7335The format of the constant pool may differ between versions7336of the Class File Format, so, the7337<functionlink id="GetClassVersionNumbers">minor and major7338class version numbers</functionlink> should be checked for7339compatibility.7340<p/>7341The returned constant pool might not have the same layout or7342contents as the constant pool in the defining class file.7343The constant pool returned by GetConstantPool() may have7344more or fewer entries than the defining constant pool.7345Entries may be in a different order.7346The constant pool returned by GetConstantPool() will match the7347constant pool used by7348<functionlink id="GetBytecodes">GetBytecodes()</functionlink>.7349That is, the bytecodes returned by GetBytecodes() will have7350constant pool indices which refer to constant pool entries returned7351by GetConstantPool().7352Note that since <functionlink id="RetransformClasses"/>7353and <functionlink id="RedefineClasses"/> can change7354the constant pool, the constant pool returned by this function7355can change accordingly. Thus, the correspondence between7356GetConstantPool() and GetBytecodes() does not hold if there7357is an intervening class retransformation or redefinition.7358The value of a constant pool entry used by a given bytecode will7359match that of the defining class file (even if the indices don't match).7360Constant pool entries which are not used directly or indirectly by7361bytecodes (for example, UTF-8 strings associated with annotations) are7362not required to exist in the returned constant pool.7363</description>7364<origin>new</origin>7365<capabilities>7366<required id="can_get_constant_pool"></required>7367</capabilities>7368<parameters>7369<param id="klass">7370<jclass/>7371<description>7372The class to query.7373</description>7374</param>7375<param id="constant_pool_count_ptr">7376<outptr><jint/></outptr>7377<description>7378On return, points to the number of entries7379in the constant pool table plus one.7380This corresponds to the <code>constant_pool_count</code>7381item of the Class File Format.7382</description>7383</param>7384<param id="constant_pool_byte_count_ptr">7385<outptr><jint/></outptr>7386<description>7387On return, points to the number of bytes7388in the returned raw constant pool.7389</description>7390</param>7391<param id="constant_pool_bytes_ptr">7392<allocbuf outcount="constant_pool_byte_count_ptr"><uchar/></allocbuf>7393<description>7394On return, points to the raw constant pool, that is the bytes7395defined by the <code>constant_pool</code> item of the7396Class File Format7397</description>7398</param>7399</parameters>7400<errors>7401<error id="JVMTI_ERROR_ABSENT_INFORMATION">7402The class is a primitive or array class.7403</error>7404</errors>7405</function>74067407<function id="IsInterface" phase="start" num="55">7408<synopsis>Is Interface</synopsis>7409<description>7410Determines whether a class object reference represents an interface.7411The <code>jboolean</code> result is7412<code>JNI_TRUE</code> if the "class" is actually an interface,7413<code>JNI_FALSE</code> otherwise.7414</description>7415<origin>jvmdi</origin>7416<capabilities>7417</capabilities>7418<parameters>7419<param id="klass">7420<jclass/>7421<description>7422The class to query.7423</description>7424</param>7425<param id="is_interface_ptr">7426<outptr><jboolean/></outptr>7427<description>7428On return, points to the boolean result of this function.74297430</description>7431</param>7432</parameters>7433<errors>7434</errors>7435</function>74367437<function id="IsArrayClass" phase="start" num="56">7438<synopsis>Is Array Class</synopsis>7439<description>7440Determines whether a class object reference represents an array.7441The <code>jboolean</code> result is7442<code>JNI_TRUE</code> if the class is an array,7443<code>JNI_FALSE</code> otherwise.7444</description>7445<origin>jvmdi</origin>7446<capabilities>7447</capabilities>7448<parameters>7449<param id="klass">7450<jclass/>7451<description>7452The class to query.7453</description>7454</param>7455<param id="is_array_class_ptr">7456<outptr><jboolean/></outptr>7457<description>7458On return, points to the boolean result of this function.74597460</description>7461</param>7462</parameters>7463<errors>7464</errors>7465</function>74667467<function id="IsModifiableClass" jkernel="yes" phase="start" num="45" since="1.1">7468<synopsis>Is Modifiable Class</synopsis>7469<description>7470Determines whether a class is modifiable.7471If a class is modifiable (<paramlink id="is_modifiable_class_ptr"/>7472returns <code>JNI_TRUE</code>) the class can be7473redefined with <functionlink id="RedefineClasses"/> (assuming7474the agent possesses the7475<fieldlink id="can_redefine_classes" struct="jvmtiCapabilities"/>7476capability) or7477retransformed with <functionlink id="RetransformClasses"/> (assuming7478the agent possesses the7479<fieldlink id="can_retransform_classes" struct="jvmtiCapabilities"/>7480capability).7481If a class is not modifiable (<paramlink id="is_modifiable_class_ptr"/>7482returns <code>JNI_FALSE</code>) the class can be neither7483redefined nor retransformed.7484<p/>7485Primitive classes (for example, <code>java.lang.Integer.TYPE</code>),7486array classes, and some implementation defined classes are never modifiable.7487<p/>7488</description>7489<origin>new</origin>7490<capabilities>7491<capability id="can_redefine_any_class">7492If possessed then all classes (except primitive, array, and some implementation defined7493classes) are modifiable with <functionlink id="RedefineClasses"/>.7494</capability>7495<capability id="can_retransform_any_class">7496If possessed then all classes (except primitive, array, and some implementation defined7497classes) are modifiable with <functionlink id="RetransformClasses"/>.7498</capability>7499<capability id="can_redefine_classes">7500No effect on the result of the function.7501But must additionally be possessed to modify the class with7502<functionlink id="RedefineClasses"/>.7503</capability>7504<capability id="can_retransform_classes">7505No effect on the result of the function.7506But must additionally be possessed to modify the class with7507<functionlink id="RetransformClasses"/>.7508</capability>7509</capabilities>7510<parameters>7511<param id="klass">7512<jclass/>7513<description>7514The class to query.7515</description>7516</param>7517<param id="is_modifiable_class_ptr">7518<outptr><jboolean/></outptr>7519<description>7520On return, points to the boolean result of this function.7521</description>7522</param>7523</parameters>7524<errors>7525</errors>7526</function>75277528<function id="GetClassLoader" phase="start" num="57">7529<synopsis>Get Class Loader</synopsis>7530<description>7531For the class indicated by <code>klass</code>, return via7532<code>classloader_ptr</code> a reference to the class loader for the7533class.7534</description>7535<origin>jvmdi</origin>7536<capabilities>7537</capabilities>7538<parameters>7539<param id="klass">7540<jclass/>7541<description>7542The class to query.7543</description>7544</param>7545<param id="classloader_ptr">7546<outptr><jobject/></outptr>7547<description>7548On return, points to the class loader that loaded7549this class.7550If the class was not created by a class loader7551or if the class loader is the bootstrap class loader,7552points to <code>NULL</code>.7553</description>7554</param>7555</parameters>7556<errors>7557</errors>75587559</function>75607561<function id="GetSourceDebugExtension" phase="start" num="90">7562<synopsis>Get Source Debug Extension</synopsis>7563<description>7564For the class indicated by <code>klass</code>, return the debug7565extension via <code>source_debug_extension_ptr</code>.7566The returned string7567contains exactly the debug extension information present in the7568class file of <code>klass</code>.7569</description>7570<origin>jvmdi</origin>7571<capabilities>7572<required id="can_get_source_debug_extension"></required>7573</capabilities>7574<parameters>7575<param id="klass">7576<jclass/>7577<description>7578The class to query.7579</description>7580</param>7581<param id="source_debug_extension_ptr">7582<allocbuf><char/></allocbuf>7583<description>7584On return, points to the class's debug extension, encoded as a7585<internallink id="mUTF">modified UTF-8</internallink> string.7586</description>7587</param>7588</parameters>7589<errors>7590<error id="JVMTI_ERROR_ABSENT_INFORMATION">7591Class information does not include a debug extension.7592</error>7593</errors>7594</function>75957596<function id="RetransformClasses" jkernel="yes" num="152" since="1.1">7597<synopsis>Retransform Classes</synopsis>7598<description>7599This function facilitates the7600<internallink id="bci">bytecode instrumentation</internallink>7601of already loaded classes.7602To replace the class definition without reference to the existing7603bytecodes, as one might do when recompiling from source for7604fix-and-continue debugging, <functionlink id="RedefineClasses"/>7605function should be used instead.7606<p/>7607When classes are initially loaded or when they are7608<functionlink id="RedefineClasses">redefined</functionlink>,7609the initial class file bytes can be transformed with the7610<eventlink id="ClassFileLoadHook"/> event.7611This function reruns the transformation process7612(whether or not a transformation has previously occurred).7613This retransformation follows these steps:7614<ul>7615<li>starting from the initial class file bytes7616</li>7617<li>for each <fieldlink id="can_retransform_classes"7618struct="jvmtiCapabilities">retransformation7619incapable</fieldlink>7620agent which received a7621<code>ClassFileLoadHook</code> event during the previous7622load or redefine, the bytes it returned7623(via the <code>new_class_data</code> parameter)7624are reused as the output of the transformation;7625note that this is equivalent to reapplying7626the previous transformation, unaltered. except that7627the <code>ClassFileLoadHook</code> event7628is <b>not</b> sent to these agents7629</li>7630<li>for each <fieldlink id="can_retransform_classes"7631struct="jvmtiCapabilities">retransformation7632capable</fieldlink>7633agent, the <code>ClassFileLoadHook</code> event is sent,7634allowing a new transformation to be applied7635</li>7636<li>the transformed class file bytes are installed as the new7637definition of the class7638</li>7639</ul>7640See the <eventlink id="ClassFileLoadHook"/> event for more details.7641<p/>7642The initial class file bytes represent the bytes passed to7643<code>ClassLoader.defineClass</code>7644or <code>RedefineClasses</code> (before any transformations7645were applied), however they may not exactly match them.7646The constant pool may differ in ways described in7647<functionlink id="GetConstantPool"/>.7648Constant pool indices in the bytecodes of methods will correspond.7649Some attributes may not be present.7650Where order is not meaningful, for example the order of methods,7651order may not be preserved.7652<p/>7653Retransformation can cause new versions of methods to be installed.7654Old method versions may become7655<internallink id="obsoleteMethods">obsolete</internallink>7656The new method version will be used on new invokes.7657If a method has active stack frames, those active frames continue to7658run the bytecodes of the original method version.7659<p/>7660This function does not cause any initialization except that which7661would occur under the customary JVM semantics.7662In other words, retransforming a class does not cause its initializers to be7663run. The values of static fields will remain as they were7664prior to the call.7665<p/>7666Threads need not be suspended.7667<p/>7668All breakpoints in the class are cleared.7669<p/>7670All attributes are updated.7671<p/>7672Instances of the retransformed class are not affected -- fields retain their7673previous values.7674<functionlink id="GetTag">Tags</functionlink> on the instances are7675also unaffected.7676<p/>7677In response to this call, no events other than the7678<eventlink id="ClassFileLoadHook"/> event7679will be sent.7680<p/>7681The retransformation may change method bodies, the constant pool and attributes7682(unless explicitly prohibited).7683The retransformation must not add, remove or rename fields or methods, change the7684signatures of methods, change modifiers, or change inheritance.7685The retransformation must not change the <code>NestHost</code>,7686<code>NestMembers</code>, <code>Record</code>, or <code>PermittedSubclasses</code>7687attributes.7688These restrictions may be lifted in future versions.7689See the error return description below for information on error codes7690returned if an unsupported retransformation is attempted.7691The class file bytes are not verified or installed until they have passed7692through the chain of <eventlink id="ClassFileLoadHook"/> events, thus the7693returned error code reflects the result of the transformations.7694If any error code is returned other than <code>JVMTI_ERROR_NONE</code>,7695none of the classes to be retransformed will have a new definition installed.7696When this function returns (with the error code of <code>JVMTI_ERROR_NONE</code>)7697all of the classes to be retransformed will have their new definitions installed.7698</description>7699<origin>new</origin>7700<capabilities>7701<required id="can_retransform_classes"></required>7702<capability id="can_retransform_any_class"></capability>7703</capabilities>7704<parameters>7705<param id="class_count">7706<jint min="0"/>7707<description>7708The number of classes to be retransformed.7709</description>7710</param>7711<param id="classes">7712<inbuf incount="class_count"><jclass/></inbuf>7713<description>7714The array of classes to be retransformed.7715</description>7716</param>7717</parameters>7718<errors>7719<error id="JVMTI_ERROR_UNMODIFIABLE_CLASS">7720One of the <paramlink id="classes"/> cannot be modified.7721See <functionlink id="IsModifiableClass"/>.7722</error>7723<error id="JVMTI_ERROR_INVALID_CLASS">7724One of the <paramlink id="classes"/> is not a valid class.7725</error>7726<error id="JVMTI_ERROR_UNSUPPORTED_VERSION">7727A retransformed class file has a version number not supported by this VM.7728</error>7729<error id="JVMTI_ERROR_INVALID_CLASS_FORMAT">7730A retransformed class file is malformed (The VM would return a <code>ClassFormatError</code>).7731</error>7732<error id="JVMTI_ERROR_CIRCULAR_CLASS_DEFINITION">7733The retransformed class file definitions would lead to a circular definition7734(the VM would return a <code>ClassCircularityError</code>).7735</error>7736<error id="JVMTI_ERROR_FAILS_VERIFICATION">7737The retransformed class file bytes fail verification.7738</error>7739<error id="JVMTI_ERROR_NAMES_DONT_MATCH">7740The class name defined in a retransformed class file is7741different from the name in the old class object.7742</error>7743<error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_ADDED">7744A retransformed class file would require adding a method.7745</error>7746<error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED">7747A retransformed class file changes a field.7748</error>7749<error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED">7750A direct superclass is different for a retransformed class file,7751or the set of directly implemented7752interfaces is different.7753</error>7754<error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_DELETED">7755A retransformed class file does not declare a method7756declared in the old class version.7757</error>7758<error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_ATTRIBUTE_CHANGED">7759A retransformed class file has unsupported differences in class attributes.7760</error>7761<error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED">7762A retransformed class file has different class modifiers.7763</error>7764<error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED">7765A method in the retransformed class file has different modifiers7766than its counterpart in the old class version.7767</error>7768</errors>7769</function>77707771<function id="RedefineClasses" jkernel="yes" num="87">7772<synopsis>Redefine Classes</synopsis>7773<typedef id="jvmtiClassDefinition" label="Class redefinition description">7774<field id="klass">7775<jclass/>7776<description>7777Class object for this class7778</description>7779</field>7780<field id="class_byte_count">7781<jint/>7782<description>7783Number of bytes defining class (below)7784</description>7785</field>7786<field id="class_bytes">7787<inbuf incount="class_byte_count"><uchar/></inbuf>7788<description>7789Bytes defining class (in <vmspec chapter="4"/>)7790</description>7791</field>7792</typedef>7793<description>7794All classes given are redefined according to the definitions7795supplied.7796This function is used to replace the definition of a class7797with a new definition, as might be needed in fix-and-continue7798debugging.7799Where the existing class file bytes are to be transformed, for7800example in7801<internallink id="bci">bytecode instrumentation</internallink>,7802<functionlink id="RetransformClasses"/> should be used.7803<p/>7804Redefinition can cause new versions of methods to be installed.7805Old method versions may become7806<internallink id="obsoleteMethods">obsolete</internallink>7807The new method version will be used on new invokes.7808If a method has active stack frames, those active frames continue to7809run the bytecodes of the original method version.7810If resetting of stack frames is desired, use7811<functionlink id="PopFrame"></functionlink>7812to pop frames with obsolete method versions.7813<p/>7814This function does not cause any initialization except that which7815would occur under the customary JVM semantics.7816In other words, redefining a class does not cause its initializers to be7817run. The values of static fields will remain as they were7818prior to the call.7819<p/>7820Threads need not be suspended.7821<p/>7822All breakpoints in the class are cleared.7823<p/>7824All attributes are updated.7825<p/>7826Instances of the redefined class are not affected -- fields retain their7827previous values.7828<functionlink id="GetTag">Tags</functionlink> on the instances are7829also unaffected.7830<p/>7831In response to this call, the <jvmti/> event7832<eventlink id="ClassFileLoadHook">Class File Load Hook</eventlink>7833will be sent (if enabled), but no other <jvmti/> events will be sent.7834<p/>7835The redefinition may change method bodies, the constant pool and attributes7836(unless explicitly prohibited).7837The redefinition must not add, remove or rename fields or methods, change the7838signatures of methods, change modifiers, or change inheritance.7839The redefinition must not change the <code>NestHost</code>,7840<code>NestMembers</code>, <code>Record</code>, or <code>PermittedSubclasses</code>7841attributes.7842These restrictions may be lifted in future versions.7843See the error return description below for information on error codes7844returned if an unsupported redefinition is attempted.7845The class file bytes are not verified or installed until they have passed7846through the chain of <eventlink id="ClassFileLoadHook"/> events, thus the7847returned error code reflects the result of the transformations applied7848to the bytes passed into <paramlink id="class_definitions"/>.7849If any error code is returned other than <code>JVMTI_ERROR_NONE</code>,7850none of the classes to be redefined will have a new definition installed.7851When this function returns (with the error code of <code>JVMTI_ERROR_NONE</code>)7852all of the classes to be redefined will have their new definitions installed.7853</description>7854<origin>jvmdi</origin>7855<capabilities>7856<required id="can_redefine_classes"></required>7857<capability id="can_redefine_any_class"></capability>7858</capabilities>7859<parameters>7860<param id="class_count">7861<jint min="0"/>7862<description>7863The number of classes specified in <code>class_definitions</code>7864</description>7865</param>7866<param id="class_definitions">7867<inbuf incount="class_count"><struct>jvmtiClassDefinition</struct></inbuf>7868<description>7869The array of new class definitions7870</description>7871</param>7872</parameters>7873<errors>7874<error id="JVMTI_ERROR_NULL_POINTER">7875One of <code>class_bytes</code> is <code>NULL</code>.7876</error>7877<error id="JVMTI_ERROR_UNMODIFIABLE_CLASS">7878An element of <code>class_definitions</code> cannot be modified.7879See <functionlink id="IsModifiableClass"/>.7880</error>7881<error id="JVMTI_ERROR_INVALID_CLASS">7882An element of <code>class_definitions</code> is not a valid class.7883</error>7884<error id="JVMTI_ERROR_UNSUPPORTED_VERSION">7885A new class file has a version number not supported by this VM.7886</error>7887<error id="JVMTI_ERROR_INVALID_CLASS_FORMAT">7888A new class file is malformed (The VM would return a <code>ClassFormatError</code>).7889</error>7890<error id="JVMTI_ERROR_CIRCULAR_CLASS_DEFINITION">7891The new class file definitions would lead to a circular definition7892(the VM would return a <code>ClassCircularityError</code>).7893</error>7894<error id="JVMTI_ERROR_FAILS_VERIFICATION">7895The class bytes fail verification.7896</error>7897<error id="JVMTI_ERROR_NAMES_DONT_MATCH">7898The class name defined in a new class file is7899different from the name in the old class object.7900</error>7901<error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_ADDED">7902A new class file would require adding a method.7903</error>7904<error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED">7905A new class version changes a field.7906</error>7907<error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED">7908A direct superclass is different for a new class7909version, or the set of directly implemented7910interfaces is different.7911</error>7912<error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_DELETED">7913A new class version does not declare a method7914declared in the old class version.7915</error>7916<error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_ATTRIBUTE_CHANGED">7917A new class version has unsupported differences in class attributes.7918</error>7919<error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED">7920A new class version has different modifiers.7921</error>7922<error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED">7923A method in the new class version has different modifiers7924than its counterpart in the old class version.7925</error>7926<error id="JVMTI_ERROR_UNMODIFIABLE_MODULE">7927A module cannot be modified.7928See <functionlink id="IsModifiableModule"/>.7929</error>7930</errors>7931</function>79327933</category>79347935<category id="object" label="Object">79367937<function id="GetObjectSize" jkernel="yes" phase="start" num="154">7938<synopsis>Get Object Size</synopsis>7939<description>7940For the object indicated by <code>object</code>,7941return via <code>size_ptr</code> the size of the object.7942This size is an implementation-specific approximation of7943the amount of storage consumed by this object.7944It may include some or all of the object's overhead, and thus7945is useful for comparison within an implementation but not7946between implementations.7947The estimate may change during a single invocation of the JVM.7948</description>7949<origin>new</origin>7950<capabilities>7951</capabilities>7952<parameters>7953<param id="object">7954<jobject/>7955<description>7956The object to query.7957</description>7958</param>7959<param id="size_ptr">7960<outptr><jlong/></outptr>7961<description>7962On return, points to the object's size in bytes.7963</description>7964</param>7965</parameters>7966<errors>7967</errors>7968</function>79697970<function id="GetObjectHashCode" phase="start" num="58">7971<synopsis>Get Object Hash Code</synopsis>7972<description>7973For the object indicated by <code>object</code>,7974return via <code>hash_code_ptr</code> a hash code.7975This hash code could be used to maintain a hash table of object references,7976however, on some implementations this can cause significant performance7977impacts--in most cases7978<internallink id="Heap">tags</internallink>7979will be a more efficient means of associating information with objects.7980This function guarantees7981the same hash code value for a particular object throughout its life7982</description>7983<origin>jvmdi</origin>7984<capabilities>7985</capabilities>7986<parameters>7987<param id="object">7988<jobject/>7989<description>7990The object to query.7991</description>7992</param>7993<param id="hash_code_ptr">7994<outptr><jint/></outptr>7995<description>7996On return, points to the object's hash code.7997</description>7998</param>7999</parameters>8000<errors>8001</errors>8002</function>80038004<function id="GetObjectMonitorUsage" num="59">8005<synopsis>Get Object Monitor Usage</synopsis>8006<typedef id="jvmtiMonitorUsage" label="Object monitor usage information">8007<field id="owner">8008<jthread/>8009<description>8010The thread owning this monitor, or <code>NULL</code> if unused8011</description>8012</field>8013<field id="entry_count">8014<jint/>8015<description>8016The number of times the owning thread has entered the monitor8017</description>8018</field>8019<field id="waiter_count">8020<jint/>8021<description>8022The number of threads waiting to own this monitor8023</description>8024</field>8025<field id="waiters">8026<allocfieldbuf><jthread/></allocfieldbuf>8027<description>8028The <code>waiter_count</code> waiting threads8029</description>8030</field>8031<field id="notify_waiter_count">8032<jint/>8033<description>8034The number of threads waiting to be notified by this monitor8035</description>8036</field>8037<field id="notify_waiters">8038<allocfieldbuf><jthread/></allocfieldbuf>8039<description>8040The <code>notify_waiter_count</code> threads waiting to be notified8041</description>8042</field>8043</typedef>8044<description>8045Get information about the object's monitor.8046The fields of the <functionlink id="jvmtiMonitorUsage"></functionlink> structure8047are filled in with information about usage of the monitor.8048<todo>8049Decide and then clarify suspend requirements.8050</todo>8051</description>8052<origin>jvmdi</origin>8053<capabilities>8054<required id="can_get_monitor_info"></required>8055</capabilities>8056<parameters>8057<param id="object">8058<jobject/>8059<description>8060The object to query.8061</description>8062</param>8063<param id="info_ptr">8064<outptr><struct>jvmtiMonitorUsage</struct></outptr>8065<description>8066On return, filled with monitor information for the8067specified object.8068</description>8069</param>8070</parameters>8071<errors>8072</errors>8073</function>80748075<elide>8076<function id="GetObjectMonitors" num="116">8077<synopsis>Get Object Monitors</synopsis>8078<description>8079Return the list of object monitors.8080<p/>8081Note: details about each monitor can be examined with8082<functionlink id="GetObjectMonitorUsage"></functionlink>.8083</description>8084<origin>new</origin>8085<capabilities>8086<required id="can_get_monitor_info"></required>8087</capabilities>8088<parameters>8089<param id="monitorCnt">8090<outptr><jint/></outptr>8091<description>8092On return, pointer to the number8093of monitors returned in <code>monitors_ptr</code>.8094</description>8095</param>8096<param id="monitors_ptr">8097<allocbuf outcount="monitorCnt"><jobject/></allocbuf>8098<description>8099On return, pointer to the monitor list.8100</description>8101</param>8102</parameters>8103<errors>8104</errors>8105</function>8106</elide>81078108</category>81098110<category id="fieldCategory" label="Field">81118112<intro>8113</intro>81148115<function id="GetFieldName" phase="start" num="60">8116<synopsis>Get Field Name (and Signature)</synopsis>8117<description>8118For the field indicated by <paramlink id="klass"/> and <paramlink id="field"/>,8119return the field name via <paramlink id="name_ptr"/> and field signature via8120<paramlink id="signature_ptr"/>.8121<p/>8122Field signatures are defined in the8123<externallink id="jni/index.html">JNI Specification</externallink>8124and are referred to as <code>field descriptors</code> in8125<vmspec chapter="4.3.2"/>.8126</description>8127<origin>jvmdiClone</origin>8128<capabilities>8129</capabilities>8130<parameters>8131<param id="klass">8132<jclass field="field"/>8133<description>8134The class of the field to query.8135</description>8136</param>8137<param id="field">8138<jfieldID class="klass"/>8139<description>8140The field to query.8141</description>8142</param>8143<param id="name_ptr">8144<allocbuf>8145<char/>8146<nullok>the name is not returned</nullok>8147</allocbuf>8148<description>8149On return, points to the field name, encoded as a8150<internallink id="mUTF">modified UTF-8</internallink> string.8151</description>8152</param>8153<param id="signature_ptr">8154<allocbuf>8155<char/>8156<nullok>the signature is not returned</nullok>8157</allocbuf>8158<description>8159On return, points to the field signature, encoded as a8160<internallink id="mUTF">modified UTF-8</internallink> string.8161</description>8162</param>8163<param id="generic_ptr">8164<allocbuf>8165<char/>8166<nullok>the generic signature is not returned</nullok>8167</allocbuf>8168<description>8169On return, points to the generic signature of the field, encoded as a8170<internallink id="mUTF">modified UTF-8</internallink> string.8171If there is no generic signature attribute for the field, then,8172on return, points to <code>NULL</code>.8173</description>8174</param>8175</parameters>8176<errors>8177</errors>8178</function>81798180<function id="GetFieldDeclaringClass" phase="start" num="61">8181<synopsis>Get Field Declaring Class</synopsis>8182<description>8183For the field indicated by <code>klass</code> and <code>field</code>8184return the class that defined it via <code>declaring_class_ptr</code>.8185The declaring class will either be <code>klass</code>, a superclass, or8186an implemented interface.8187</description>8188<origin>jvmdi</origin>8189<capabilities>8190</capabilities>8191<parameters>8192<param id="klass">8193<jclass field="field"/>8194<description>8195The class to query.8196</description>8197</param>8198<param id="field">8199<jfieldID class="klass"/>8200<description>8201The field to query.8202</description>8203</param>8204<param id="declaring_class_ptr">8205<outptr><jclass/></outptr>8206<description>8207On return, points to the declaring class8208</description>8209</param>8210</parameters>8211<errors>8212</errors>8213</function>82148215<function id="GetFieldModifiers" phase="start" num="62">8216<synopsis>Get Field Modifiers</synopsis>8217<description>8218For the field indicated by <code>klass</code> and <code>field</code>8219return the access flags via <code>modifiers_ptr</code>.8220Access flags are defined in <vmspec chapter="4"/>.8221</description>8222<origin>jvmdi</origin>8223<capabilities>8224</capabilities>8225<parameters>8226<param id="klass">8227<jclass field="field"/>8228<description>8229The class to query.8230</description>8231</param>8232<param id="field">8233<jfieldID class="klass"/>8234<description>8235The field to query.8236</description>8237</param>8238<param id="modifiers_ptr">8239<outptr><jint/></outptr>8240<description>8241On return, points to the access flags.8242</description>8243</param>8244</parameters>8245<errors>8246</errors>8247</function>82488249<function id="IsFieldSynthetic" phase="start" num="63">8250<synopsis>Is Field Synthetic</synopsis>8251<description>8252For the field indicated by <code>klass</code> and <code>field</code>, return a8253value indicating whether the field is synthetic via <code>is_synthetic_ptr</code>.8254Synthetic fields are generated by the compiler but not present in the8255original source code.8256</description>8257<origin>jvmdi</origin>8258<capabilities>8259<required id="can_get_synthetic_attribute"></required>8260</capabilities>8261<parameters>8262<param id="klass">8263<jclass field="field"/>8264<description>8265The class of the field to query.8266</description>8267</param>8268<param id="field">8269<jfieldID class="klass"/>8270<description>8271The field to query.8272</description>8273</param>8274<param id="is_synthetic_ptr">8275<outptr><jboolean/></outptr>8276<description>8277On return, points to the boolean result of this function.8278</description>8279</param>8280</parameters>8281<errors>8282</errors>8283</function>82848285</category>82868287<category id="method" label="Method">82888289<intro>8290These functions provide information about a method (represented as a8291<typelink id="jmethodID"/>) and set how methods are processed.8292</intro>82938294<intro id="obsoleteMethods" label="Obsolete Methods">8295The functions <functionlink id="RetransformClasses"/> and8296<functionlink id="RedefineClasses"/> can cause new versions8297of methods to be installed.8298An original version of a method is considered equivalent8299to the new version if:8300<ul>8301<li>their bytecodes are the same except for indices into the8302constant pool and </li>8303<li>the referenced constants are equal.</li>8304</ul>8305An original method version which is not equivalent to the8306new method version is called obsolete and is assigned a new method ID;8307the original method ID now refers to the new method version.8308A method ID can be tested for obsolescence with8309<functionlink id="IsMethodObsolete"/>.8310</intro>83118312<function id="GetMethodName" phase="start" num="64">8313<synopsis>Get Method Name (and Signature)</synopsis>8314<description>8315For the method indicated by <code>method</code>,8316return the method name via <code>name_ptr</code> and method signature via8317<code>signature_ptr</code>.8318<p/>8319Method signatures are defined in the8320<externallink id="jni/index.html">JNI Specification</externallink>8321and are referred to as <code>method descriptors</code> in8322<vmspec chapter="4.3.3"/>.8323Note this is different8324than method signatures as defined in the <i>Java Language Specification</i>.8325</description>8326<origin>jvmdiClone</origin>8327<capabilities>8328</capabilities>8329<parameters>8330<param id="method">8331<jmethodID/>8332<description>8333The method to query.8334</description>8335</param>8336<param id="name_ptr">8337<allocbuf>8338<char/>8339<nullok>the name is not returned</nullok>8340</allocbuf>8341<description>8342On return, points to the method name, encoded as a8343<internallink id="mUTF">modified UTF-8</internallink> string.8344</description>8345</param>8346<param id="signature_ptr">8347<allocbuf>8348<char/>8349<nullok>the signature is not returned</nullok>8350</allocbuf>8351<description>8352On return, points to the method signature, encoded as a8353<internallink id="mUTF">modified UTF-8</internallink> string.8354</description>8355</param>8356<param id="generic_ptr">8357<allocbuf>8358<char/>8359<nullok>the generic signature is not returned</nullok>8360</allocbuf>8361<description>8362On return, points to the generic signature of the method, encoded as a8363<internallink id="mUTF">modified UTF-8</internallink> string.8364If there is no generic signature attribute for the method, then,8365on return, points to <code>NULL</code>.8366</description>8367</param>8368</parameters>8369<errors>8370</errors>8371</function>83728373<function id="GetMethodDeclaringClass" phase="start" num="65">8374<synopsis>Get Method Declaring Class</synopsis>8375<description>8376For the method indicated by <code>method</code>,8377return the class that defined it via <code>declaring_class_ptr</code>.8378</description>8379<origin>jvmdi</origin>8380<capabilities>8381</capabilities>8382<parameters>8383<param id="klass">8384<jclass method="method"/>8385<description>8386The class to query.8387</description>8388</param>8389<param id="method">8390<jmethodID class="klass"/>8391<description>8392The method to query.8393</description>8394</param>8395<param id="declaring_class_ptr">8396<outptr><jclass/></outptr>8397<description>8398On return, points to the declaring class8399</description>8400</param>8401</parameters>8402<errors>8403</errors>8404</function>84058406<function id="GetMethodModifiers" phase="start" num="66">8407<synopsis>Get Method Modifiers</synopsis>8408<description>8409For the method indicated by <code>method</code>,8410return the access flags via <code>modifiers_ptr</code>.8411Access flags are defined in <vmspec chapter="4"/>.8412</description>8413<origin>jvmdi</origin>8414<capabilities>8415</capabilities>8416<parameters>8417<param id="klass">8418<jclass method="method"/>8419<description>8420The class to query.8421</description>8422</param>8423<param id="method">8424<jmethodID class="klass"/>8425<description>8426The method to query.8427</description>8428</param>8429<param id="modifiers_ptr">8430<outptr><jint/></outptr>8431<description>8432On return, points to the access flags.8433</description>8434</param>8435</parameters>8436<errors>8437</errors>8438</function>84398440<function id="GetMaxLocals" phase="start" num="68">8441<synopsis>Get Max Locals</synopsis>8442<description>8443For the method indicated by <code>method</code>,8444return the number of local variable slots used by the method,8445including the local variables used to pass parameters to the8446method on its invocation.8447<p/>8448See <code>max_locals</code> in <vmspec chapter="4.7.3"/>.8449</description>8450<origin>jvmdi</origin>8451<capabilities>8452</capabilities>8453<parameters>8454<param id="klass">8455<jclass method="method"/>8456<description>8457The class to query.8458</description>8459</param>8460<param id="method">8461<jmethodID class="klass" native="error"/>8462<description>8463The method to query.8464</description>8465</param>8466<param id="max_ptr">8467<outptr><jint/></outptr>8468<description>8469On return, points to the maximum number of local slots8470</description>8471</param>8472</parameters>8473<errors>8474</errors>8475</function>84768477<function id="GetArgumentsSize" phase="start" num="69">8478<synopsis>Get Arguments Size</synopsis>8479<description>8480For the method indicated by <code>method</code>,8481return via <code>max_ptr</code> the number of local variable slots used8482by the method's arguments.8483Note that two-word arguments use two slots.8484</description>8485<origin>jvmdi</origin>8486<capabilities>8487</capabilities>8488<parameters>8489<param id="klass">8490<jclass method="method"/>8491<description>8492The class to query.8493</description>8494</param>8495<param id="method">8496<jmethodID class="klass" native="error"/>8497<description>8498The method to query.8499</description>8500</param>8501<param id="size_ptr">8502<outptr><jint/></outptr>8503<description>8504On return, points to the number of argument slots8505</description>8506</param>8507</parameters>8508<errors>8509</errors>8510</function>85118512<function id="GetLineNumberTable" phase="start" num="70">8513<synopsis>Get Line Number Table</synopsis>8514<typedef id="jvmtiLineNumberEntry" label="Line number table entry">8515<field id="start_location">8516<jlocation/>8517<description>8518the <datalink id="jlocation"></datalink> where the line begins8519</description>8520</field>8521<field id="line_number">8522<jint/>8523<description>8524the line number8525</description>8526</field>8527</typedef>8528<description>8529For the method indicated by <code>method</code>,8530return a table of source line number entries. The size of the table is8531returned via <code>entry_count_ptr</code> and the table itself is8532returned via <code>table_ptr</code>.8533</description>8534<origin>jvmdi</origin>8535<capabilities>8536<required id="can_get_line_numbers"></required>8537</capabilities>8538<parameters>8539<param id="klass">8540<jclass method="method"/>8541<description>8542The class to query.8543</description>8544</param>8545<param id="method">8546<jmethodID class="klass" native="error"/>8547<description>8548The method to query.8549</description>8550</param>8551<param id="entry_count_ptr">8552<outptr><jint/></outptr>8553<description>8554On return, points to the number of entries in the table8555</description>8556</param>8557<param id="table_ptr">8558<allocbuf outcount="entry_count_ptr"><struct>jvmtiLineNumberEntry</struct></allocbuf>8559<description>8560On return, points to the line number table pointer.8561</description>8562</param>8563</parameters>8564<errors>8565<error id="JVMTI_ERROR_ABSENT_INFORMATION">8566Class information does not include line numbers.8567</error>8568</errors>8569</function>85708571<function id="GetMethodLocation" phase="start" num="71">8572<synopsis>Get Method Location</synopsis>8573<description>8574For the method indicated by <code>method</code>,8575return the beginning and ending addresses through8576<code>start_location_ptr</code> and <code>end_location_ptr</code>. In a8577conventional bytecode indexing scheme,8578<code>start_location_ptr</code> will always point to zero8579and <code>end_location_ptr</code>8580will always point to the bytecode count minus one.8581</description>8582<origin>jvmdi</origin>8583<capabilities>8584</capabilities>8585<parameters>8586<param id="klass">8587<jclass method="method"/>8588<description>8589The class to query.8590</description>8591</param>8592<param id="method">8593<jmethodID class="klass" native="error"/>8594<description>8595The method to query.8596</description>8597</param>8598<param id="start_location_ptr">8599<outptr><jlocation/></outptr>8600<description>8601On return, points to the first location, or8602<code>-1</code> if location information is not available.8603If the information is available and8604<functionlink id="GetJLocationFormat"></functionlink>8605returns <datalink id="JVMTI_JLOCATION_JVMBCI"></datalink>8606then this will always be zero.8607</description>8608</param>8609<param id="end_location_ptr">8610<outptr><jlocation/></outptr>8611<description>8612On return, points to the last location,8613or <code>-1</code> if location information is not available.8614</description>8615</param>8616</parameters>8617<errors>8618<error id="JVMTI_ERROR_ABSENT_INFORMATION">8619Class information does not include method sizes.8620</error>8621</errors>8622</function>86238624<function id="GetLocalVariableTable" num="72">8625<synopsis>Get Local Variable Table</synopsis>8626<typedef id="jvmtiLocalVariableEntry" label="Local variable table entry">8627<field id="start_location">8628<jlocation/>8629<description>8630The code array index where the local variable is first valid8631(that is, where it must have a value).8632</description>8633</field>8634<field id="length">8635<jint/>8636<description>8637The length of the valid section for this local variable.8638The last code array index where the local variable is valid8639is <code>start_location + length</code>.8640</description>8641</field>8642<field id="name">8643<allocfieldbuf><char/></allocfieldbuf>8644<description>8645The local variable name, encoded as a8646<internallink id="mUTF">modified UTF-8</internallink> string.8647</description>8648</field>8649<field id="signature">8650<allocfieldbuf><char/></allocfieldbuf>8651<description>8652The local variable's type signature, encoded as a8653<internallink id="mUTF">modified UTF-8</internallink> string.8654The signature format is the same as that defined in8655<vmspec chapter="4.3.2"/>.8656</description>8657</field>8658<field id="generic_signature">8659<allocfieldbuf><char/></allocfieldbuf>8660<description>8661The local variable's generic signature, encoded as a8662<internallink id="mUTF">modified UTF-8</internallink> string.8663The value of this field will be <code>NULL</code> for any local8664variable which does not have a generic type.8665</description>8666</field>8667<field id="slot">8668<jint/>8669<description>8670The local variable's slot. See <internallink id="local">Local Variables</internallink>.8671</description>8672</field>8673</typedef>8674<description>8675Return local variable information.8676</description>8677<origin>jvmdiClone</origin>8678<capabilities>8679<required id="can_access_local_variables"></required>8680</capabilities>8681<parameters>8682<param id="method">8683<jmethodID native="error"/>8684<description>8685The method to query.8686</description>8687</param>8688<param id="entry_count_ptr">8689<outptr><jint/></outptr>8690<description>8691On return, points to the number of entries in the table8692</description>8693</param>8694<param id="table_ptr">8695<allocbuf outcount="entry_count_ptr"><struct>jvmtiLocalVariableEntry</struct></allocbuf>8696<description>8697On return, points to an array of local variable table entries.8698</description>8699</param>8700</parameters>8701<errors>8702<error id="JVMTI_ERROR_ABSENT_INFORMATION">8703Class information does not include local variable8704information.8705</error>8706</errors>8707</function>87088709<function id="GetBytecodes" phase="start" num="75">8710<synopsis>Get Bytecodes</synopsis>8711<description>8712For the method indicated by <code>method</code>,8713return the bytecodes that implement the method. The number of8714bytecodes is returned via <code>bytecode_count_ptr</code>. The bytecodes8715themselves are returned via <code>bytecodes_ptr</code>.8716</description>8717<origin>jvmdi</origin>8718<capabilities>8719<required id="can_get_bytecodes"></required>8720</capabilities>8721<parameters>8722<param id="klass">8723<jclass method="method"/>8724<description>8725The class to query.8726</description>8727</param>8728<param id="method">8729<jmethodID class="klass" native="error"/>8730<description>8731The method to query.8732</description>8733</param>8734<param id="bytecode_count_ptr">8735<outptr><jint/></outptr>8736<description>8737On return, points to the length of the bytecode array8738</description>8739</param>8740<param id="bytecodes_ptr">8741<allocbuf outcount="bytecode_count_ptr"><uchar/></allocbuf>8742<description>8743On return, points to the pointer to the bytecode array8744</description>8745</param>8746</parameters>8747<errors>8748</errors>8749</function>87508751<function id="IsMethodNative" phase="start" num="76">8752<synopsis>Is Method Native</synopsis>8753<description>8754For the method indicated by <code>method</code>, return a8755value indicating whether the method is native via <code>is_native_ptr</code>8756</description>8757<origin>jvmdi</origin>8758<capabilities>8759</capabilities>8760<parameters>8761<param id="klass">8762<jclass method="method"/>8763<description>8764The class to query.8765</description>8766</param>8767<param id="method">8768<jmethodID class="klass"/>8769<description>8770The method to query.8771</description>8772</param>8773<param id="is_native_ptr">8774<outptr><jboolean/></outptr>8775<description>8776On return, points to the boolean result of this function.8777</description>8778</param>8779</parameters>8780<errors>8781</errors>8782</function>87838784<function id="IsMethodSynthetic" phase="start" num="77">8785<synopsis>Is Method Synthetic</synopsis>8786<description>8787For the method indicated by <code>method</code>, return a8788value indicating whether the method is synthetic via <code>is_synthetic_ptr</code>.8789Synthetic methods are generated by the compiler but not present in the8790original source code.8791</description>8792<origin>jvmdi</origin>8793<capabilities>8794<required id="can_get_synthetic_attribute"></required>8795</capabilities>8796<parameters>8797<param id="klass">8798<jclass method="method"/>8799<description>8800The class to query.8801</description>8802</param>8803<param id="method">8804<jmethodID class="klass"/>8805<description>8806The method to query.8807</description>8808</param>8809<param id="is_synthetic_ptr">8810<outptr><jboolean/></outptr>8811<description>8812On return, points to the boolean result of this function.8813</description>8814</param>8815</parameters>8816<errors>8817</errors>8818</function>88198820<function id="IsMethodObsolete" phase="start" num="91">8821<synopsis>Is Method Obsolete</synopsis>8822<description>8823Determine if a method ID refers to an8824<internallink id="obsoleteMethods">obsolete</internallink>8825method version.8826</description>8827<origin>jvmdi</origin>8828<capabilities>8829</capabilities>8830<parameters>8831<param id="klass">8832<jclass method="method"/>8833<description>8834The class to query.8835</description>8836</param>8837<param id="method">8838<jmethodID class="klass"/>8839<description>8840The method ID to query.8841</description>8842</param>8843<param id="is_obsolete_ptr">8844<outptr><jboolean/></outptr>8845<description>8846On return, points to the boolean result of this function.8847</description>8848</param>8849</parameters>8850<errors>8851</errors>8852</function>88538854<function id="SetNativeMethodPrefix" jkernel="yes" phase="any" num="73" since="1.1">8855<synopsis>Set Native Method Prefix</synopsis>8856<description>8857This function modifies the failure handling of8858native method resolution by allowing retry8859with a prefix applied to the name.8860When used with the8861<eventlink id="ClassFileLoadHook">ClassFileLoadHook8862event</eventlink>, it enables native methods to be8863<internallink id="bci">instrumented</internallink>.8864<p/>8865Since native methods cannot be directly instrumented8866(they have no bytecodes), they must be wrapped with8867a non-native method which can be instrumented.8868For example, if we had:8869<example>8870native boolean foo(int x);</example>8871<p/>8872We could transform the class file (with the8873ClassFileLoadHook event) so that this becomes:8874<example>8875boolean foo(int x) {8876<i>... record entry to foo ...</i>8877return wrapped_foo(x);8878}88798880native boolean wrapped_foo(int x);</example>8881<p/>8882Where foo becomes a wrapper for the actual native method8883with the appended prefix "wrapped_". Note that8884"wrapped_" would be a poor choice of prefix since it8885might conceivably form the name of an existing method8886thus something like "$$$MyAgentWrapped$$$_" would be8887better but would make these examples less readable.8888<p/>8889The wrapper will allow data to be collected on the native8890method call, but now the problem becomes linking up the8891wrapped method with the native implementation.8892That is, the method <code>wrapped_foo</code> needs to be8893resolved to the native implementation of <code>foo</code>,8894which might be:8895<example>8896Java_somePackage_someClass_foo(JNIEnv* env, jint x)</example>8897<p/>8898This function allows the prefix to be specified and the8899proper resolution to occur.8900Specifically, when the standard resolution fails, the8901resolution is retried taking the prefix into consideration.8902There are two ways that resolution occurs, explicit8903resolution with the JNI function <code>RegisterNatives</code>8904and the normal automatic resolution. For8905<code>RegisterNatives</code>, the VM will attempt this8906association:8907<example>8908method(foo) -> nativeImplementation(foo)</example>8909<p/>8910When this fails, the resolution will be retried with8911the specified prefix prepended to the method name,8912yielding the correct resolution:8913<example>8914method(wrapped_foo) -> nativeImplementation(foo)</example>8915<p/>8916For automatic resolution, the VM will attempt:8917<example>8918method(wrapped_foo) -> nativeImplementation(wrapped_foo)</example>8919<p/>8920When this fails, the resolution will be retried with8921the specified prefix deleted from the implementation name,8922yielding the correct resolution:8923<example>8924method(wrapped_foo) -> nativeImplementation(foo)</example>8925<p/>8926Note that since the prefix is only used when standard8927resolution fails, native methods can be wrapped selectively.8928<p/>8929Since each <jvmti/> environment is independent and8930can do its own transformation of the bytecodes, more8931than one layer of wrappers may be applied. Thus each8932environment needs its own prefix. Since transformations8933are applied in order, the prefixes, if applied, will8934be applied in the same order.8935The order of transformation application is described in8936the <eventlink id="ClassFileLoadHook"/> event.8937Thus if three environments applied8938wrappers, <code>foo</code> might become8939<code>$env3_$env2_$env1_foo</code>. But if, say,8940the second environment did not apply a wrapper to8941<code>foo</code> it would be just8942<code>$env3_$env1_foo</code>. To be able to8943efficiently determine the sequence of prefixes,8944an intermediate prefix is only applied if its non-native8945wrapper exists. Thus, in the last example, even though8946<code>$env1_foo</code> is not a native method, the8947<code>$env1_</code> prefix is applied since8948<code>$env1_foo</code> exists.8949<p/>8950Since the prefixes are used at resolution time8951and since resolution may be arbitrarily delayed, a8952native method prefix must remain set as long as there8953are corresponding prefixed native methods.8954</description>8955<origin>new</origin>8956<capabilities>8957<required id="can_set_native_method_prefix"></required>8958</capabilities>8959<parameters>8960<param id="prefix">8961<inbuf>8962<char/>8963<nullok>8964any existing prefix in this environment is cancelled8965</nullok>8966</inbuf>8967<description>8968The prefix to apply, encoded as a8969<internallink id="mUTF">modified UTF-8</internallink> string.8970</description>8971</param>8972</parameters>8973<errors>8974</errors>8975</function>89768977<function id="SetNativeMethodPrefixes" jkernel="yes" phase="any" num="74" since="1.1">8978<synopsis>Set Native Method Prefixes</synopsis>8979<description>8980For a normal agent, <functionlink id="SetNativeMethodPrefix"/>8981will provide all needed native method prefixing.8982For a meta-agent that performs multiple independent class8983file transformations (for example as a proxy for another8984layer of agents) this function allows each transformation8985to have its own prefix.8986The prefixes are applied in the order supplied and are8987processed in the same manner as described for the8988application of prefixes from multiple <jvmti/> environments8989in <functionlink id="SetNativeMethodPrefix"/>.8990<p/>8991Any previous prefixes are replaced. Thus, calling this8992function with a <paramlink id="prefix_count"/> of <code>0</code>8993disables prefixing in this environment.8994<p/>8995<functionlink id="SetNativeMethodPrefix"/> and this function8996are the two ways to set the prefixes.8997Calling <code>SetNativeMethodPrefix</code> with8998a prefix is the same as calling this function with8999<paramlink id="prefix_count"/> of <code>1</code>.9000Calling <code>SetNativeMethodPrefix</code> with9001<code>NULL</code> is the same as calling this function with9002<paramlink id="prefix_count"/> of <code>0</code>.9003</description>9004<origin>new</origin>9005<capabilities>9006<required id="can_set_native_method_prefix"></required>9007</capabilities>9008<parameters>9009<param id="prefix_count">9010<jint min="0"/>9011<description>9012The number of prefixes to apply.9013</description>9014</param>9015<param id="prefixes">9016<agentbuf>9017<char/>9018</agentbuf>9019<description>9020The prefixes to apply for this environment, each encoded as a9021<internallink id="mUTF">modified UTF-8</internallink> string.9022</description>9023</param>9024</parameters>9025<errors>9026</errors>9027</function>90289029</category>90309031<category id="RawMonitors" label="Raw Monitor">90329033<function id="CreateRawMonitor" phase="onload" callbacksafe="safe" num="31">9034<synopsis>Create Raw Monitor</synopsis>9035<description>9036Create a raw monitor.9037</description>9038<origin>jvmdi</origin>9039<capabilities>9040</capabilities>9041<parameters>9042<param id="name">9043<inbuf><char/></inbuf>9044<description>9045A name to identify the monitor, encoded as a9046<internallink id="mUTF">modified UTF-8</internallink> string.9047</description>9048</param>9049<param id="monitor_ptr">9050<outptr><jrawMonitorID/></outptr>9051<description>9052On return, points to the created monitor.9053</description>9054</param>9055</parameters>9056<errors>9057</errors>9058</function>90599060<function id="DestroyRawMonitor" phase="onload" callbacksafe="safe" num="32">9061<synopsis>Destroy Raw Monitor</synopsis>9062<description>9063Destroy the raw monitor.9064If the monitor being destroyed has been entered by this thread, it will be9065exited before it is destroyed.9066If the monitor being destroyed has been entered by another thread,9067an error will be returned and the monitor will not be destroyed.9068</description>9069<origin>jvmdi</origin>9070<capabilities>9071</capabilities>9072<parameters>9073<param id="monitor">9074<jrawMonitorID/>9075<description>9076The monitor9077</description>9078</param>9079</parameters>9080<errors>9081<error id="JVMTI_ERROR_NOT_MONITOR_OWNER">9082Not monitor owner9083</error>9084</errors>9085</function>90869087<function id="RawMonitorEnter" phase="any" callbacksafe="safe" impl="innative notrace" num="33">9088<synopsis>Raw Monitor Enter</synopsis>9089<description>9090Gain exclusive ownership of a raw monitor.9091The same thread may enter a monitor more then once.9092The thread must9093<functionlink id="RawMonitorExit">exit</functionlink>9094the monitor the same number of times as it is entered.9095If a monitor is entered during <code>OnLoad</code> (before attached threads exist)9096and has not exited when attached threads come into existence, the enter9097is considered to have occurred on the main thread.9098</description>9099<origin>jvmdi</origin>9100<capabilities>9101</capabilities>9102<parameters>9103<param id="monitor">9104<jrawMonitorID/>9105<description>9106The monitor9107</description>9108</param>9109</parameters>9110<errors>9111</errors>9112</function>91139114<function id="RawMonitorExit" phase="any" callbacksafe="safe" impl="innative notrace" num="34">9115<synopsis>Raw Monitor Exit</synopsis>9116<description>9117Release exclusive ownership of a raw monitor.9118</description>9119<origin>jvmdi</origin>9120<capabilities>9121</capabilities>9122<parameters>9123<param id="monitor">9124<jrawMonitorID/>9125<description>9126The monitor9127</description>9128</param>9129</parameters>9130<errors>9131<error id="JVMTI_ERROR_NOT_MONITOR_OWNER">9132Not monitor owner9133</error>9134</errors>9135</function>91369137<function id="RawMonitorWait" phase="any" callbacksafe="safe" impl="innative notrace" num="35">9138<synopsis>Raw Monitor Wait</synopsis>9139<description>9140Wait for notification of the raw monitor.9141<p/>9142Causes the current thread to wait until either another thread calls9143<functionlink id="RawMonitorNotify"/> or9144<functionlink id="RawMonitorNotifyAll"/>9145for the specified raw monitor, or the specified9146<paramlink id="millis">timeout</paramlink>9147has elapsed.9148</description>9149<origin>jvmdi</origin>9150<capabilities>9151</capabilities>9152<parameters>9153<param id="monitor">9154<jrawMonitorID/>9155<description>9156The monitor9157</description>9158</param>9159<param id="millis">9160<jlong/>9161<description>9162The timeout, in milliseconds. If the timeout is9163zero, then real time is not taken into consideration9164and the thread simply waits until notified.9165</description>9166</param>9167</parameters>9168<errors>9169<error id="JVMTI_ERROR_NOT_MONITOR_OWNER">9170Not monitor owner9171</error>9172<error id="JVMTI_ERROR_INTERRUPT">9173Wait was interrupted, try again9174</error>9175</errors>9176</function>91779178<function id="RawMonitorNotify" phase="any" callbacksafe="safe" impl="notrace" num="36">9179<synopsis>Raw Monitor Notify</synopsis>9180<description>9181Notify a single thread waiting on the raw monitor.9182</description>9183<origin>jvmdi</origin>9184<capabilities>9185</capabilities>9186<parameters>9187<param id="monitor">9188<jrawMonitorID/>9189<description>9190The monitor9191</description>9192</param>9193</parameters>9194<errors>9195<error id="JVMTI_ERROR_NOT_MONITOR_OWNER">9196Not monitor owner9197</error>9198</errors>9199</function>92009201<function id="RawMonitorNotifyAll" phase="any" callbacksafe="safe" impl="notrace" num="37">9202<synopsis>Raw Monitor Notify All</synopsis>9203<description>9204Notify all threads waiting on the raw monitor.9205</description>9206<origin>jvmdi</origin>9207<capabilities>9208</capabilities>9209<parameters>9210<param id="monitor">9211<jrawMonitorID/>9212<description>9213The monitor9214</description>9215</param>9216</parameters>9217<errors>9218<error id="JVMTI_ERROR_NOT_MONITOR_OWNER">9219Not monitor owner9220</error>9221</errors>9222</function>92239224<elide>9225<function id="GetRawMonitorUse" num="118">9226<synopsis>Get Raw Monitor Use</synopsis>9227<description>9228The fields of the <functionlink id="jvmtiMonitorUsage"></functionlink> structure9229are filled in with information about usage of the raw monitor.9230</description>9231<origin>new</origin>9232<capabilities>9233<required id="can_get_raw_monitor_usage"></required>9234</capabilities>9235<parameters>9236<param id="monitor">9237<jrawMonitorID/>9238<description>9239the raw monitor to query.9240</description>9241</param>9242<param id="info_ptr">9243<outptr><struct>jvmtiMonitorUsage</struct></outptr>9244<description>9245On return, filled with monitor information for the9246specified raw monitor.9247</description>9248</param>9249</parameters>9250<errors>9251</errors>9252</function>92539254<function id="GetRawMonitors" num="119">9255<synopsis>Get Raw Monitors</synopsis>9256<description>9257Return the list of raw monitors.9258<p/>9259Note: details about each monitor can be examined with9260<functionlink id="GetRawMonitorUse"></functionlink>.9261</description>9262<origin>new</origin>9263<capabilities>9264<required id="can_get_raw_monitor_usage"></required>9265</capabilities>9266<parameters>9267<param id="monitorCnt">9268<outptr><jint/></outptr>9269<description>9270On return, pointer to the number9271of monitors returned in <code>monitors_ptr</code>.9272</description>9273</param>9274<param id="monitors_ptr">9275<allocbuf outcount="monitorCnt"><jrawMonitorID/></allocbuf>9276<description>9277On return, pointer to the monitor list.9278</description>9279</param>9280</parameters>9281<errors>9282</errors>9283</function>9284</elide>9285</category>92869287<category id="jniIntercept" label="JNI Function Interception">92889289<intro>9290Provides the ability to intercept and resend9291Java Native Interface (JNI) function calls9292by manipulating the JNI function table.9293See <externallink id="jni/functions.html">JNI9294Functions</externallink> in the <i>Java Native Interface Specification</i>.9295<p/>9296The following example illustrates intercepting the9297<code>NewGlobalRef</code> JNI call in order to count reference9298creation.9299<example>9300JNIEnv original_jni_Functions;9301JNIEnv redirected_jni_Functions;9302int my_global_ref_count = 0;93039304jobject9305MyNewGlobalRef(JNIEnv *jni_env, jobject lobj) {9306++my_global_ref_count;9307return originalJNIFunctions->NewGlobalRef(env, lobj);9308}93099310void9311myInit() {9312jvmtiError err;93139314err = (*jvmti_env)->GetJNIFunctionTable(jvmti_env, &original_jni_Functions);9315if (err != JVMTI_ERROR_NONE) {9316die();9317}9318err = (*jvmti_env)->GetJNIFunctionTable(jvmti_env, &redirected_jni_Functions);9319if (err != JVMTI_ERROR_NONE) {9320die();9321}9322redirectedJNIFunctions->NewGlobalRef = MyNewGlobalRef;9323err = (*jvmti_env)->SetJNIFunctionTable(jvmti_env, redirected_jni_Functions);9324if (err != JVMTI_ERROR_NONE) {9325die();9326}9327}9328</example>9329Sometime after <code>myInit</code> is called the user's JNI9330code is executed which makes the call to create a new global9331reference. Instead of going to the normal JNI implementation9332the call goes to <code>myNewGlobalRef</code>. Note that a9333copy of the original function table is kept so that the normal9334JNI function can be called after the data is collected.9335Note also that any JNI functions which are not overwritten9336will behave normally.9337<todo>9338check that the example compiles and executes.9339</todo>9340</intro>93419342<function id="SetJNIFunctionTable" phase="start" num="120">9343<synopsis>Set JNI Function Table</synopsis>9344<description>9345Set the JNI function table9346in all current and future JNI environments.9347As a result, all future JNI calls are directed to the specified functions.9348Use <functionlink id="GetJNIFunctionTable"></functionlink> to get the9349function table to pass to this function.9350For this function to take effect the the updated table entries must be9351used by the JNI clients.9352Since the table is defined <code>const</code> some compilers may optimize9353away the access to the table, thus preventing this function from taking9354effect.9355The table is copied--changes to the local copy of the9356table have no effect.9357This function affects only the function table, all other aspects of the environment are9358unaffected.9359See the examples <internallink id="jniIntercept">above</internallink>.9360</description>9361<origin>new</origin>9362<capabilities>9363</capabilities>9364<parameters>9365<param id="function_table">9366<inptr>9367<struct>jniNativeInterface</struct>9368</inptr>9369<description>9370Points to the new JNI function table.9371</description>9372</param>9373</parameters>9374<errors>9375</errors>9376</function>93779378<function id="GetJNIFunctionTable" phase="start" num="121">9379<synopsis>Get JNI Function Table</synopsis>9380<description>9381Get the JNI function table.9382The JNI function table is copied into allocated memory.9383If <functionlink id="SetJNIFunctionTable"></functionlink>9384has been called, the modified (not the original) function9385table is returned.9386Only the function table is copied, no other aspects of the environment9387are copied.9388See the examples <internallink id="jniIntercept">above</internallink>.9389</description>9390<origin>new</origin>9391<capabilities>9392</capabilities>9393<parameters>9394<param id="function_table">9395<allocbuf>9396<struct>jniNativeInterface</struct>9397</allocbuf>9398<description>9399On return, <code>*function_table</code>9400points a newly allocated copy of the JNI function table.9401</description>9402</param>9403</parameters>9404<errors>9405</errors>9406</function>94079408</category>94099410<category id="eventManagement" label="Event Management">94119412<function id="SetEventCallbacks" jkernel="yes" phase="onload" num="122">9413<synopsis>Set Event Callbacks</synopsis>9414<description>9415Set the functions to be called for each event.9416The callbacks are specified by supplying a replacement function table.9417The function table is copied--changes to the local copy of the9418table have no effect.9419This is an atomic action, all callbacks are set at once.9420No events are sent before this function is called.9421When an entry is <code>NULL</code> or when the event is beyond9422<paramlink id="size_of_callbacks"></paramlink> no event is sent.9423Details on events are9424described <internallink id="EventSection">later</internallink> in this document.9425An event must be enabled and have a callback in order to be9426sent--the order in which this function and9427<functionlink id="SetEventNotificationMode"></functionlink>9428are called does not affect the result.9429</description>9430<origin>new</origin>9431<capabilities>9432</capabilities>9433<parameters>9434<param id="callbacks">9435<inptr>9436<struct>jvmtiEventCallbacks</struct>9437<nullok>remove the existing callbacks</nullok>9438</inptr>9439<description>9440The new event callbacks.9441</description>9442</param>9443<param id="size_of_callbacks">9444<jint min="0"/>9445<description>9446<code>sizeof(jvmtiEventCallbacks)</code>--for version9447compatibility.9448</description>9449</param>9450</parameters>9451<errors>9452</errors>9453</function>94549455<function id="SetEventNotificationMode" jkernel="yes" phase="onload" num="2">9456<synopsis>Set Event Notification Mode</synopsis>9457<description>9458Control the generation of events.9459<constants id="jvmtiEventMode" label="Event Enable/Disable" kind="enum">9460<constant id="JVMTI_ENABLE" num="1">9461If <paramlink id="mode"></paramlink> is <code>JVMTI_ENABLE</code>,9462the event <paramlink id="event_type"></paramlink> will be enabled9463</constant>9464<constant id="JVMTI_DISABLE" num="0">9465If <paramlink id="mode"></paramlink> is <code>JVMTI_DISABLE</code>,9466the event <paramlink id="event_type"></paramlink> will be disabled9467</constant>9468</constants>9469If <code>event_thread</code> is <code>NULL</code>,9470the event is enabled or disabled globally; otherwise, it is9471enabled or disabled for a particular thread.9472An event is generated for9473a particular thread if it is enabled either at the thread or global9474levels.9475<p/>9476See <internallink id="EventIndex">below</internallink> for information on specific events.9477<p/>9478The following events cannot be controlled at the thread9479level through this function.9480<ul>9481<li><eventlink id="VMInit"></eventlink></li>9482<li><eventlink id="VMStart"></eventlink></li>9483<li><eventlink id="VMDeath"></eventlink></li>9484<li><eventlink id="ThreadStart"></eventlink></li>9485<li><eventlink id="CompiledMethodLoad"></eventlink></li>9486<li><eventlink id="CompiledMethodUnload"></eventlink></li>9487<li><eventlink id="DynamicCodeGenerated"></eventlink></li>9488<li><eventlink id="DataDumpRequest"></eventlink></li>9489</ul>9490<p/>9491Initially, no events are enabled at either the thread level9492or the global level.9493<p/>9494Any needed capabilities (see Event Enabling Capabilities below) must be possessed9495before calling this function.9496<p/>9497Details on events are9498described <internallink id="EventSection">below</internallink>.9499</description>9500<origin>jvmdiClone</origin>9501<eventcapabilities></eventcapabilities>9502<parameters>9503<param id="mode">9504<enum>jvmtiEventMode</enum>9505<description>9506<code>JVMTI_ENABLE</code> or <code>JVMTI_DISABLE</code>9507</description>9508</param>9509<param id="event_type">9510<enum>jvmtiEvent</enum>9511<description>9512the event to control9513</description>9514</param>9515<param id="event_thread">9516<ptrtype>9517<jthread impl="noconvert"/>9518<nullok>event is controlled at the global level</nullok>9519</ptrtype>9520<description>9521The thread to control9522</description>9523</param>9524<param id="...">9525<varargs/>9526<description>9527for future expansion9528</description>9529</param>9530</parameters>9531<errors>9532<error id="JVMTI_ERROR_INVALID_THREAD">9533<paramlink id="event_thread"/> is non-<code>NULL</code> and is not a valid thread.9534</error>9535<error id="JVMTI_ERROR_THREAD_NOT_ALIVE">9536<paramlink id="event_thread"/> is non-<code>NULL</code> and is not live (has not been started or is now dead).9537</error>9538<error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">9539thread level control was attempted on events which do not9540permit thread level control.9541</error>9542<error id="JVMTI_ERROR_MUST_POSSESS_CAPABILITY">9543The Required Event Enabling Capability is not possessed.9544</error>9545</errors>9546</function>95479548<function id="GenerateEvents" num="123">9549<synopsis>Generate Events</synopsis>9550<description>9551Generate events to represent the current state of the VM.9552For example, if <paramlink id="event_type"/> is9553<code>JVMTI_EVENT_COMPILED_METHOD_LOAD</code>,9554a <eventlink id="CompiledMethodLoad"></eventlink> event will be9555sent for each currently compiled method.9556Methods that were loaded and now have been unloaded are not sent.9557The history of what events have previously been sent does not9558effect what events are sent by this function--for example,9559all currently compiled methods9560will be sent each time this function is called.9561<p/>9562This function is useful when9563events may have been missed due to the agent attaching after program9564execution begins; this function generates the missed events.9565<p/>9566Attempts to execute Java programming language code or9567JNI functions may be paused until this function returns -9568so neither should be called from the thread sending the event.9569This function returns only after the missed events have been9570sent, processed and have returned.9571The event may be sent on a different thread than the thread9572on which the event occurred.9573The callback for the event must be set with9574<functionlink id="SetEventCallbacks"></functionlink>9575and the event must be enabled with9576<functionlink id="SetEventNotificationMode"></functionlink>9577or the events will not occur.9578If the VM no longer has the information to generate some or9579all of the requested events, the events are simply not sent -9580no error is returned.9581<p/>9582Only the following events are supported:9583<ul>9584<li><eventlink id="CompiledMethodLoad"></eventlink></li>9585<li><eventlink id="DynamicCodeGenerated"></eventlink></li>9586</ul>9587</description>9588<origin>new</origin>9589<capabilities>9590<capability id="can_generate_compiled_method_load_events"></capability>9591</capabilities>9592<parameters>9593<param id="event_type">9594<enum>jvmtiEvent</enum>9595<description>9596The type of event to generate. Must be one of these:9597<ul>9598<li><eventlink id="CompiledMethodLoad"><code>JVMTI_EVENT_COMPILED_METHOD_LOAD</code></eventlink></li>9599<li><eventlink id="DynamicCodeGenerated"><code>JVMTI_EVENT_DYNAMIC_CODE_GENERATED</code></eventlink></li>9600</ul>9601</description>9602</param>9603</parameters>9604<errors>9605<error id="JVMTI_ERROR_MUST_POSSESS_CAPABILITY">9606<paramlink id="event_type"/> is9607<eventlink id="CompiledMethodLoad"><code>JVMTI_EVENT_COMPILED_METHOD_LOAD</code></eventlink>9608and <fieldlink id="can_generate_compiled_method_load_events" struct="jvmtiCapabilities"></fieldlink>9609is <code>false</code>.9610</error>9611<error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">9612<paramlink id="event_type"/> is other than9613<eventlink id="CompiledMethodLoad"><code>JVMTI_EVENT_COMPILED_METHOD_LOAD</code></eventlink>9614or <eventlink id="DynamicCodeGenerated"><code>JVMTI_EVENT_DYNAMIC_CODE_GENERATED</code></eventlink>.9615</error>9616</errors>9617</function>96189619</category>96209621<category id="extension" label="Extension Mechanism">96229623<intro>9624These functions9625allow a <jvmti/> implementation to provide functions and events9626beyond those defined in this specification.9627<p/>9628Both extension functions and extension events have parameters9629each of which has a 'type' and 'kind' chosen from the following tables:96309631<constants id="jvmtiParamTypes" label="Extension Function/Event Parameter Types" kind="enum">9632<constant id="JVMTI_TYPE_JBYTE" num="101">9633Java programming language primitive type - <code>byte</code>.9634JNI type <code>jbyte</code>.9635</constant>9636<constant id="JVMTI_TYPE_JCHAR" num="102">9637Java programming language primitive type - <code>char</code>.9638JNI type <code>jchar</code>.9639</constant>9640<constant id="JVMTI_TYPE_JSHORT" num="103">9641Java programming language primitive type - <code>short</code>.9642JNI type <code>jshort</code>.9643</constant>9644<constant id="JVMTI_TYPE_JINT" num="104">9645Java programming language primitive type - <code>int</code>.9646JNI type <datalink id="jint"></datalink>.9647</constant>9648<constant id="JVMTI_TYPE_JLONG" num="105">9649Java programming language primitive type - <code>long</code>.9650JNI type <datalink id="jlong"></datalink>.9651</constant>9652<constant id="JVMTI_TYPE_JFLOAT" num="106">9653Java programming language primitive type - <code>float</code>.9654JNI type <datalink id="jfloat"></datalink>.9655</constant>9656<constant id="JVMTI_TYPE_JDOUBLE" num="107">9657Java programming language primitive type - <code>double</code>.9658JNI type <datalink id="jdouble"></datalink>.9659</constant>9660<constant id="JVMTI_TYPE_JBOOLEAN" num="108">9661Java programming language primitive type - <code>boolean</code>.9662JNI type <datalink id="jboolean"></datalink>.9663</constant>9664<constant id="JVMTI_TYPE_JOBJECT" num="109">9665Java programming language object type - <code>java.lang.Object</code>.9666JNI type <datalink id="jobject"></datalink>.9667Returned values are JNI local references and must be managed.9668</constant>9669<constant id="JVMTI_TYPE_JTHREAD" num="110">9670Java programming language object type - <code>java.lang.Thread</code>.9671<jvmti/> type <datalink id="jthread"></datalink>.9672Returned values are JNI local references and must be managed.9673</constant>9674<constant id="JVMTI_TYPE_JCLASS" num="111">9675Java programming language object type - <code>java.lang.Class</code>.9676JNI type <datalink id="jclass"></datalink>.9677Returned values are JNI local references and must be managed.9678</constant>9679<constant id="JVMTI_TYPE_JVALUE" num="112">9680Union of all Java programming language primitive and object types -9681JNI type <datalink id="jvalue"></datalink>.9682Returned values which represent object types are JNI local references and must be managed.9683</constant>9684<constant id="JVMTI_TYPE_JFIELDID" num="113">9685Java programming language field identifier -9686JNI type <datalink id="jfieldID"></datalink>.9687</constant>9688<constant id="JVMTI_TYPE_JMETHODID" num="114">9689Java programming language method identifier -9690JNI type <datalink id="jmethodID"></datalink>.9691</constant>9692<constant id="JVMTI_TYPE_CCHAR" num="115">9693C programming language type - <code>char</code>.9694</constant>9695<constant id="JVMTI_TYPE_CVOID" num="116">9696C programming language type - <code>void</code>.9697</constant>9698<constant id="JVMTI_TYPE_JNIENV" num="117">9699JNI environment - <code>JNIEnv</code>.9700Should be used with the correct <datalink id="jvmtiParamKind"/> to make it a pointer type.9701</constant>9702</constants>97039704<constants id="jvmtiParamKind" label="Extension Function/Event Parameter Kinds" kind="enum">9705<constant id="JVMTI_KIND_IN" num="91">9706Ingoing argument - <code>foo</code>.9707</constant>9708<constant id="JVMTI_KIND_IN_PTR" num="92">9709Ingoing pointer argument - <code>const foo*</code>.9710</constant>9711<constant id="JVMTI_KIND_IN_BUF" num="93">9712Ingoing array argument - <code>const foo*</code>.9713</constant>9714<constant id="JVMTI_KIND_ALLOC_BUF" num="94">9715Outgoing allocated array argument - <code>foo**</code>.9716Free with <code>Deallocate</code>.9717</constant>9718<constant id="JVMTI_KIND_ALLOC_ALLOC_BUF" num="95">9719Outgoing allocated array of allocated arrays argument - <code>foo***</code>.9720Free with <code>Deallocate</code>.9721</constant>9722<constant id="JVMTI_KIND_OUT" num="96">9723Outgoing argument - <code>foo*</code>.9724</constant>9725<constant id="JVMTI_KIND_OUT_BUF" num="97">9726Outgoing array argument (pre-allocated by agent) - <code>foo*</code>.9727Do not <code>Deallocate</code>.9728</constant>9729</constants>97309731</intro>97329733<typedef id="jvmtiParamInfo" label="Extension Function/Event Parameter Info">9734<field id="name">9735<allocfieldbuf><char/></allocfieldbuf>9736<description>9737The parameter name, encoded as a9738<internallink id="mUTF">modified UTF-8</internallink> string9739</description>9740</field>9741<field id="kind">9742<enum>jvmtiParamKind</enum>9743<description>9744The kind of the parameter - type modifiers9745</description>9746</field>9747<field id="base_type">9748<enum>jvmtiParamTypes</enum>9749<description>9750The base type of the parameter - modified by <code>kind</code>9751</description>9752</field>9753<field id="null_ok">9754<jboolean/>9755<description>9756Is a <code>NULL</code> argument permitted? Applies only to pointer and object types.9757</description>9758</field>9759</typedef>97609761<callback id="jvmtiExtensionFunction">9762<enum>jvmtiError</enum>9763<synopsis>Extension Function</synopsis>9764<description>9765This is the implementation-specific extension function.9766</description>9767<parameters>9768<param id="jvmti_env">9769<outptr>9770<struct>jvmtiEnv</struct>9771</outptr>9772<description>9773The <jvmti/> environment is the only fixed parameter for extension functions.9774</description>9775</param>9776<param id="...">9777<varargs/>9778<description>9779The extension function-specific parameters9780</description>9781</param>9782</parameters>9783</callback>97849785<function id="GetExtensionFunctions" phase="onload" num="124">9786<synopsis>Get Extension Functions</synopsis>97879788<typedef id="jvmtiExtensionFunctionInfo" label="Extension Function Info">9789<field id="func">9790<ptrtype>9791<struct>jvmtiExtensionFunction</struct>9792</ptrtype>9793<description>9794The actual function to call9795</description>9796</field>9797<field id="id">9798<allocfieldbuf><char/></allocfieldbuf>9799<description>9800The identifier for the extension function, encoded as a9801<internallink id="mUTF">modified UTF-8</internallink> string.9802Uses package name conventions.9803For example, <code>com.sun.hotspot.bar</code>9804</description>9805</field>9806<field id="short_description">9807<allocfieldbuf><char/></allocfieldbuf>9808<description>9809A one sentence description of the function, encoded as a9810<internallink id="mUTF">modified UTF-8</internallink> string.9811</description>9812</field>9813<field id="param_count">9814<jint/>9815<description>9816The number of parameters excluding <code>jvmtiEnv *jvmti_env</code>9817</description>9818</field>9819<field id="params">9820<allocfieldbuf outcount="param_count">9821<struct>jvmtiParamInfo</struct>9822</allocfieldbuf>9823<description>9824Array of9825<fieldlink id="param_count" struct="jvmtiExtensionFunctionInfo"></fieldlink>9826parameters (<code>jvmtiEnv *jvmti_env</code> excluded)9827</description>9828</field>9829<field id="error_count">9830<jint/>9831<description>9832The number of possible error returns (excluding universal errors)9833</description>9834</field>9835<field id="errors">9836<allocfieldbuf outcount="error_count">9837<enum>jvmtiError</enum>9838</allocfieldbuf>9839<description>9840Array of <fieldlink id="error_count" struct="jvmtiExtensionFunctionInfo"></fieldlink>9841possible errors9842</description>9843</field>9844</typedef>98459846<description>9847Returns the set of extension functions.9848</description>9849<origin>new</origin>9850<capabilities>9851</capabilities>9852<parameters>9853<param id="extension_count_ptr">9854<outptr><jint/></outptr>9855<description>9856On return, points to the number of extension functions9857</description>9858</param>9859<param id="extensions">9860<allocbuf outcount="extension_count_ptr"><struct>jvmtiExtensionFunctionInfo</struct></allocbuf>9861<description>9862Returns an array of extension function info, one per function9863</description>9864</param>9865</parameters>9866<errors>9867</errors>9868</function>98699870<function id="GetExtensionEvents" phase="onload" num="125">9871<synopsis>Get Extension Events</synopsis>98729873<typedef id="jvmtiExtensionEventInfo" label="Extension Event Info">9874<field id="extension_event_index">9875<jint/>9876<description>9877The identifying index of the event9878</description>9879</field>9880<field id="id">9881<allocfieldbuf><char/></allocfieldbuf>9882<description>9883The identifier for the extension event, encoded as a9884<internallink id="mUTF">modified UTF-8</internallink> string.9885Uses package name conventions.9886For example, <code>com.sun.hotspot.bar</code>9887</description>9888</field>9889<field id="short_description">9890<allocfieldbuf><char/></allocfieldbuf>9891<description>9892A one sentence description of the event, encoded as a9893<internallink id="mUTF">modified UTF-8</internallink> string.9894</description>9895</field>9896<field id="param_count">9897<jint/>9898<description>9899The number of parameters excluding <code>jvmtiEnv *jvmti_env</code>9900</description>9901</field>9902<field id="params">9903<allocfieldbuf outcount="param_count">9904<struct>jvmtiParamInfo</struct>9905</allocfieldbuf>9906<description>9907Array of9908<fieldlink id="param_count" struct="jvmtiExtensionEventInfo"></fieldlink>9909parameters (<code>jvmtiEnv *jvmti_env</code> excluded)9910</description>9911</field>9912</typedef>99139914<description>9915Returns the set of extension events.9916</description>9917<origin>new</origin>9918<capabilities>9919</capabilities>9920<parameters>9921<param id="extension_count_ptr">9922<outptr><jint/></outptr>9923<description>9924On return, points to the number of extension events9925</description>9926</param>9927<param id="extensions">9928<allocbuf outcount="extension_count_ptr"><struct>jvmtiExtensionEventInfo</struct></allocbuf>9929<description>9930Returns an array of extension event info, one per event9931</description>9932</param>9933</parameters>9934<errors>9935</errors>9936</function>99379938<callback id="jvmtiExtensionEvent">9939<void/>9940<synopsis>Extension Event</synopsis>9941<description>9942This is the implementation-specific event.9943The event handler is set with9944<functionlink id="SetExtensionEventCallback"/>.9945<p/>9946Event handlers for extension events must be declared varargs to match this definition.9947Failure to do so could result in calling convention mismatch and undefined behavior9948on some platforms.9949<p/>9950For example, if the <code>jvmtiParamInfo</code>9951returned by <functionlink id="GetExtensionEvents"/> indicates that9952there is a <code>jint</code> parameter, the event handler should be9953declared:9954<example>9955void JNICALL myHandler(jvmtiEnv* jvmti_env, ...)9956</example>9957Note the terminal "<code>...</code>" which indicates varargs.9958The <code>jint</code> argument inside <code>myHandler</code> needs to be extracted using9959the <code>va_*</code> syntax of the C programming language.9960</description>9961<parameters>9962<param id="jvmti_env">9963<outptr>9964<struct>jvmtiEnv</struct>9965</outptr>9966<description>9967The <jvmti/> environment is the only fixed parameter for extension events.9968</description>9969</param>9970<param id="...">9971<varargs/>9972<description>9973The extension event-specific parameters9974</description>9975</param>9976</parameters>9977</callback>99789979<function id="SetExtensionEventCallback" phase="onload" num="126">9980<synopsis>Set Extension Event Callback</synopsis>99819982<description>9983Sets the callback function for an extension event and9984enables the event. Or, if the callback is <code>NULL</code>, disables9985the event. Note that unlike standard events, setting9986the callback and enabling the event are a single operation.9987</description>9988<origin>new</origin>9989<capabilities>9990</capabilities>9991<parameters>9992<param id="extension_event_index">9993<jint/>9994<description>9995Identifies which callback to set.9996This index is the9997<fieldlink id="extension_event_index" struct="jvmtiExtensionEventInfo"></fieldlink>9998field of9999<datalink id="jvmtiExtensionEventInfo"/>.10000</description>10001</param>10002<param id="callback">10003<ptrtype>10004<struct>jvmtiExtensionEvent</struct>10005<nullok>disable the event</nullok>10006</ptrtype>10007<description>10008If <code>callback</code> is non-<code>NULL</code>,10009set <code>callback</code> to be the event callback function10010and enable the event.10011</description>10012</param>10013</parameters>10014<errors>10015<error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">10016<paramlink id="extension_event_index"/> is not an10017<fieldlink id="extension_event_index"10018struct="jvmtiExtensionEventInfo"/>10019returned by10020<functionlink id="GetExtensionEvents"/>10021</error>10022</errors>10023</function>1002410025</category>1002610027<category id="capability" label="Capability">1002810029<intro>10030The capabilities functions allow you to change the10031functionality available to <jvmti/>--that is,10032which <jvmti/>10033functions can be called, what events can be generated,10034and what functionality these events and functions can10035provide.10036<p/>10037The "Capabilities" section of each function and event describe which10038capabilities, if any, they are associated with. "Required Functionality"10039means it is available for use and no capabilities must be added to use it.10040"Optional Functionality" means the agent must possess the capability10041before it can be used.10042To possess a capability, the agent must10043<functionlink id="AddCapabilities">add the capability</functionlink>.10044"Optional Features" describe capabilities which,10045if added, extend the feature set.10046<p/>10047The potentially available capabilities of each <jvmti/> implementation are different.10048Depending on the implementation, a capability:10049<ul>10050<li>may never be added</li>10051<li>may be added in either the <code>OnLoad</code> or live phase in any environment</li>10052<li>may be added only during the <code>OnLoad</code> phase</li>10053<li>may be possessed by only one environment at a time</li>10054<li>may be possessed by only one environment at a time,10055and only during the <code>OnLoad</code> phase</li>10056<li>and so on ...</li>10057</ul>10058Frequently, the addition of a capability may incur a cost in execution speed, start up10059time, and/or memory footprint. Note that the overhead of using a capability10060is completely different than the overhead of possessing a capability.10061Take single stepping as an example. When single stepping is on (that10062is, when the event is enabled and thus actively sending events)10063the overhead of sending and processing an event10064on each instruction is huge in any implementation.10065However, the overhead of possessing the capability may be small or large,10066depending on the implementation. Also, when and if a capability is potentially10067available depends on the implementation. Some examples:10068<ul>10069<li>One VM might perform all execution by compiling bytecodes into10070native code and be unable to generate single step instructions.10071In this implementation the capability can not be added.</li>10072<li>Another VM may be able to switch execution to a single stepping10073interpreter at any time. In this implementation, having the capability has no10074overhead and could be added at any time.</li>10075<li>Yet another VM might be able to choose a bytecode compiling or single stepping capable interpreted10076execution engine at start up, but be unable to switch between them.10077In this implementation the capability would need to be added10078during the <code>OnLoad</code> phase (before bytecode10079execution begins) and would have a large impact on execution speed10080even if single stepping was never used.</li>10081<li>Still another VM might be able to add an "is single stepping on" check10082into compiled bytecodes or a generated interpreter. Again in this implementation10083the capability would need to be added during the <code>OnLoad</code> phase but the overhead (a test10084and branch on each instruction) would be considerably less.</li>10085</ul>10086<p/>10087Each <jvmti/> <internallink id="environments">environment</internallink>10088has its own set of capabilities.10089Initially, that set is empty.10090Any desired capability must be added.10091If possible, capabilities should be added during the <code>OnLoad</code> phase. For most10092virtual machines certain capabilities require special set up for10093the virtual machine and this set up must happen10094during the <code>OnLoad</code> phase, before the virtual machine begins execution.10095Once a capability is added, it can10096only be removed if explicitly relinquished by the environment.10097<p/>10098The agent can,10099<functionlink id="GetPotentialCapabilities">determine what10100capabilities this VM can potentially provide</functionlink>,10101<functionlink id="AddCapabilities">add the capabilities10102to be used</functionlink>,10103<functionlink id="RelinquishCapabilities">release capabilities10104which are no longer needed</functionlink>, and10105<functionlink id="GetCapabilities">examine the currently available10106capabilities</functionlink>.10107</intro>1010810109<intro id="capabilityExamples" label="Capability Examples">10110For example, a freshly started agent (in the <code>OnLoad</code> function)10111wants to enable all possible capabilities.10112Note that, in general, this is not advisable as the agent may suffer10113a performance penalty for functionality it is not using.10114The code might look like this in C:10115<example>10116jvmtiCapabilities capa;10117jvmtiError err;1011810119err = (*jvmti)->GetPotentialCapabilities(jvmti, &capa);10120if (err == JVMTI_ERROR_NONE) {10121err = (*jvmti)->AddCapabilities(jvmti, &capa);10122</example>10123For example, if an agent wants to check if it can get10124the bytecodes of a method (that is, it wants to check10125if it previously added this capability and has not10126relinquished it), the code might10127look like this in C:10128<example>10129jvmtiCapabilities capa;10130jvmtiError err;1013110132err = (*jvmti)->GetCapabilities(jvmti, &capa);10133if (err == JVMTI_ERROR_NONE) {10134if (capa.can_get_bytecodes) { ... } }10135</example>10136</intro>1013710138<capabilitiestypedef id="jvmtiCapabilities" label="The Capabilities Structure">10139<description>10140The functions in this category use this capabilities structure10141which contains boolean flags corresponding to each capability:10142</description>10143<capabilityfield id="can_tag_objects">10144<description>10145Can set and get tags, as described in the10146<internallink id="Heap">Heap category</internallink>.10147</description>10148</capabilityfield>10149<capabilityfield id="can_generate_field_modification_events">10150<description>10151Can set watchpoints on field modification -10152<functionlink id="SetFieldModificationWatch"></functionlink>10153</description>10154</capabilityfield>10155<capabilityfield id="can_generate_field_access_events">10156<description>10157Can set watchpoints on field access -10158<functionlink id="SetFieldAccessWatch"></functionlink>10159</description>10160</capabilityfield>10161<capabilityfield id="can_get_bytecodes">10162<description>10163Can get bytecodes of a method <functionlink id="GetBytecodes"></functionlink>10164</description>10165</capabilityfield>10166<capabilityfield id="can_get_synthetic_attribute">10167<description>10168Can test if a field or method is synthetic -10169<functionlink id="IsFieldSynthetic"></functionlink> and10170<functionlink id="IsMethodSynthetic"></functionlink>10171</description>10172</capabilityfield>10173<capabilityfield id="can_get_owned_monitor_info">10174<description>10175Can get information about ownership of monitors -10176<functionlink id="GetOwnedMonitorInfo"></functionlink>10177</description>10178</capabilityfield>10179<capabilityfield id="can_get_current_contended_monitor">10180<description>10181Can <functionlink id="GetCurrentContendedMonitor"></functionlink>10182</description>10183</capabilityfield>10184<capabilityfield id="can_get_monitor_info">10185<description>10186Can <functionlink id="GetObjectMonitorUsage"></functionlink>10187</description>10188</capabilityfield>10189<capabilityfield id="can_pop_frame">10190<description>10191Can pop frames off the stack - <functionlink id="PopFrame"></functionlink>10192</description>10193</capabilityfield>10194<capabilityfield id="can_redefine_classes">10195<description>10196Can redefine classes with <functionlink id="RedefineClasses"/>.10197</description>10198</capabilityfield>10199<capabilityfield id="can_signal_thread">10200<description>10201Can send stop or interrupt to threads10202</description>10203</capabilityfield>10204<capabilityfield id="can_get_source_file_name">10205<description>10206Can get the source file name of a class10207</description>10208</capabilityfield>10209<capabilityfield id="can_get_line_numbers">10210<description>10211Can get the line number table of a method10212</description>10213</capabilityfield>10214<capabilityfield id="can_get_source_debug_extension">10215<description>10216Can get the source debug extension of a class10217</description>10218</capabilityfield>10219<capabilityfield id="can_access_local_variables">10220<description>10221Can set and get local variables10222</description>10223</capabilityfield>10224<capabilityfield id="can_maintain_original_method_order">10225<description>10226Can return methods in the order they occur in the class file10227</description>10228</capabilityfield>10229<capabilityfield id="can_generate_single_step_events">10230<description>10231Can get <eventlink id="SingleStep">single step</eventlink> events10232</description>10233</capabilityfield>10234<capabilityfield id="can_generate_exception_events">10235<description>10236Can get <eventlink id="Exception">exception thrown</eventlink> and10237<eventlink id="ExceptionCatch">exception catch</eventlink> events10238</description>10239</capabilityfield>10240<capabilityfield id="can_generate_frame_pop_events">10241<description>10242Can <functionlink id="NotifyFramePop">set</functionlink> and thus get10243<eventlink id="FramePop"></eventlink> events10244</description>10245</capabilityfield>10246<capabilityfield id="can_generate_breakpoint_events">10247<description>10248Can <functionlink id="SetBreakpoint">set</functionlink> and thus get10249<eventlink id="Breakpoint"></eventlink> events10250</description>10251</capabilityfield>10252<capabilityfield id="can_suspend">10253<description>10254Can suspend and resume threads10255</description>10256</capabilityfield>10257<capabilityfield id="can_redefine_any_class">10258<description>10259<functionlink id="RedefineClasses"/> can be called on any modifiable class.10260See <functionlink id="IsModifiableClass"/>.10261(<fieldlink id="can_redefine_classes" struct="jvmtiCapabilities"/>10262must also be set)10263</description>10264</capabilityfield>10265<capabilityfield id="can_get_current_thread_cpu_time">10266<description>10267Can <functionlink id="GetCurrentThreadCpuTime">get</functionlink>10268current thread CPU time10269</description>10270</capabilityfield>10271<capabilityfield id="can_get_thread_cpu_time">10272<description>10273Can <functionlink id="GetThreadCpuTime">get</functionlink>10274thread CPU time10275</description>10276</capabilityfield>10277<capabilityfield id="can_generate_method_entry_events"10278disp1="can_generate" disp2="_method_entry_events"10279>10280<description>10281Can generate method entry events on entering a method10282</description>10283</capabilityfield>10284<capabilityfield id="can_generate_method_exit_events"10285disp1="can_generate" disp2="_method_exit_events"10286>10287<description>10288Can generate method exit events on leaving a method10289</description>10290</capabilityfield>10291<capabilityfield id="can_generate_all_class_hook_events"10292disp1="can_generate" disp2="_all_class_hook_events"10293>10294<description>10295Can generate ClassFileLoadHook events for every loaded class.10296</description>10297</capabilityfield>10298<capabilityfield id="can_generate_compiled_method_load_events"10299disp1="can_generate" disp2="_compiled_method_load_events"10300>10301<description>10302Can generate events when a method is compiled or unloaded10303</description>10304</capabilityfield>10305<capabilityfield id="can_generate_monitor_events"10306disp1="can_generate" disp2="_monitor_events"10307>10308<description>10309Can generate events on monitor activity10310</description>10311</capabilityfield>10312<capabilityfield id="can_generate_vm_object_alloc_events"10313disp1="can_generate" disp2="_vm_object_alloc_events"10314>10315<description>10316Can generate events on VM allocation of an object10317</description>10318</capabilityfield>10319<capabilityfield id="can_generate_native_method_bind_events"10320disp1="can_generate" disp2="_native_method_bind_events"10321>10322<description>10323Can generate events when a native method is bound to its10324implementation10325</description>10326</capabilityfield>10327<capabilityfield id="can_generate_garbage_collection_events"10328disp1="can_generate" disp2="_garbage_collection_events"10329>10330<description>10331Can generate events when garbage collection begins or ends10332</description>10333</capabilityfield>10334<capabilityfield id="can_generate_object_free_events"10335disp1="can_generate" disp2="_object_free_events"10336>10337<description>10338Can generate events when the garbage collector frees an object10339</description>10340</capabilityfield>10341<capabilityfield id="can_force_early_return" since="1.1">10342<description>10343Can return early from a method, as described in the10344<internallink id="ForceEarlyReturn">Force Early Return category</internallink>.10345</description>10346</capabilityfield>10347<capabilityfield id="can_get_owned_monitor_stack_depth_info" since="1.1">10348<description>10349Can get information about owned monitors with stack depth -10350<functionlink id="GetOwnedMonitorStackDepthInfo"></functionlink>10351</description>10352</capabilityfield>10353<capabilityfield id="can_get_constant_pool" since="1.1">10354<description>10355Can get the constant pool of a class -10356<functionlink id="GetConstantPool"></functionlink>10357</description>10358</capabilityfield>10359<capabilityfield id="can_set_native_method_prefix" since="1.1">10360<description>10361Can set prefix to be applied when native method cannot be resolved -10362<functionlink id="SetNativeMethodPrefix"/> and10363<functionlink id="SetNativeMethodPrefixes"/>10364</description>10365</capabilityfield>10366<capabilityfield id="can_retransform_classes" since="1.1">10367<description>10368Can retransform classes with <functionlink id="RetransformClasses"/>.10369In addition to the restrictions imposed by the specific10370implementation on this capability (see the10371<internallink id="capability">Capability</internallink> section),10372this capability must be set before the10373<eventlink id="ClassFileLoadHook"/> event is enabled for the10374first time in this environment.10375An environment that possesses this capability at the time that10376<code>ClassFileLoadHook</code> is enabled for the first time is10377said to be <i>retransformation capable</i>.10378An environment that does not possess this capability at the time that10379<code>ClassFileLoadHook</code> is enabled for the first time is10380said to be <i>retransformation incapable</i>.10381</description>10382</capabilityfield>10383<capabilityfield id="can_retransform_any_class" since="1.1">10384<description>10385<functionlink id="RetransformClasses"/> can be called on any modifiable class.10386See <functionlink id="IsModifiableClass"/>.10387(<fieldlink id="can_retransform_classes" struct="jvmtiCapabilities"/>10388must also be set)10389</description>10390</capabilityfield>10391<capabilityfield id="can_generate_resource_exhaustion_heap_events" since="1.1">10392<description>10393Can generate events when the VM is unable to allocate memory from10394the <tm>Java</tm> platform heap.10395See <eventlink id="ResourceExhausted"/>.10396</description>10397</capabilityfield>10398<capabilityfield id="can_generate_resource_exhaustion_threads_events" since="1.1">10399<description>10400Can generate events when the VM is unable to create a thread.10401See <eventlink id="ResourceExhausted"/>.10402</description>10403</capabilityfield>10404<capabilityfield id="can_generate_early_vmstart" since="9">10405<description>10406Can generate the <code>VMStart</code> event early.10407See <eventlink id="VMStart"/>.10408</description>10409</capabilityfield>10410<capabilityfield id="can_generate_early_class_hook_events" since="9">10411<description>10412Can generate the <eventlink id="ClassFileLoadHook"/> events10413in the primordial phase. If this capability and10414<internallink id="jvmtiCapabilities.can_generate_all_class_hook_events">10415<code>can_generate_all_class_hook_events</code></internallink>10416are enabled then the <eventlink id="ClassFileLoadHook"/> events10417can be posted for classes loaded in the primordial phase.10418See <eventlink id="ClassFileLoadHook"/>.10419</description>10420</capabilityfield>10421<capabilityfield id="can_generate_sampled_object_alloc_events" since="11">10422<description>10423Can generate sampled allocation events.10424If this capability is enabled then the heap sampling method10425<functionlink id="SetHeapSamplingInterval"></functionlink> can be10426called and <eventlink id="SampledObjectAlloc"></eventlink> events can be generated.10427</description>10428</capabilityfield>10429</capabilitiestypedef>1043010431<function id="GetPotentialCapabilities" jkernel="yes" phase="onload" num="140">10432<synopsis>Get Potential Capabilities</synopsis>10433<description>10434Returns via <paramlink id="capabilities_ptr"></paramlink> the <jvmti/>10435features that can potentially be possessed by this environment10436at this time.10437The returned capabilities differ from the complete set of capabilities10438implemented by the VM in two cases: another environment possesses10439capabilities that can only be possessed by one environment, or the10440current <functionlink id="GetPhase">phase</functionlink> is live,10441and certain capabilities can only be added during the <code>OnLoad</code> phase.10442The <functionlink id="AddCapabilities"></functionlink> function10443may be used to set any or all or these capabilities.10444Currently possessed capabilities are included.10445<p/>10446Typically this function is used in the <code>OnLoad</code> function.10447Some virtual machines may allow a limited set of capabilities to be10448added in the live phase.10449In this case, the set of potentially available capabilities10450will likely differ from the <code>OnLoad</code> phase set.10451<p/>10452See the10453<internallink id="capabilityExamples">Capability Examples</internallink>.10454</description>10455<origin>new</origin>10456<capabilities>10457</capabilities>10458<parameters>10459<param id="capabilities_ptr">10460<outptr><struct>jvmtiCapabilities</struct></outptr>10461<description>10462On return, points to the <jvmti/> capabilities that may be added.10463</description>10464</param>10465</parameters>10466<errors>10467</errors>10468</function>1046910470<elide>10471<function id="EstimateCostOfCapabilities" phase="onload" num="141">10472<synopsis>Estimate Cost Of Capabilities</synopsis>10473<description>10474<issue>There is strong opposition to this function. The concern is10475that it would be difficult or impossible to provide meaningful10476numbers, as the amount of impact is conditional on many factors10477that a single number could not represent. There is doubt that10478conditional implementations would be used or are even a good idea.10479The thought is that release documentation for the implementation10480would be the best means of exposing this information.10481Unless new arguments are presented, I intend to remove this10482function in the next revision.10483</issue>10484<p/>10485Return via the <paramlink id="time_impact_ptr"></paramlink> and10486<paramlink id="space_impact_ptr"></paramlink> an estimate of the impact10487of adding the capabilities pointed to by10488<paramlink id="capabilities_ptr"></paramlink>.10489The returned estimates are in percentage of additional overhead, thus10490a time impact of 100 mean the application might run10491at half the speed.10492The estimates are very rough approximations and are not guaranteed.10493Note also, that the estimates are of the impact of having the10494capability available--when and if it is used the impact may be10495much greater.10496Estimates can be for a single capability or for a set of10497capabilities. Note that the costs are not necessarily additive,10498adding support for one capability might make another available10499for free or conversely having two capabilities at once may10500have multiplicative impact.10501Estimates are relative to the current set of capabilities -10502that is, how much more impact given the currently possessed capabilities.10503<p/>10504Typically this function is used in the OnLoad function,10505some virtual machines may allow a limited set of capabilities to be10506added in the live phase.10507In this case, the set of potentially available capabilities10508will likely differ from the OnLoad phase set.10509<p/>10510See the10511<internallink id="capabilityExamples">Capability Examples</internallink>.10512</description>10513<origin>new</origin>10514<capabilities>10515</capabilities>10516<parameters>10517<param id="capabilities_ptr">10518<inptr><struct>jvmtiCapabilities</struct></inptr>10519<description>10520points to the <jvmti/> capabilities to evaluate.10521</description>10522</param>10523<param id="time_impact_ptr">10524<outptr><jint/></outptr>10525<description>10526On return, points to the estimated percentage increase in10527run time if this capability was added.10528</description>10529</param>10530<param id="space_impact_ptr">10531<outptr><jint/></outptr>10532<description>10533On return, points to the estimated percentage increase in10534memory space used if this capability was added.10535</description>10536</param>10537</parameters>10538<errors>10539<error id="JVMTI_ERROR_NOT_AVAILABLE">10540The desired capabilities are not even potentially available.10541</error>10542</errors>10543</function>10544</elide>1054510546<function id="AddCapabilities" jkernel="yes" phase="onload" num="142">10547<synopsis>Add Capabilities</synopsis>10548<description>10549Set new capabilities by adding the capabilities10550whose values are set to one (<code>1</code>) in10551<code>*</code><paramlink id="capabilities_ptr"></paramlink>.10552All previous capabilities are retained.10553Typically this function is used in the <code>OnLoad</code> function.10554Some virtual machines may allow a limited set of capabilities to be10555added in the live phase.10556<p/>10557See the10558<internallink id="capabilityExamples">Capability Examples</internallink>.10559</description>10560<origin>new</origin>10561<capabilities>10562</capabilities>10563<parameters>10564<param id="capabilities_ptr">10565<inptr><struct>jvmtiCapabilities</struct></inptr>10566<description>10567Points to the <jvmti/> capabilities to add.10568</description>10569</param>10570</parameters>10571<errors>10572<error id="JVMTI_ERROR_NOT_AVAILABLE">10573The desired capabilities are not even potentially available.10574</error>10575</errors>10576</function>105771057810579<function id="RelinquishCapabilities" phase="onload" num="143">10580<synopsis>Relinquish Capabilities</synopsis>10581<description>10582Relinquish the capabilities10583whose values are set to one (<code>1</code>) in10584<code>*</code><paramlink id="capabilities_ptr"></paramlink>.10585Some implementations may allow only one environment to have a capability10586(see the <internallink id="capability">capability introduction</internallink>).10587This function releases capabilities10588so that they may be used by other agents.10589All other capabilities are retained.10590The capability will no longer be present in <functionlink id="GetCapabilities"></functionlink>.10591Attempting to relinquish a capability that the agent does not possess is not an error.10592<issue>10593It is possible for the agent to be actively using capabilities10594which are being relinquished. For example, a thread is currently10595suspended and can_suspend is being relinquished or an event is currently10596enabled and can_generate_whatever is being relinquished.10597There are three possible ways we could spec this:10598<ul>10599<li>relinquish automatically releases them</li>10600<li>relinquish checks and returns some error code if held</li>10601<li>it is the agent's responsibility and it is not checked</li>10602</ul>10603One of these should be chosen.10604</issue>10605</description>10606<origin>new</origin>10607<capabilities>10608</capabilities>10609<parameters>10610<param id="capabilities_ptr">10611<inptr><struct>jvmtiCapabilities</struct></inptr>10612<description>10613Points to the <jvmti/> capabilities to relinquish.10614</description>10615</param>10616</parameters>10617<errors>10618</errors>10619</function>10620106211062210623<function id="GetCapabilities" jkernel="yes" phase="any" num="89">10624<synopsis>Get Capabilities</synopsis>10625<description>10626Returns via <paramlink id="capabilities_ptr"></paramlink> the optional <jvmti/>10627features which this environment currently possesses.10628Each possessed capability is indicated by a one (<code>1</code>) in the10629corresponding field of the <internallink id="jvmtiCapabilities">capabilities10630structure</internallink>.10631An environment does not possess a capability unless it has been successfully added with10632<functionlink id="AddCapabilities"/>.10633An environment only loses possession of a capability if it has been relinquished with10634<functionlink id="RelinquishCapabilities"/>. Thus, this function returns the net result10635of the <code>AddCapabilities</code> and <code>RelinquishCapabilities</code> calls which10636have been made.10637<p/>10638See the10639<internallink id="capabilityExamples">Capability Examples</internallink>.10640</description>10641<origin>jvmdiClone</origin>10642<capabilities>10643</capabilities>10644<parameters>10645<param id="capabilities_ptr">10646<outptr><struct>jvmtiCapabilities</struct></outptr>10647<description>10648On return, points to the <jvmti/> capabilities.10649</description>10650</param>10651</parameters>10652<errors>10653</errors>10654</function>1065510656</category>106571065810659<category id="timers" label="Timers">1066010661<intro>10662These functions provide timing information.10663The resolution at which the time is updated is not specified.10664They provides nanosecond precision, but not necessarily nanosecond accuracy.10665Details about the timers, such as their maximum values, can be accessed with10666the timer information functions.10667</intro>1066810669<typedef id="jvmtiTimerInfo" label="Timer Info">10670<description>10671The information function for each timer returns this data structure.10672</description>10673<field id="max_value">10674<jlong/>10675<description>10676The maximum value the timer can reach.10677After this value is reached the timer wraps back to zero.10678This is an unsigned value. If tested or printed as a jlong (signed value)10679it may appear to be a negative number.10680</description>10681</field>10682<field id="may_skip_forward">10683<jboolean/>10684<description>10685If true, the timer can be externally adjusted and as a result skip forward.10686If false, the timer value will never increase faster than real time.10687</description>10688</field>10689<field id="may_skip_backward">10690<jboolean/>10691<description>10692If true, the timer can be externally adjusted and as a result skip backward.10693If false, the timer value will be monotonically increasing.10694</description>10695</field>10696<field id="kind">10697<enum>jvmtiTimerKind</enum>10698<description>10699The kind of timer.10700On a platform that does not distinguish between user and system time, <datalink10701id="JVMTI_TIMER_TOTAL_CPU"><code>JVMTI_TIMER_TOTAL_CPU</code></datalink>10702is returned.10703</description>10704</field>10705<field id="reserved1">10706<jlong/>10707<description>10708Reserved for future use.10709</description>10710</field>10711<field id="reserved2">10712<jlong/>10713<description>10714Reserved for future use.10715</description>10716</field>10717</typedef>1071810719<intro>10720Where the timer kind is --1072110722<constants id="jvmtiTimerKind" label="Timer Kinds" kind="enum">10723<constant id="JVMTI_TIMER_USER_CPU" num="30">10724CPU time that a thread is in user mode.10725</constant>10726<constant id="JVMTI_TIMER_TOTAL_CPU" num="31">10727CPU time that a thread is in user or system mode.10728</constant>10729<constant id="JVMTI_TIMER_ELAPSED" num="32">10730Elapsed time.10731</constant>10732</constants>10733</intro>1073410735<function id="GetCurrentThreadCpuTimerInfo" callbacksafe="safe" impl="innative notrace" phase="start" num="134">10736<synopsis>Get Current Thread CPU Timer Information</synopsis>10737<description>10738Get information about the10739<functionlink id="GetCurrentThreadCpuTime"/> timer.10740The fields of the <datalink id="jvmtiTimerInfo"/> structure10741are filled in with details about the timer.10742This information is specific to the platform and the implementation of10743<functionlink id="GetCurrentThreadCpuTime"/> and thus10744does not vary by thread nor does it vary10745during a particular invocation of the VM.10746<p/>10747Note that the implementations of <functionlink id="GetCurrentThreadCpuTime"/>10748and <functionlink id="GetThreadCpuTime"/> may differ, and thus the values10749returned by <code>GetCurrentThreadCpuTimerInfo</code>10750and <functionlink id="GetThreadCpuTimerInfo"/>10751may differ -- see <functionlink id="GetCurrentThreadCpuTime"/> for more information.10752</description>10753<origin>new</origin>10754<capabilities>10755<required id="can_get_current_thread_cpu_time">10756Can get current thread CPU time.10757</required>10758</capabilities>10759<parameters>10760<param id="info_ptr">10761<outptr><struct>jvmtiTimerInfo</struct></outptr>10762<description>10763On return, filled with information describing the time10764returned by <functionlink id="GetCurrentThreadCpuTime"/>.10765</description>10766</param>10767</parameters>10768<errors>10769</errors>10770</function>1077110772<function id="GetCurrentThreadCpuTime" callbacksafe="safe" impl="innative notrace" phase="start" num="135">10773<synopsis>Get Current Thread CPU Time</synopsis>10774<description>10775Return the CPU time utilized by the current thread.10776<p/>10777Note that the <functionlink id="GetThreadCpuTime"/>10778function provides CPU time for any thread, including10779the current thread. <code>GetCurrentThreadCpuTime</code>10780exists to support platforms which cannot10781supply CPU time for threads other than the current10782thread or which have more accurate information for10783the current thread (see10784<functionlink id="GetCurrentThreadCpuTimerInfo"/> vs10785<functionlink id="GetThreadCpuTimerInfo"/>).10786On many platforms this call will be equivalent to:10787<example>10788GetThreadCpuTime(env, NULL, nanos_ptr)10789</example>10790</description>10791<origin>new</origin>10792<capabilities>10793<required id="can_get_current_thread_cpu_time">10794Can get current thread CPU time.10795<p/>10796If this capability is enabled after threads have started,10797the implementation may choose any time up10798to and including the time that the capability is enabled10799as the point where CPU time collection starts.10800<p/>10801This capability must be potentially available on any10802platform where10803<internallink id="jvmtiCapabilities.can_get_thread_cpu_time"><code>can_get_thread_cpu_time</code></internallink>10804is potentially available.10805</required>10806</capabilities>10807<parameters>10808<param id="nanos_ptr">10809<outptr><jlong/></outptr>10810<description>10811On return, points to the CPU time used by this thread10812in nanoseconds.10813This is an unsigned value. If tested or printed as a jlong (signed value)10814it may appear to be a negative number.10815</description>10816</param>10817</parameters>10818<errors>10819</errors>10820</function>1082110822<function id="GetThreadCpuTimerInfo" num="136">10823<synopsis>Get Thread CPU Timer Information</synopsis>10824<description>10825Get information about the10826<functionlink id="GetThreadCpuTime"/> timer.10827The fields of the <datalink id="jvmtiTimerInfo"/> structure10828are filled in with details about the timer.10829This information is specific to the platform and the implementation of10830<functionlink id="GetThreadCpuTime"/> and thus10831does not vary by thread nor does it vary10832during a particular invocation of the VM.10833<p/>10834Note that the implementations of <functionlink id="GetCurrentThreadCpuTime"/>10835and <functionlink id="GetThreadCpuTime"/> may differ, and thus the values10836returned by <functionlink id="GetCurrentThreadCpuTimerInfo"/>10837and <code>GetThreadCpuTimerInfo</code>10838may differ -- see <functionlink id="GetCurrentThreadCpuTime"/> for more information.10839</description>10840<origin>new</origin>10841<capabilities>10842<required id="can_get_thread_cpu_time">10843Can get thread CPU time.10844</required>10845</capabilities>10846<parameters>10847<param id="info_ptr">10848<outptr><struct>jvmtiTimerInfo</struct></outptr>10849<description>10850On return, filled with information describing the time10851returned by <functionlink id="GetThreadCpuTime"/>.10852</description>10853</param>10854</parameters>10855<errors>10856</errors>10857</function>1085810859<function id="GetThreadCpuTime" num="137">10860<synopsis>Get Thread CPU Time</synopsis>10861<description>10862Return the CPU time utilized by the specified thread.10863<p/>10864Get information about this timer with10865<functionlink id="GetThreadCpuTimerInfo"/>.10866</description>10867<origin>new</origin>10868<capabilities>10869<required id="can_get_thread_cpu_time">10870Can get thread CPU time.10871<p/>10872If this capability is enabled after threads have started,10873the implementation may choose any time up10874to and including the time that the capability is enabled10875as the point where CPU time collection starts.10876</required>10877</capabilities>10878<parameters>10879<param id="thread">10880<jthread null="current"/>10881<description>10882The thread to query.10883</description>10884</param>10885<param id="nanos_ptr">10886<outptr><jlong/></outptr>10887<description>10888On return, points to the CPU time used by the specified thread10889in nanoseconds.10890This is an unsigned value. If tested or printed as a jlong (signed value)10891it may appear to be a negative number.10892</description>10893</param>10894</parameters>10895<errors>10896</errors>10897</function>1089810899<function id="GetTimerInfo" phase="any" callbacksafe="safe" num="138">10900<synopsis>Get Timer Information</synopsis>10901<description>10902Get information about the10903<functionlink id="GetTime"/> timer.10904The fields of the <datalink id="jvmtiTimerInfo"/> structure10905are filled in with details about the timer.10906This information will not change during a particular invocation of the VM.10907</description>10908<origin>new</origin>10909<capabilities>10910</capabilities>10911<parameters>10912<param id="info_ptr">10913<outptr><struct>jvmtiTimerInfo</struct></outptr>10914<description>10915On return, filled with information describing the time10916returned by <functionlink id="GetTime"/>.10917</description>10918</param>10919</parameters>10920<errors>10921</errors>10922</function>1092310924<function id="GetTime" phase="any" callbacksafe="safe" num="139">10925<synopsis>Get Time</synopsis>10926<description>10927Return the current value of the system timer, in nanoseconds.10928<p/>10929The value returned represents nanoseconds since some fixed but10930arbitrary time (perhaps in the future, so values may be10931negative). This function provides nanosecond precision, but not10932necessarily nanosecond accuracy. No guarantees are made about10933how frequently values change.10934<p/>10935Get information about this timer with10936<functionlink id="GetTimerInfo"/>.10937</description>10938<origin>new</origin>10939<capabilities>10940</capabilities>10941<parameters>10942<param id="nanos_ptr">10943<outptr><jlong/></outptr>10944<description>10945On return, points to the time in nanoseconds.10946This is an unsigned value. If tested or printed as a jlong (signed value)10947it may appear to be a negative number.10948</description>10949</param>10950</parameters>10951<errors>10952</errors>10953</function>1095410955<function id="GetAvailableProcessors" phase="any" num="144">10956<synopsis>Get Available Processors</synopsis>10957<description>10958Returns the number of processors available to the Java virtual machine.10959<p/>10960This value may change during a particular invocation of the virtual machine.10961Applications that are sensitive to the number of available processors should10962therefore occasionally poll this property.10963</description>10964<origin>new</origin>10965<capabilities>10966</capabilities>10967<parameters>10968<param id="processor_count_ptr">10969<outptr><jint/></outptr>10970<description>10971On return, points to the maximum number of processors available to the10972virtual machine; never smaller than one.10973</description>10974</param>10975</parameters>10976<errors>10977</errors>10978</function>1097910980</category>109811098210983<category id="classLoaderSearch" label="Class Loader Search">1098410985<intro>10986These functions allow the agent to add to the locations that a class loader searches for a class.10987This is useful for installing instrumentation under the correct class loader.10988</intro>1098910990<function id="AddToBootstrapClassLoaderSearch" jkernel="yes" phase="onload" num="149">10991<synopsis>Add To Bootstrap Class Loader Search</synopsis>10992<description>10993This function can be used to cause instrumentation classes to be defined by the10994bootstrap class loader. See <vmspec chapter="5.3.1"/>.10995After the bootstrap10996class loader unsuccessfully searches for a class, the specified platform-dependent10997search path <paramlink id="segment"/> will be searched as well. Only one segment may be specified in10998the <paramlink id="segment"/>. This function may be called multiple times to add multiple segments,10999the segments will be searched in the order that this function was called.11000<p/>11001In the <code>OnLoad</code> phase the function may be used to specify any platform-dependent11002search path segment to be searched after the bootstrap class loader unsuccessfully searches11003for a class. The segment is typically a directory or JAR file.11004<p/>11005In the live phase the <paramlink id="segment"/> may be used to specify any platform-dependent11006path to a <externallink id="jar/jar.html">11007JAR file</externallink>. The agent should take care that the JAR file does not11008contain any classes or resources other than those to be defined by the bootstrap11009class loader for the purposes of instrumentation.11010<p/>11011<vmspec/> specifies that a subsequent attempt to resolve a symbolic11012reference that the Java virtual machine has previously unsuccessfully attempted11013to resolve always fails with the same error that was thrown as a result of the11014initial resolution attempt. Consequently, if the JAR file contains an entry11015that corresponds to a class for which the Java virtual machine has11016unsuccessfully attempted to resolve a reference, then subsequent attempts to11017resolve 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>11026The platform-dependent search path segment, encoded as a11027<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 an11034existing JAR file is an invalid path.11035</error>11036</errors>11037</function>1103811039<function id="AddToSystemClassLoaderSearch" jkernel="yes" phase="onload" num="151" since="1.1">11040<synopsis>Add To System Class Loader Search</synopsis>11041<description>11042This function can be used to cause instrumentation classes to be11043defined by the system class loader. See <vmspec chapter="5.3.2"/>.11044After the class loader unsuccessfully searches for a class, the specified platform-dependent search11045path <paramlink id="segment"/> will be searched as well. Only one segment may be specified in the11046<paramlink id="segment"/>. This function may be called multiple times to add multiple segments, the11047segments will be searched in the order that this function was called.11048<p/>11049In the <code>OnLoad</code> phase the function may be used to specify any platform-dependent11050search path segment to be searched after the system class loader unsuccessfully searches11051for a class. The segment is typically a directory or JAR file.11052<p/>11053In the live phase the <paramlink id="segment"/> is a platform-dependent path to a11054<externallink id="jar/jar.html">JAR file</externallink> to be11055searched after the system class loader unsuccessfully searches for a class. The agent should11056take care that the JAR file does not contain any classes or resources other than those to be11057defined by the system class loader for the purposes of instrumentation.11058<p/>11059In the live phase the system class loader supports adding a JAR file to be searched if11060the system class loader implements a method name <code>appendToClassPathForInstrumentation</code>11061which takes a single parameter of type <code>java.lang.String</code>. The method is not required11062to have <code>public</code> access.11063<p/>11064<vmspec/> specifies that a subsequent attempt to resolve a symbolic11065reference that the Java virtual machine has previously unsuccessfully attempted11066to resolve always fails with the same error that was thrown as a result of the11067initial resolution attempt. Consequently, if the JAR file contains an entry11068that corresponds to a class for which the Java virtual machine has11069unsuccessfully attempted to resolve a reference, then subsequent attempts to11070resolve that reference will fail with the same error as the initial attempt.11071</description>11072<origin>new</origin>11073<capabilities>11074</capabilities>11075<parameters>11076<param id="segment">11077<inbuf><char/></inbuf>11078<description>11079The platform-dependent search path segment, encoded as a11080<internallink id="mUTF">modified UTF-8</internallink> string.11081</description>11082</param>11083</parameters>11084<errors>11085<error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">11086<paramlink id="segment"/> is an invalid path. In the live phase, anything other than an11087existing JAR file is an invalid path.11088</error>11089<error id="JVMTI_ERROR_CLASS_LOADER_UNSUPPORTED">11090Operation not supported by the system class loader.11091</error>11092</errors>11093</function>1109411095</category>110961109711098<category id="props" label="System Properties">1109911100<intro>11101These functions get and set system properties.11102</intro>1110311104<function id="GetSystemProperties" phase="onload" num="130">11105<synopsis>Get System Properties</synopsis>11106<description>11107The list of VM system property keys which may be used with11108<functionlink id="GetSystemProperty"/> is returned.11109It is strongly recommended that virtual machines provide the11110following property keys:11111<ul>11112<li><code>java.vm.vendor</code></li>11113<li><code>java.vm.version</code></li>11114<li><code>java.vm.name</code></li>11115<li><code>java.vm.info</code></li>11116<li><code>java.library.path</code></li>11117<li><code>java.class.path</code></li>11118</ul>11119Provides access to system properties defined by and used11120by the VM.11121Properties set on the command-line are included.11122This allows getting and setting of these properties11123before the VM even begins executing bytecodes.11124Since this is a VM view of system properties, the set of available11125properties will usually be different than that11126in <code>java.lang.System.getProperties</code>.11127JNI method invocation may be used to access11128<code>java.lang.System.getProperties</code>.11129<p/>11130The set of properties may grow during execution.11131</description>11132<origin>new</origin>11133<capabilities>11134</capabilities>11135<parameters>11136<param id="count_ptr">11137<outptr><jint/></outptr>11138<description>11139On return, points to the number of property keys returned.11140</description>11141</param>11142<param id="property_ptr">11143<allocallocbuf outcount="count_ptr"><char/></allocallocbuf>11144<description>11145On return, points to an array of property keys, encoded as11146<internallink id="mUTF">modified UTF-8</internallink> strings.11147</description>11148</param>11149</parameters>11150<errors>11151</errors>11152</function>1115311154<function id="GetSystemProperty" phase="onload" num="131">11155<synopsis>Get System Property</synopsis>11156<description>11157Return a VM system property value given the property key.11158<p/>11159The function <functionlink id="GetSystemProperties"/>11160returns the set of property keys which may be used.11161The properties which can be retrieved may grow during11162execution.11163<p/>11164Since this is a VM view of system properties, the values11165of properties may differ from that returned by11166<code>java.lang.System.getProperty(String)</code>.11167A typical VM might copy the values of the VM system11168properties into the <code>Properties</code> held by11169<code>java.lang.System</code> during the initialization11170of that class. Thereafter any changes to the VM system11171properties (with <functionlink id="SetSystemProperty"/>)11172or the <code>java.lang.System</code> system properties11173(with <code>java.lang.System.setProperty(String,String)</code>)11174would cause the values to diverge.11175JNI method invocation may be used to access11176<code>java.lang.System.getProperty(String)</code>.11177</description>11178<origin>new</origin>11179<capabilities>11180</capabilities>11181<parameters>11182<param id="property">11183<inbuf><char/></inbuf>11184<description>11185The key of the property to retrieve, encoded as a11186<internallink id="mUTF">modified UTF-8</internallink> string.11187</description>11188</param>11189<param id="value_ptr">11190<allocbuf><char/></allocbuf>11191<description>11192On return, points to the property value, encoded as a11193<internallink id="mUTF">modified UTF-8</internallink> string.11194</description>11195</param>11196</parameters>11197<errors>11198<error id="JVMTI_ERROR_NOT_AVAILABLE">11199This property is not available.11200Use <functionlink id="GetSystemProperties"/> to find available properties.11201</error>11202</errors>11203</function>1120411205<function id="SetSystemProperty" phase="onloadOnly" num="132">11206<synopsis>Set System Property</synopsis>11207<description>11208Set a VM system property value.11209<p/>11210The function <functionlink id="GetSystemProperties"/>11211returns the set of property keys, some of these may be settable.11212See <functionlink id="GetSystemProperty"/>.11213</description>11214<origin>new</origin>11215<capabilities>11216</capabilities>11217<parameters>11218<param id="property">11219<inbuf><char/></inbuf>11220<description>11221The key of the property, encoded as a11222<internallink id="mUTF">modified UTF-8</internallink> string.11223</description>11224</param>11225<param id="value_ptr">11226<inbuf>11227<char/>11228<nullok>11229do not set the value, but return <errorlink id="JVMTI_ERROR_NOT_AVAILABLE"/>11230if the property is not writeable11231</nullok>11232</inbuf>11233<description>11234The property value to set, encoded as a11235<internallink id="mUTF">modified UTF-8</internallink> string.11236</description>11237</param>11238</parameters>11239<errors>11240<error id="JVMTI_ERROR_NOT_AVAILABLE">11241This property is not available or is not writeable.11242</error>11243</errors>11244</function>1124511246</category>1124711248<category id="general" label="General">1124911250<intro>11251</intro>1125211253<function id="GetPhase" jkernel="yes" phase="any" num="133">11254<synopsis>Get Phase</synopsis>11255<description>11256Return the current phase of VM execution.11257The phases proceed in sequence:11258<constants id="jvmtiPhase" label="Phases of execution" kind="enum">11259<constant id="JVMTI_PHASE_ONLOAD" num="1">11260<code>OnLoad</code> phase: while in the11261<internallink id="onload"><code>Agent_OnLoad</code></internallink>11262or, for statically linked agents, the <internallink id="onload">11263<code>Agent_OnLoad_<agent-lib-name>11264</code></internallink> function.11265</constant>11266<constant id="JVMTI_PHASE_PRIMORDIAL" num="2">11267Primordial phase: between return from <code>Agent_OnLoad</code>11268or <code>Agent_OnLoad_<agent-lib-name></code> and the11269<code>VMStart</code> event.11270</constant>11271<constant id="JVMTI_PHASE_START" num="6">11272Start phase: when the <eventlink id="VMStart"><code>VMStart</code></eventlink> event11273is sent and until the <code>VMInit</code> event is sent.11274</constant>11275<constant id="JVMTI_PHASE_LIVE" num="4">11276Live phase: when the <eventlink id="VMInit"><code>VMInit</code></eventlink> event is sent11277and until the <eventlink id="VMDeath"></eventlink> event returns.11278</constant>11279<constant id="JVMTI_PHASE_DEAD" num="8">11280Dead phase: after the <eventlink id="VMDeath"></eventlink> event returns or after11281start-up failure.11282</constant>11283</constants>11284In the case of start-up failure the VM will proceed directly to the dead11285phase skipping intermediate phases and neither a <code>VMInit</code> nor11286<code>VMDeath</code> event will be sent.11287<p/>11288Most <jvmti/> functions operate only in the live phase.11289The following functions operate in either the <code>OnLoad</code> or live phases:11290<functionphaselist phase="onload"/>11291The following functions operate in only the <code>OnLoad</code> phase:11292<functionphaselist phase="onloadOnly"/>11293The following functions operate in the start or live phases:11294<functionphaselist phase="start"/>11295The following functions operate in any phase:11296<functionphaselist phase="any"/>11297JNI functions (except the Invocation API) must only be used in the start or live phases.11298<p/>11299Most <jvmti/> events are sent only in the live phase.11300The following events operate in others phases:11301<eventphaselist phase="start"/>11302<eventphaselist phase="any"/>11303</description>11304<origin>new</origin>11305<capabilities>11306</capabilities>11307<parameters>11308<param id="phase_ptr">11309<outptr><enum>jvmtiPhase</enum></outptr>11310<description>11311On return, points to the phase.11312</description>11313</param>11314</parameters>11315<errors>11316</errors>11317</function>1131811319<function id="DisposeEnvironment" jkernel="yes" phase="any" num="127">11320<synopsis>Dispose Environment</synopsis>11321<description>11322Shutdown a <jvmti/> connection created with JNI <code>GetEnv</code>11323(see <internallink id="environments"><jvmti/> Environments</internallink>).11324Dispose of any resources held by the environment.11325<issue>11326What resources are reclaimed? What is undone?11327Breakpoints,watchpoints removed?11328</issue>11329Threads suspended by this environment are not resumed by this call,11330this must be done explicitly by the agent.11331Memory allocated by this environment via calls to <jvmti/> functions11332is not released, this can be done explicitly by the agent11333by calling <functionlink id="Deallocate"/>.11334Raw monitors created by this environment are not destroyed,11335this can be done explicitly by the agent11336by calling <functionlink id="DestroyRawMonitor"/>.11337The state of threads waiting on raw monitors created by this environment11338are not affected.11339<p/>11340Any <functionlink id="SetNativeMethodPrefix">native method11341prefixes</functionlink> for this environment will be unset;11342the agent must remove any prefixed native methods before11343dispose is called.11344<p/>11345Any <internallink id="capability">capabilities</internallink>11346held by this environment are relinquished.11347<p/>11348Events enabled by this environment will no longer be sent, however11349event handlers currently running will continue to run. Caution must11350be exercised in the design of event handlers whose environment may11351be disposed and thus become invalid during their execution.11352<p/>11353This environment may not be used after this call.11354This call returns to the caller.11355</description>11356<origin>new</origin>11357<capabilities>11358</capabilities>11359<parameters>11360</parameters>11361<errors>11362</errors>11363</function>1136411365<function id="SetEnvironmentLocalStorage" jkernel="yes" phase="any" callbacksafe="safe" impl="innative notrace" num="148">11366<synopsis>Set Environment Local Storage</synopsis>11367<description>11368The VM stores a pointer value associated with each environment.11369This pointer value is called <i>environment-local storage</i>.11370This value is <code>NULL</code> unless set with this function.11371Agents can allocate memory in which they store environment specific11372information. By setting environment-local storage it can then be11373accessed with11374<functionlink id="GetEnvironmentLocalStorage"></functionlink>.11375<p/>11376Called by the agent to set the value of the <jvmti/>11377environment-local storage. <jvmti/> supplies to the agent a pointer-size11378environment-local storage that can be used to record per-environment11379information.11380</description>11381<origin>new</origin>11382<capabilities>11383</capabilities>11384<parameters>11385<param id="data">11386<inbuf>11387<void/>11388<nullok>value is set to <code>NULL</code></nullok>11389</inbuf>11390<description>11391The value to be entered into the environment-local storage.11392</description>11393</param>11394</parameters>11395<errors>11396</errors>11397</function>1139811399<function id="GetEnvironmentLocalStorage" jkernel="yes" phase="any" callbacksafe="safe" impl="innative notrace" num="147">11400<synopsis>Get Environment Local Storage</synopsis>11401<description>11402Called by the agent to get the value of the <jvmti/> environment-local11403storage.11404</description>11405<origin>new</origin>11406<capabilities>11407</capabilities>11408<parameters>11409<param id="data_ptr">11410<agentbuf><void/></agentbuf>11411<description>11412Pointer through which the value of the environment local11413storage is returned.11414If environment-local storage has not been set with11415<functionlink id="SetEnvironmentLocalStorage"></functionlink> returned11416pointer is <code>NULL</code>.11417</description>11418</param>11419</parameters>11420<errors>11421</errors>11422</function>1142311424<function id="GetVersionNumber" jkernel="yes" phase="any" num="88">11425<synopsis>Get Version Number</synopsis>11426<description>11427Return the <jvmti/> version via <code>version_ptr</code>.11428The return value is the version identifier.11429The version identifier includes major, minor and micro11430version as well as the interface type.11431<constants id="jvmtiVersionInterfaceTypes" label="Version Interface Types" kind="bits">11432<constant id="JVMTI_VERSION_INTERFACE_JNI" num="0x00000000">11433Value of <code>JVMTI_VERSION_MASK_INTERFACE_TYPE</code> for JNI.11434</constant>11435<constant id="JVMTI_VERSION_INTERFACE_JVMTI" num="0x30000000">11436Value of <code>JVMTI_VERSION_MASK_INTERFACE_TYPE</code> for <jvmti/>.11437</constant>11438</constants>11439<constants id="jvmtiVersionMasks" label="Version Masks" kind="bits">11440<constant id="JVMTI_VERSION_MASK_INTERFACE_TYPE" num="0x70000000">11441Mask to extract interface type.11442The value of the version returned by this function masked with11443<code>JVMTI_VERSION_MASK_INTERFACE_TYPE</code> is always11444<code>JVMTI_VERSION_INTERFACE_JVMTI</code>11445since this is a <jvmti/> function.11446</constant>11447<constant id="JVMTI_VERSION_MASK_MAJOR" num="0x0FFF0000">11448Mask to extract major version number.11449</constant>11450<constant id="JVMTI_VERSION_MASK_MINOR" num="0x0000FF00">11451Mask to extract minor version number.11452</constant>11453<constant id="JVMTI_VERSION_MASK_MICRO" num="0x000000FF">11454Mask to extract micro version number.11455</constant>11456</constants>11457<constants id="jvmtiVersionShifts" label="Version Shifts" kind="bits">11458<constant id="JVMTI_VERSION_SHIFT_MAJOR" num="16">11459Shift to extract major version number.11460</constant>11461<constant id="JVMTI_VERSION_SHIFT_MINOR" num="8">11462Shift to extract minor version number.11463</constant>11464<constant id="JVMTI_VERSION_SHIFT_MICRO" num="0">11465Shift to extract micro version number.11466</constant>11467</constants>11468</description>11469<origin>jvmdi</origin>11470<capabilities>11471</capabilities>11472<parameters>11473<param id="version_ptr">11474<outptr><jint/></outptr>11475<description>11476On return, points to the <jvmti/> version.11477</description>11478</param>11479</parameters>11480<errors>11481</errors>11482</function>114831148411485<function id="GetErrorName" phase="any" num="128">11486<synopsis>Get Error Name</synopsis>11487<description>11488Return the symbolic name for an11489<internallink id="ErrorSection">error code</internallink>.11490<p/>11491For example11492<code>GetErrorName(env, JVMTI_ERROR_NONE, &err_name)</code>11493would return in <code>err_name</code> the string11494<code>"JVMTI_ERROR_NONE"</code>.11495</description>11496<origin>new</origin>11497<capabilities>11498</capabilities>11499<parameters>11500<param id="error">11501<enum>jvmtiError</enum>11502<description>11503The error code.11504</description>11505</param>11506<param id="name_ptr">11507<allocbuf><char/></allocbuf>11508<description>11509On return, points to the error name.11510The name is encoded as a11511<internallink id="mUTF">modified UTF-8</internallink> string,11512but is restricted to the ASCII subset.11513</description>11514</param>11515</parameters>11516<errors>11517</errors>11518</function>1151911520<function id="SetVerboseFlag" phase="any" num="150">11521<synopsis>Set Verbose Flag</synopsis>11522<description>11523<constants id="jvmtiVerboseFlag" label="Verbose Flag Enumeration" kind="enum">11524<constant id="JVMTI_VERBOSE_OTHER" num="0">11525Verbose output other than the below.11526</constant>11527<constant id="JVMTI_VERBOSE_GC" num="1">11528Verbose garbage collector output, like that specified with <code>-verbose:gc</code>.11529</constant>11530<constant id="JVMTI_VERBOSE_CLASS" num="2">11531Verbose class loading output, like that specified with <code>-verbose:class</code>.11532</constant>11533<constant id="JVMTI_VERBOSE_JNI" num="4">11534Verbose JNI output, like that specified with <code>-verbose:jni</code>.11535</constant>11536</constants>11537Control verbose output.11538This is the output which typically is sent to <code>stderr</code>.11539</description>11540<origin>new</origin>11541<capabilities>11542</capabilities>11543<parameters>11544<param id="flag">11545<enum>jvmtiVerboseFlag</enum>11546<description>11547Which verbose flag to set.11548</description>11549</param>11550<param id="value">11551<jboolean/>11552<description>11553New value of the flag.11554</description>11555</param>11556</parameters>11557<errors>11558</errors>11559</function>115601156111562<function id="GetJLocationFormat" phase="any" num="129">11563<synopsis>Get JLocation Format</synopsis>11564<description>11565Although the greatest functionality is achieved with location information11566referencing the virtual machine bytecode index, the definition of11567<code>jlocation</code> has intentionally been left unconstrained to allow VM11568implementations that do not have this information.11569<p/>11570This function describes the representation of <code>jlocation</code> used in this VM.11571If the returned format is <datalink id="JVMTI_JLOCATION_JVMBCI"></datalink>,11572<code>jlocation</code>s can11573be used as in indices into the array returned by11574<functionlink id="GetBytecodes"></functionlink>.11575<constants id="jvmtiJlocationFormat" label="JLocation Format Enumeration" kind="enum">11576<constant id="JVMTI_JLOCATION_JVMBCI" num="1">11577<code>jlocation</code> values represent virtual machine11578bytecode indices--that is, offsets into the11579virtual machine code for a method.11580</constant>11581<constant id="JVMTI_JLOCATION_MACHINEPC" num="2">11582<code>jlocation</code> values represent native machine11583program counter values.11584</constant>11585<constant id="JVMTI_JLOCATION_OTHER" num="0">11586<code>jlocation</code> values have some other representation.11587</constant>11588</constants>11589</description>11590<origin>new</origin>11591<capabilities>11592</capabilities>11593<parameters>11594<param id="format_ptr">11595<outptr><enum>jvmtiJlocationFormat</enum></outptr>11596<description>11597On return, points to the format identifier for <code>jlocation</code> values.11598</description>11599</param>11600</parameters>11601<errors>11602</errors>11603</function>1160411605</category>1160611607<category id="heap_monitoring" label="Heap Monitoring">11608<function id="SetHeapSamplingInterval" phase="onload" num="156" since="11">11609<synopsis>Set Heap Sampling Interval</synopsis>11610<description>11611Generate a <eventlink id="SampledObjectAlloc"/> event when objects are allocated.11612Each thread keeps a counter of bytes allocated. The event will only be generated11613when that counter exceeds an average of <paramlink id="sampling_interval"></paramlink>11614since the last sample.11615<p/>11616Setting <paramlink id="sampling_interval"></paramlink> to 0 will cause an event to be11617generated by each allocation supported by the system once the new interval is taken into account.11618<p/>11619Note that updating the new sampling interval might take various number of allocations11620to provoke internal data structure updates. Therefore it is important to11621consider the sampling interval as an average. This includes the interval 0, where events11622might not be generated straight away for each allocation.11623</description>11624<origin>new</origin>11625<capabilities>11626<required id="can_generate_sampled_object_alloc_events"></required>11627</capabilities>11628<parameters>11629<param id="sampling_interval">11630<jint/>11631<description>11632The sampling interval in bytes. The sampler uses a statistical approach to11633generate an event, on average, once for every <paramlink id="sampling_interval"/> bytes of11634memory allocated by a given thread.11635<p/>11636Once the new sampling interval is taken into account, 0 as a sampling interval will generate11637a sample for every allocation.11638<p/>11639Note: The overhead of this feature is directly correlated with the sampling interval.11640A high sampling interval, such as 1024 bytes, will incur a high overhead.11641A lower interval, such as 1024KB, will have a much lower overhead. Sampling should only11642be used with an understanding that it may impact performance.11643</description>11644</param>11645</parameters>11646<errors>11647<error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">11648<paramlink id="sampling_interval"></paramlink> is less than zero.11649</error>11650</errors>11651</function>11652</category>1165311654</functionsection>1165511656<errorsection label="Error Reference">11657<intro>11658Every <jvmti/> function returns a <b><code>jvmtiError</code></b> error code.11659<p/>11660It is the responsibility of the agent to call <jvmti/> functions with11661valid parameters and in the proper context (calling thread is attached,11662phase is correct, etc.).11663Detecting some error conditions may be difficult, inefficient, or11664impossible for an implementation.11665The errors listed in11666<internallink id="reqerrors">Function Specific Required Errors</internallink>11667must be detected by the implementation.11668All other errors represent the recommended response to the error11669condition.11670</intro>1167111672<errorcategory id="universal-error" label="Universal Errors">11673<intro>11674The following errors may be returned by any function11675</intro>1167611677<errorid id="JVMTI_ERROR_NONE" num="0">11678No error has occurred. This is the error code that is returned11679on successful completion of the function.11680</errorid>11681<errorid id="JVMTI_ERROR_NULL_POINTER" num="100">11682Pointer is unexpectedly <code>NULL</code>.11683</errorid>11684<errorid id="JVMTI_ERROR_OUT_OF_MEMORY" num="110">11685The function attempted to allocate memory and no more memory was11686available for allocation.11687</errorid>11688<errorid id="JVMTI_ERROR_ACCESS_DENIED" num="111">11689The desired functionality has not been enabled in this virtual machine.11690</errorid>11691<errorid id="JVMTI_ERROR_UNATTACHED_THREAD" num="115">11692The thread being used to call this function is not attached11693to the virtual machine. Calls must be made from attached threads.11694See <code>AttachCurrentThread</code> in the JNI invocation API.11695</errorid>11696<errorid id="JVMTI_ERROR_INVALID_ENVIRONMENT" num="116">11697The <jvmti/> environment provided is no longer connected or is11698not an environment.11699</errorid>11700<errorid id="JVMTI_ERROR_WRONG_PHASE" num="112">11701The desired functionality is not available in the current11702<functionlink id="GetPhase">phase</functionlink>.11703Always returned if the virtual machine has completed running.11704</errorid>11705<errorid id="JVMTI_ERROR_INTERNAL" num="113">11706An unexpected internal error has occurred.11707</errorid>11708</errorcategory>1170911710<errorcategory id="reqerrors" label="Function Specific Required Errors">11711<intro>11712The following errors are returned by some <jvmti/> functions and must11713be returned by the implementation when the condition occurs.11714</intro>1171511716<errorid id="JVMTI_ERROR_INVALID_PRIORITY" num="12">11717Invalid priority.11718</errorid>11719<errorid id="JVMTI_ERROR_THREAD_NOT_SUSPENDED" num="13">11720Thread was not suspended.11721</errorid>11722<errorid id="JVMTI_ERROR_THREAD_SUSPENDED" num="14">11723Thread already suspended.11724</errorid>11725<errorid id="JVMTI_ERROR_THREAD_NOT_ALIVE" num="15">11726This operation requires the thread to be alive--that is,11727it must be started and not yet have died.11728</errorid>11729<errorid id="JVMTI_ERROR_CLASS_NOT_PREPARED" num="22">11730The class has been loaded but not yet prepared.11731</errorid>11732<errorid id="JVMTI_ERROR_NO_MORE_FRAMES" num="31">11733There are no Java programming language or JNI stack frames at the specified depth.11734</errorid>11735<errorid id="JVMTI_ERROR_OPAQUE_FRAME" num="32">11736Information about the frame is not available (e.g. for native frames).11737</errorid>11738<errorid id="JVMTI_ERROR_DUPLICATE" num="40">11739Item already set.11740</errorid>11741<errorid id="JVMTI_ERROR_NOT_FOUND" num="41">11742Desired element (e.g. field or breakpoint) not found11743</errorid>11744<errorid id="JVMTI_ERROR_NOT_MONITOR_OWNER" num="51">11745This thread doesn't own the raw monitor.11746</errorid>11747<errorid id="JVMTI_ERROR_INTERRUPT" num="52">11748The call has been interrupted before completion.11749</errorid>11750<errorid id="JVMTI_ERROR_UNMODIFIABLE_CLASS" num="79">11751The class cannot be modified.11752</errorid>11753<errorid id="JVMTI_ERROR_UNMODIFIABLE_MODULE" num="80">11754The module cannot be modified.11755</errorid>11756<errorid id="JVMTI_ERROR_NOT_AVAILABLE" num="98">11757The functionality is not available in this virtual machine.11758</errorid>11759<errorid id="JVMTI_ERROR_ABSENT_INFORMATION" num="101">11760The requested information is not available.11761</errorid>11762<errorid id="JVMTI_ERROR_INVALID_EVENT_TYPE" num="102">11763The specified event type ID is not recognized.11764</errorid>11765<errorid id="JVMTI_ERROR_NATIVE_METHOD" num="104">11766The requested information is not available for native method.11767</errorid>11768<errorid id="JVMTI_ERROR_CLASS_LOADER_UNSUPPORTED" num="106">11769The class loader does not support this operation.11770</errorid>11771</errorcategory>1177211773<errorcategory id="function-specific-errors" label="Function Specific Agent Errors">11774<intro>11775The following errors are returned by some <jvmti/> functions.11776They are returned in the event of invalid parameters passed by the11777agent or usage in an invalid context.11778An implementation is not required to detect these errors.11779</intro>1178011781<errorid id="JVMTI_ERROR_INVALID_THREAD" num="10">11782The passed thread is not a valid thread.11783</errorid>11784<errorid id="JVMTI_ERROR_INVALID_FIELDID" num="25">11785Invalid field.11786</errorid>11787<errorid id="JVMTI_ERROR_INVALID_MODULE" num="26">11788Invalid module.11789</errorid>11790<errorid id="JVMTI_ERROR_INVALID_METHODID" num="23">11791Invalid method.11792</errorid>11793<errorid id="JVMTI_ERROR_INVALID_LOCATION" num="24">11794Invalid location.11795</errorid>11796<errorid id="JVMTI_ERROR_INVALID_OBJECT" num="20">11797Invalid object.11798</errorid>11799<errorid id="JVMTI_ERROR_INVALID_CLASS" num="21">11800Invalid class.11801</errorid>11802<errorid id="JVMTI_ERROR_TYPE_MISMATCH" num="34">11803The variable is not an appropriate type for the function used.11804</errorid>11805<errorid id="JVMTI_ERROR_INVALID_SLOT" num="35">11806Invalid slot.11807</errorid>11808<errorid id="JVMTI_ERROR_MUST_POSSESS_CAPABILITY" num="99">11809The capability being used is false in this environment.11810</errorid>11811<errorid id="JVMTI_ERROR_INVALID_THREAD_GROUP" num="11">11812Thread group invalid.11813</errorid>11814<errorid id="JVMTI_ERROR_INVALID_MONITOR" num="50">11815Invalid raw monitor.11816</errorid>11817<errorid id="JVMTI_ERROR_ILLEGAL_ARGUMENT" num="103">11818Illegal argument.11819</errorid>11820<errorid id="JVMTI_ERROR_INVALID_TYPESTATE" num="65">11821The state of the thread has been modified, and is now inconsistent.11822</errorid>11823<errorid id="JVMTI_ERROR_UNSUPPORTED_VERSION" num="68">11824A new class file has a version number not supported by this VM.11825</errorid>11826<errorid id="JVMTI_ERROR_INVALID_CLASS_FORMAT" num="60">11827A new class file is malformed (the VM would return a <code>ClassFormatError</code>).11828</errorid>11829<errorid id="JVMTI_ERROR_CIRCULAR_CLASS_DEFINITION" num="61">11830The new class file definitions would lead to a circular11831definition (the VM would return a <code>ClassCircularityError</code>).11832</errorid>11833<errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_ADDED" num="63">11834A new class file would require adding a method.11835</errorid>11836<errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED" num="64">11837A new class version changes a field.11838</errorid>11839<errorid id="JVMTI_ERROR_FAILS_VERIFICATION" num="62">11840The class bytes fail verification.11841</errorid>11842<errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED" num="66">11843A direct superclass is different for the new class11844version, or the set of directly implemented11845interfaces is different.11846</errorid>11847<errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_DELETED" num="67">11848A new class version does not declare a method11849declared in the old class version.11850</errorid>11851<errorid id="JVMTI_ERROR_NAMES_DONT_MATCH" num="69">11852The class name defined in the new class file is11853different from the name in the old class object.11854</errorid>11855<errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED" num="70">11856A new class version has different modifiers.11857</errorid>11858<errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED" num="71">11859A method in the new class version has different modifiers11860than its counterpart in the old class version.11861</errorid>11862<errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_ATTRIBUTE_CHANGED" num="72">11863A new class version has unsupported differences in class attributes.11864</errorid>11865</errorcategory>11866</errorsection>1186711868<eventsection label="Events">11869<intro label="Handling Events" id="eventIntro">11870Agents can be informed of many events that occur in application11871programs.11872<p/>11873To handle events, designate a set of callback functions with11874<functionlink id="SetEventCallbacks"></functionlink>.11875For each event the corresponding callback function will be11876called.11877Arguments to the callback function provide additional11878information about the event.11879<p/>11880The callback function is usually called from within an application11881thread. The <jvmti/> implementation does not11882queue events in any way. This means11883that event callback functions must be written11884carefully. Here are some general guidelines. See11885the individual event descriptions for further11886suggestions.11887<p/>11888<ul>11889<li>Any exception thrown during the execution of an event callback can11890overwrite any current pending exception in the current application thread.11891Care must be taken to preserve a pending exception11892when an event callback makes a JNI call that might generate an exception.11893</li>11894<li>Event callback functions must be re-entrant. The <jvmti/> implementation does11895not queue events. If an agent needs to process events one at a time, it11896can use a raw monitor inside the11897event callback functions to serialize event processing.11898</li>11899<li>Event callback functions that execute JNI's FindClass function to load11900classes need to note that FindClass locates the class loader associated11901with the current native method. For the purposes of class loading, an11902event callback that includes a JNI environment as a parameter to the11903callback will treated as if it is a native call, where the native method11904is in the class of the event thread's current frame.11905</li>11906</ul>11907<p/>11908Some <jvmti/> events identify objects with JNI references.11909All references11910in <jvmti/> events are JNI local references and will become invalid11911after the event callback returns.11912Unless stated otherwise, memory referenced by pointers sent in event11913callbacks may not be referenced after the event callback returns.11914<p/>11915Except where stated otherwise, events are delivered on the thread11916that caused the event.11917Events are sent at the time they occur.11918The specification for each event includes the set of11919<functionlink id="GetPhase">phases</functionlink> in which it can be sent;11920if an event triggering activity occurs during another phase, no event11921is sent.11922<p/>11923A thread that generates an event does not change its execution status11924(for example, the event does not cause the thread to be suspended).11925If an agent wishes the event to result in suspension, then the agent11926is responsible for explicitly suspending the thread with11927<functionlink id="SuspendThread"></functionlink>.11928<p/>11929If an event is enabled in multiple environments, the event will be sent11930to each agent in the order that the environments were created.11931</intro>1193211933<intro label="Enabling Events" id="enablingevents">11934All events are initially disabled. In order to receive any11935event:11936<ul>11937<li>11938If the event requires a capability, that capability must11939be added with11940<functionlink id="AddCapabilities"></functionlink>.11941</li>11942<li>11943A callback for the event must be set with11944<functionlink id="SetEventCallbacks"></functionlink>.11945</li>11946<li>11947The event must be enabled with11948<functionlink id="SetEventNotificationMode"></functionlink>.11949</li>11950</ul>11951</intro>1195211953<intro label="Multiple Co-located Events" id="eventorder">11954In many situations it is possible for multiple events to occur11955at the same location in one thread. When this happens, all the events11956are reported through the event callbacks in the order specified in this section.11957<p/>11958If the current location is at the entry point of a method, the11959<eventlink id="MethodEntry"></eventlink> event is reported before11960any other event at the current location in the same thread.11961<p/>11962If an exception catch has been detected at the current location,11963either because it is the beginning of a catch clause or a native method11964that cleared a pending exception has returned, the11965<code>exceptionCatch</code> event is reported before11966any other event at the current location in the same thread.11967<p/>11968If a <code>singleStep</code> event or11969<code>breakpoint</code> event is triggered at the11970current location, the event is defined to occur11971immediately before the code at the current location is executed.11972These events are reported before any events which are triggered11973by the execution of code at the current location in the same11974thread (specifically:11975<code>exception</code>,11976<code>fieldAccess</code>, and11977<code>fieldModification</code>).11978If both a step and breakpoint event are triggered for the same thread and11979location, the step event is reported before the breakpoint event.11980<p/>11981If the current location is the exit point of a method (that is, the last11982location before returning to the caller), the11983<eventlink id="MethodExit"></eventlink> event and11984the <eventlink id="FramePop"></eventlink> event (if requested)11985are reported after all other events at the current location in the same11986thread. There is no specified ordering of these two events11987with respect to each other.11988<p/>11989Co-located events can be triggered during the processing of some other11990event by the agent at the same location in the same thread.11991If such an event, of type <i>y</i>, is triggered during the processing of11992an event of type <i>x</i>, and if <i>x</i>11993precedes <i>y</i> in the ordering specified above, the co-located event11994<i>y</i> is reported for the current thread and location. If <i>x</i> does not precede11995<i>y</i>, <i>y</i> is not reported for the current thread and location.11996For example, if a breakpoint is set at the current location11997during the processing of <eventlink id="SingleStep"></eventlink>,11998that breakpoint will be reported before the thread moves off the current11999location.12000<p/>The following events are never considered to be co-located with12001other events.12002<ul>12003<li><eventlink id="VMStart"></eventlink></li>12004<li><eventlink id="VMInit"></eventlink></li>12005<li><eventlink id="VMDeath"></eventlink></li>12006<li><eventlink id="ThreadStart"></eventlink></li>12007<li><eventlink id="ThreadEnd"></eventlink></li>12008<li><eventlink id="ClassLoad"></eventlink></li>12009<li><eventlink id="ClassPrepare"></eventlink></li>12010</ul>12011</intro>1201212013<intro label="Event Callbacks" id="jvmtiEventCallbacks">12014The event callback structure below is used to specify the handler function12015for events. It is set with the12016<functionlink id="SetEventCallbacks"></functionlink> function.12017</intro>1201812019<event label="Single Step"12020id="SingleStep" const="JVMTI_EVENT_SINGLE_STEP" filtered="thread" num="60">12021<description>12022Single step events allow the agent to trace thread execution12023at the finest granularity allowed by the VM. A single step event is12024generated whenever a thread reaches a new location.12025Typically, single step events represent the completion of one VM12026instruction as defined in <vmspec/>. However, some implementations12027may define locations differently. In any case the12028<code>method</code> and <code>location</code>12029parameters uniquely identify the current location and allow12030the mapping to source file and line number when that information is12031available.12032<p/>12033No single step events are generated from within native methods.12034</description>12035<origin>jvmdi</origin>12036<capabilities>12037<required id="can_generate_single_step_events"></required>12038</capabilities>12039<parameters>12040<param id="jni_env">12041<outptr>12042<struct>JNIEnv</struct>12043</outptr>12044<description>12045The JNI environment of the event (current) thread12046</description>12047</param>12048<param id="thread">12049<jthread/>12050<description>12051Thread about to execution a new instruction12052</description>12053</param>12054<param id="klass">12055<jclass method="method"/>12056<description>12057Class of the method about to execute a new instruction12058</description>12059</param>12060<param id="method">12061<jmethodID class="klass"/>12062<description>12063Method about to execute a new instruction12064</description>12065</param>12066<param id="location">12067<jlocation/>12068<description>12069Location of the new instruction12070</description>12071</param>12072</parameters>12073</event>1207412075<event label="Breakpoint"12076id="Breakpoint" const="JVMTI_EVENT_BREAKPOINT" filtered="thread" num="62">12077<description>12078Breakpoint events are generated whenever a thread reaches a location12079designated as a breakpoint with <functionlink id="SetBreakpoint"></functionlink>.12080The <code>method</code> and <code>location</code>12081parameters uniquely identify the current location and allow12082the mapping to source file and line number when that information is12083available.12084</description>12085<origin>jvmdi</origin>12086<capabilities>12087<required id="can_generate_breakpoint_events"></required>12088</capabilities>12089<parameters>12090<param id="jni_env">12091<outptr>12092<struct>JNIEnv</struct>12093</outptr>12094<description>12095The JNI environment of the event (current) thread.12096</description>12097</param>12098<param id="thread">12099<jthread/>12100<description>12101Thread that hit the breakpoint12102</description>12103</param>12104<param id="klass">12105<jclass method="method"/>12106<description>12107Class of the method that hit the breakpoint12108</description>12109</param>12110<param id="method">12111<jmethodID class="klass"/>12112<description>12113Method that hit the breakpoint12114</description>12115</param>12116<param id="location">12117<jlocation/>12118<description>12119location of the breakpoint12120</description>12121</param>12122</parameters>12123</event>1212412125<event label="Field Access"12126id="FieldAccess" const="JVMTI_EVENT_FIELD_ACCESS" filtered="thread" num="63">12127<description>12128Field access events are generated whenever a thread accesses12129a field that was designated as a watchpoint12130with <functionlink id="SetFieldAccessWatch"></functionlink>.12131The <code>method</code> and <code>location</code>12132parameters uniquely identify the current location and allow12133the mapping to source file and line number when that information is12134available.12135</description>12136<origin>jvmdi</origin>12137<capabilities>12138<required id="can_generate_field_access_events"></required>12139</capabilities>12140<parameters>12141<param id="jni_env">12142<outptr>12143<struct>JNIEnv</struct>12144</outptr>12145<description>12146The JNI environment of the event (current) thread12147</description>12148</param>12149<param id="thread">12150<jthread/>12151<description>12152Thread accessing the field12153</description>12154</param>12155<param id="klass">12156<jclass method="method"/>12157<description>12158Class of the method where the access is occurring12159</description>12160</param>12161<param id="method">12162<jmethodID class="klass"/>12163<description>12164Method where the access is occurring12165</description>12166</param>12167<param id="location">12168<jlocation/>12169<description>12170Location where the access is occurring12171</description>12172</param>12173<param id="field_klass">12174<jclass field="field"/>12175<description>12176Class of the field being accessed12177</description>12178</param>12179<param id="object">12180<jobject/>12181<description>12182Object with the field being accessed if the field is an12183instance field; <code>NULL</code> otherwise12184</description>12185</param>12186<param id="field">12187<jfieldID class="field_klass"/>12188<description>12189Field being accessed12190</description>12191</param>12192</parameters>12193</event>1219412195<event label="Field Modification"12196id="FieldModification" const="JVMTI_EVENT_FIELD_MODIFICATION" filtered="thread" num="64">12197<description>12198Field modification events are generated whenever a thread modifies12199a field that was designated as a watchpoint12200with <functionlink id="SetFieldModificationWatch"></functionlink>.12201The <code>method</code> and <code>location</code>12202parameters uniquely identify the current location and allow12203the mapping to source file and line number when that information is12204available.12205</description>12206<origin>jvmdi</origin>12207<capabilities>12208<required id="can_generate_field_modification_events"></required>12209</capabilities>12210<parameters>12211<param id="jni_env">12212<outptr>12213<struct>JNIEnv</struct>12214</outptr>12215<description>12216The JNI environment of the event (current) thread12217</description>12218</param>12219<param id="thread">12220<jthread/>12221<description>12222Thread modifying the field12223</description>12224</param>12225<param id="klass">12226<jclass method="method"/>12227<description>12228Class of the method where the modification is occurring12229</description>12230</param>12231<param id="method">12232<jmethodID class="klass"/>12233<description>12234Method where the modification is occurring12235</description>12236</param>12237<param id="location">12238<jlocation/>12239<description>12240Location where the modification is occurring12241</description>12242</param>12243<param id="field_klass">12244<jclass field="field"/>12245<description>12246Class of the field being modified12247</description>12248</param>12249<param id="object">12250<jobject/>12251<description>12252Object with the field being modified if the field is an12253instance field; <code>NULL</code> otherwise12254</description>12255</param>12256<param id="field">12257<jfieldID class="field_klass"/>12258<description>12259Field being modified12260</description>12261</param>12262<param id="signature_type">12263<char/>12264<description>12265Signature type of the new value12266</description>12267</param>12268<param id="new_value">12269<jvalue/>12270<description>12271The new value12272</description>12273</param>12274</parameters>12275</event>1227612277<event label="Frame Pop"12278id="FramePop" const="JVMTI_EVENT_FRAME_POP" filtered="thread" num="61">12279<description>12280Frame pop events are generated upon exit from a single method12281in a single frame as specified12282in a call to <functionlink id="NotifyFramePop"></functionlink>.12283This is true whether termination is caused by12284executing its return instruction12285or by throwing an exception to its caller12286(see <paramlink id="was_popped_by_exception"></paramlink>).12287However, frame pops caused by the <functionlink id="PopFrame"/>12288function are not reported.12289<p/>12290The location reported by <functionlink id="GetFrameLocation"></functionlink>12291for the depth 0 identifies the executable location in the returning method,12292immediately prior to the return.12293</description>12294<origin>jvmdi</origin>12295<capabilities>12296<required id="can_generate_frame_pop_events"></required>12297</capabilities>12298<parameters>12299<param id="jni_env">12300<outptr>12301<struct>JNIEnv</struct>12302</outptr>12303<description>12304The JNI environment of the event (current) thread12305</description>12306</param>12307<param id="thread">12308<jthread/>12309<description>12310Thread that is popping the frame12311</description>12312</param>12313<param id="klass">12314<jclass method="method"/>12315<description>12316Class of the method being popped12317</description>12318</param>12319<param id="method">12320<jmethodID class="klass"/>12321<description>12322Method being popped12323</description>12324</param>12325<param id="was_popped_by_exception">12326<jboolean/>12327<description>12328True if frame was popped by a thrown exception.12329False if method exited through its return instruction.12330</description>12331</param>12332</parameters>12333</event>1233412335<event label="Method Entry"12336id="MethodEntry" const="JVMTI_EVENT_METHOD_ENTRY" filtered="thread" num="65">12337<description>12338Method entry events are generated upon entry of Java12339programming language methods (including native methods).12340<p/>12341The location reported by <functionlink id="GetFrameLocation"></functionlink>12342for the depth 0 identifies the initial executable location in the method.12343<p/>12344Enabling method12345entry or exit events will significantly degrade performance on many platforms and is thus12346not advised for performance critical usage (such as profiling).12347<internallink id="bci">Bytecode instrumentation</internallink> should be12348used in these cases.12349</description>12350<origin>jvmdi</origin>12351<capabilities>12352<required id="can_generate_method_entry_events"></required>12353</capabilities>12354<parameters>12355<param id="jni_env">12356<outptr>12357<struct>JNIEnv</struct>12358</outptr>12359<description>12360The JNI environment of the event (current) thread12361</description>12362</param>12363<param id="thread">12364<jthread/>12365<description>12366Thread entering the method12367</description>12368</param>12369<param id="klass">12370<jclass method="method"/>12371<description>12372Class of the method being entered12373</description>12374</param>12375<param id="method">12376<jmethodID class="klass"/>12377<description>12378Method being entered12379</description>12380</param>12381</parameters>12382</event>1238312384<event label="Method Exit"12385id="MethodExit" const="JVMTI_EVENT_METHOD_EXIT" filtered="thread" num="66">12386<description>12387Method exit events are generated upon exit from Java12388programming language methods (including native methods).12389This is true whether termination is caused by12390executing its return instruction12391or by throwing an exception to its caller12392(see <paramlink id="was_popped_by_exception"></paramlink>).12393<p/>12394The location reported by <functionlink id="GetFrameLocation"></functionlink>12395for the depth 0 identifies the executable location in the returning method12396immediately prior to the return.12397<p/>12398Enabling method12399entry or exit events will significantly degrade performance on many platforms and is thus12400not advised for performance critical usage (such as profiling).12401<internallink id="bci">Bytecode instrumentation</internallink> should be12402used in these cases.12403</description>12404<origin>jvmdi</origin>12405<capabilities>12406<required id="can_generate_method_exit_events"></required>12407</capabilities>12408<parameters>12409<param id="jni_env">12410<outptr>12411<struct>JNIEnv</struct>12412</outptr>12413<description>12414The JNI environment of the event (current) thread12415</description>12416</param>12417<param id="thread">12418<jthread/>12419<description>12420Thread exiting the method12421</description>12422</param>12423<param id="klass">12424<jclass method="method"/>12425<description>12426Class of the method being exited12427</description>12428</param>12429<param id="method">12430<jmethodID class="klass"/>12431<description>12432Method being exited12433</description>12434</param>12435<param id="was_popped_by_exception">12436<jboolean/>12437<description>12438True if frame was popped by a thrown exception.12439False if method exited through its return instruction.12440</description>12441</param>12442<param id="return_value">12443<jvalue/>12444<description>12445The return value of the method being exited.12446Undefined and should not be used if12447<paramlink id="was_popped_by_exception"></paramlink>12448is true.12449</description>12450</param>12451</parameters>12452</event>1245312454<event label="Native Method Bind" phase="any"12455id="NativeMethodBind" const="JVMTI_EVENT_NATIVE_METHOD_BIND" num="67">12456<description>12457A Native Method Bind event is sent when a VM binds a12458Java programming language native method12459to the address of a function that implements the native method.12460This will occur when the native method is called for the first time12461and also occurs when the JNI function <code>RegisterNatives</code> is called.12462This event allows the bind to be redirected to an agent-specified12463proxy function.12464This event is not sent when the native method is unbound.12465Typically, this proxy function will need to be specific to a12466particular method or, to handle the general case, automatically12467generated assembly code, since after instrumentation code is12468executed the function at the original binding12469address will usually be invoked.12470The original binding can be restored or the redirection changed12471by use of the JNI function <code>RegisterNatives</code>.12472Some events may be sent during the primordial phase, JNI and12473most of <jvmti/> cannot be used at this time but the method and12474address can be saved for use later.12475</description>12476<origin>new</origin>12477<capabilities>12478<required id="can_generate_native_method_bind_events"></required>12479</capabilities>12480<parameters>12481<param id="jni_env">12482<outptr>12483<struct>JNIEnv</struct>12484</outptr>12485<description>12486The JNI environment of the event (current) thread12487Will be <code>NULL</code> if sent during the primordial12488<functionlink id="GetPhase">phase</functionlink>.12489</description>12490</param>12491<param id="thread">12492<jthread/>12493<description>12494Thread requesting the bind12495</description>12496</param>12497<param id="klass">12498<jclass method="method"/>12499<description>12500Class of the method being bound12501</description>12502</param>12503<param id="method">12504<jmethodID class="klass"/>12505<description>12506Native method being bound12507</description>12508</param>12509<param id="address">12510<outptr><void/></outptr>12511<description>12512The address the VM is about to bind to--that is, the12513address of the implementation of the native method12514</description>12515</param>12516<param id="new_address_ptr">12517<agentbuf><void/></agentbuf>12518<description>12519if the referenced address is changed (that is, if12520<code>*new_address_ptr</code> is set), the binding12521will instead be made to the supplied address.12522</description>12523</param>12524</parameters>12525</event>1252612527<event label="Exception"12528id="Exception" const="JVMTI_EVENT_EXCEPTION" filtered="thread" num="58">12529<description>12530Exception events are generated whenever an exception is first detected12531in a Java programming language method.12532Where "exception" means any <code>java.lang.Throwable</code>.12533The exception may have been thrown by a Java programming language or native12534method, but in the case of native methods, the event is not generated12535until the exception is first seen by a Java programming language method. If an exception is12536set and cleared in a native method (and thus is never visible to Java programming language code),12537no exception event is generated.12538<p/>12539The <code>method</code> and <code>location</code>12540parameters uniquely identify the current location12541(where the exception was detected) and allow12542the mapping to source file and line number when that information is12543available. The <code>exception</code> field identifies the thrown12544exception object. The <code>catch_method</code>12545and <code>catch_location</code> identify the location of the catch clause,12546if any, that handles the thrown exception. If there is no such catch clause,12547each field is set to 0. There is no guarantee that the thread will ever12548reach this catch clause. If there are native methods on the call stack12549between the throw location and the catch clause, the exception may12550be reset by one of those native methods.12551Similarly, exceptions that are reported as uncaught (<code>catch_klass</code>12552et al. set to 0) may in fact be caught by native code.12553Agents can check for these occurrences by monitoring12554<eventlink id="ExceptionCatch"></eventlink> events.12555Note that finally clauses are implemented as catch and re-throw. Therefore they12556will be reported in the catch location.12557</description>12558<origin>jvmdi</origin>12559<capabilities>12560<required id="can_generate_exception_events"></required>12561</capabilities>12562<parameters>12563<param id="jni_env">12564<outptr>12565<struct>JNIEnv</struct>12566</outptr>12567<description>12568The JNI environment of the event (current) thread12569</description>12570</param>12571<param id="thread">12572<jthread/>12573<description>12574Thread generating the exception12575</description>12576</param>12577<param id="klass">12578<jclass method="method"/>12579<description>12580Class generating the exception12581</description>12582</param>12583<param id="method">12584<jmethodID class="klass"/>12585<description>12586Method generating the exception12587</description>12588</param>12589<param id="location">12590<jlocation/>12591<description>12592Location where exception occurred12593</description>12594</param>12595<param id="exception">12596<jobject/>12597<description>12598The exception being thrown12599</description>12600</param>12601<param id="catch_klass">12602<jclass method="catch_method"/>12603<description>12604Class that will catch the exception, or <code>NULL</code> if no known catch12605</description>12606</param>12607<param id="catch_method">12608<jmethodID class="catch_klass"/>12609<description>12610Method that will catch the exception, or <code>NULL</code> if no known catch12611</description>12612</param>12613<param id="catch_location">12614<jlocation/>12615<description>12616location which will catch the exception or zero if no known catch12617</description>12618</param>12619</parameters>12620</event>1262112622<event label="Exception Catch"12623id="ExceptionCatch" const="JVMTI_EVENT_EXCEPTION_CATCH" filtered="thread" num="59">12624<description>12625Exception catch events are generated whenever a thrown exception is caught.12626Where "exception" means any <code>java.lang.Throwable</code>.12627If the exception is caught in a Java programming language method, the event is generated12628when the catch clause is reached. If the exception is caught in a native12629method, the event is generated as soon as control is returned to a Java programming language12630method. Exception catch events are generated for any exception for which12631a throw was detected in a Java programming language method.12632Note that finally clauses are implemented as catch and re-throw. Therefore they12633will generate exception catch events.12634<p/>12635The <code>method</code> and <code>location</code>12636parameters uniquely identify the current location12637and allow the mapping to source file and line number when that information is12638available. For exceptions caught in a Java programming language method, the12639<code>exception</code> object identifies the exception object. Exceptions12640caught in native methods are not necessarily available by the time the12641exception catch is reported, so the <code>exception</code> field is set12642to <code>NULL</code>.12643</description>12644<origin>jvmdi</origin>12645<capabilities>12646<required id="can_generate_exception_events"></required>12647</capabilities>12648<parameters>12649<param id="jni_env">12650<outptr>12651<struct>JNIEnv</struct>12652</outptr>12653<description>12654The JNI environment of the event (current) thread12655</description>12656</param>12657<param id="thread">12658<jthread/>12659<description>12660Thread catching the exception12661</description>12662</param>12663<param id="klass">12664<jclass method="method"/>12665<description>12666Class catching the exception12667</description>12668</param>12669<param id="method">12670<jmethodID class="klass"/>12671<description>12672Method catching the exception12673</description>12674</param>12675<param id="location">12676<jlocation/>12677<description>12678Location where exception is being caught12679</description>12680</param>12681<param id="exception">12682<jobject/>12683<description>12684Exception being caught12685</description>12686</param>12687</parameters>12688</event>1268912690<event label="Thread Start"12691id="ThreadStart" const="JVMTI_EVENT_THREAD_START" num="52" phase="start">12692<description>12693Thread start events are generated by a new thread before its initial12694method executes.12695<p/>12696A thread may be listed in the array returned by12697<functionlink id="GetAllThreads"></functionlink>12698before its thread start event is generated.12699It is possible for other events to be generated12700on a thread before its thread start event.12701<p/>12702The event is sent on the newly started <paramlink id="thread"></paramlink>.12703</description>12704<origin>jvmdi</origin>12705<capabilities>12706</capabilities>12707<parameters>12708<param id="jni_env">12709<outptr>12710<struct>JNIEnv</struct>12711</outptr>12712<description>12713The JNI environment of the event (current) thread.12714</description>12715</param>12716<param id="thread">12717<jthread/>12718<description>12719Thread starting12720</description>12721</param>12722</parameters>12723</event>1272412725<event label="Thread End"12726id="ThreadEnd" const="JVMTI_EVENT_THREAD_END" filtered="thread" num="53" phase="start">12727<description>12728Thread end events are generated by a terminating thread12729after its initial method has finished execution.12730<p/>12731A thread may be listed in the array returned by12732<functionlink id="GetAllThreads"></functionlink>12733after its thread end event is generated.12734No events are generated on a thread12735after its thread end event.12736<p/>12737The event is sent on the dying <paramlink id="thread"></paramlink>.12738</description>12739<origin>jvmdi</origin>12740<capabilities>12741</capabilities>12742<parameters>12743<param id="jni_env">12744<outptr>12745<struct>JNIEnv</struct>12746</outptr>12747<description>12748The JNI environment of the event (current) thread.12749</description>12750</param>12751<param id="thread">12752<jthread/>12753<description>12754Thread ending12755</description>12756</param>12757</parameters>12758</event>1275912760<event label="Class Load"12761id="ClassLoad" const="JVMTI_EVENT_CLASS_LOAD" filtered="thread" phase="start" num="55">12762<description>12763A class load event is generated12764<functionlink id="GetLoadedClasses">when a class or interface is created.</functionlink>.12765<p/>12766Array class creation does not generate a class load event.12767The creation of a primitive class (for example, java.lang.Integer.TYPE)12768does not generate a class load event.12769<p/>12770The order of class load events generated by a particular thread is guaranteed12771to match the order of class loading within that thread.12772<p/>12773This event is sent at an early stage in loading the class. As12774a result the class should be used carefully. Note, for example,12775that methods and fields are not yet loaded, so queries for methods,12776fields, subclasses, and so on will not give correct results.12777See "Loading of Classes and Interfaces" in the <i>Java Language12778Specification</i>. For most12779purposes the <eventlink id="ClassPrepare"></eventlink> event will12780be more useful.12781</description>12782<origin>jvmdi</origin>12783<capabilities>12784</capabilities>12785<parameters>12786<param id="jni_env">12787<outptr>12788<struct>JNIEnv</struct>12789</outptr>12790<description>12791The JNI environment of the event (current) thread12792</description>12793</param>12794<param id="thread">12795<jthread/>12796<description>12797Thread loading the class12798</description>12799</param>12800<param id="klass">12801<jclass/>12802<description>12803Class being loaded12804</description>12805</param>12806</parameters>12807</event>1280812809<elide>12810<event label="Class Unload"12811id="ClassUnload" const="JVMTI_EVENT_CLASS_UNLOAD" num="57">12812<description>12813A class unload event is generated when the class is about to be unloaded.12814Class unload events take place during garbage collection and must be12815handled extremely carefully. The garbage collector holds many locks12816and has suspended all other threads, so the event handler cannot depend12817on the ability to acquire any locks. The class unload event handler should12818do as little as possible, perhaps by queuing information to be processed12819later. In particular, the <code>jclass</code> should be used only in12820the JNI function <code>isSameObject</code> or in the following <jvmti/> functions:12821<ul>12822<li><functionlink id="GetClassSignature"></functionlink></li>12823<li><functionlink id="GetSourceFileName"></functionlink></li>12824<li><functionlink id="IsInterface"></functionlink></li>12825<li><functionlink id="IsArrayClass"></functionlink></li>12826</ul>12827</description>12828<origin>jvmdi</origin>12829<capabilities>12830</capabilities>12831<parameters>12832<param id="jni_env">12833<outptr>12834<struct>JNIEnv</struct>12835</outptr>12836<description>12837The JNI environment of the event (current) thread12838</description>12839</param>12840<param id="thread">12841<jthread/>12842<description>12843Thread generating the class unload12844</description>12845</param>12846<param id="klass">12847<jclass/>12848<description>12849Class being unloaded12850</description>12851</param>12852</parameters>12853</event>12854</elide>1285512856<event label="Class Prepare"12857id="ClassPrepare" const="JVMTI_EVENT_CLASS_PREPARE" filtered="thread" phase="start" num="56">12858<description>12859A class prepare event is generated when class preparation is complete.12860At this point, class fields, methods, and implemented interfaces are12861available, and no code from the class has been executed. Since array12862classes never have fields or methods, class prepare events are not12863generated for them. Class prepare events are not generated for12864primitive classes (for example, <code>java.lang.Integer.TYPE</code>).12865</description>12866<origin>jvmdi</origin>12867<capabilities>12868</capabilities>12869<parameters>12870<param id="jni_env">12871<outptr>12872<struct>JNIEnv</struct>12873</outptr>12874<description>12875The JNI environment of the event (current) thread12876</description>12877</param>12878<param id="thread">12879<jthread/>12880<description>12881Thread generating the class prepare12882</description>12883</param>12884<param id="klass">12885<jclass/>12886<description>12887Class being prepared12888</description>12889</param>12890</parameters>12891</event>1289212893<event label="Class File Load Hook" phase="any"12894id="ClassFileLoadHook" const="JVMTI_EVENT_CLASS_FILE_LOAD_HOOK" num="54">12895<description>12896This event is sent when the VM obtains class file data,12897but before it constructs12898the in-memory representation for that class.12899This event is also sent when the class is being modified by the12900<functionlink id="RetransformClasses"/> function or12901the <functionlink id="RedefineClasses"/> function,12902called in any <jvmti/> environment.12903The agent can instrument12904the existing class file data sent by the VM to include profiling/debugging hooks.12905See the description of12906<internallink id="bci">bytecode instrumentation</internallink>12907for usage information.12908<p/>12909When the capabilities12910<internallink id="jvmtiCapabilities.can_generate_early_class_hook_events">12911<code>can_generate_early_class_hook_events</code></internallink> and12912<internallink id="jvmtiCapabilities.can_generate_all_class_hook_events">12913<code>can_generate_all_class_hook_events</code></internallink>12914are enabled then this event may be sent in the primordial phase.12915Otherwise, this event may be sent before the VM is initialized (the start12916<functionlink id="GetPhase">phase</functionlink>).12917Some classes might not be compatible12918with the function (eg. ROMized classes or implementation defined classes) and this event will12919not be generated for these classes.12920<p/>12921The agent must allocate the space for the modified12922class file data buffer12923using the memory allocation function12924<functionlink id="Allocate"></functionlink> because the12925VM is responsible for freeing the new class file data buffer12926using <functionlink id="Deallocate"></functionlink>.12927<p/>12928If the agent wishes to modify the class file, it must set12929<code>new_class_data</code> to point12930to the newly instrumented class file data buffer and set12931<code>new_class_data_len</code> to the length of that12932buffer before returning12933from this call. If no modification is desired, the agent simply12934does not set <code>new_class_data</code>. If multiple agents12935have enabled this event the results are chained. That is, if12936<code>new_class_data</code> has been set, it becomes the12937<code>class_data</code> for the next agent.12938<p/>12939When handling a class load in the live phase, then the12940<functionlink id="GetNamedModule"></functionlink>12941function can be used to map class loader and a package name to a module.12942When a class is being redefined or retransformed then12943<code>class_being_redefined</code> is non <code>NULL</code> and so12944the JNI <code>GetModule</code> function can also be used12945to obtain the Module.12946<p/>12947The order that this event is sent to each environment differs12948from other events.12949This event is sent to environments in the following order:12950<ul>12951<li><fieldlink id="can_retransform_classes"12952struct="jvmtiCapabilities">retransformation12953incapable</fieldlink>12954environments, in the12955order in which they were created12956</li>12957<li><fieldlink id="can_retransform_classes"12958struct="jvmtiCapabilities">retransformation12959capable</fieldlink>12960environments, in the12961order in which they were created12962</li>12963</ul>12964When triggered by <functionlink id="RetransformClasses"/>,12965this event is sent only to <fieldlink id="can_retransform_classes"12966struct="jvmtiCapabilities">retransformation12967capable</fieldlink>12968environments.12969</description>12970<origin>jvmpi</origin>12971<capabilities>12972<capability id="can_generate_all_class_hook_events"></capability>12973<capability id="can_generate_early_class_hook_events"></capability>12974</capabilities>12975<parameters>12976<param id="jni_env">12977<outptr>12978<struct>JNIEnv</struct>12979</outptr>12980<description>12981The JNI environment of the event (current) thread.12982</description>12983</param>12984<param id="class_being_redefined">12985<jclass/>12986<description>12987The class being12988<functionlink id="RedefineClasses">redefined</functionlink> or12989<functionlink id="RetransformClasses">retransformed</functionlink>.12990<code>NULL</code> if sent by class load.12991</description>12992</param>12993<param id="loader">12994<jobject/>12995<description>12996The class loader loading the class.12997<code>NULL</code> if the bootstrap class loader.12998</description>12999</param>13000<param id="name">13001<vmbuf><char/></vmbuf>13002<description>13003Name of class being loaded as a VM internal qualified name13004(for example, "java/util/List"), encoded as a13005<internallink id="mUTF">modified UTF-8</internallink> string.13006Note: if the class is defined with a <code>NULL</code> name or13007without a name specified, <code>name</code> will be <code>NULL</code>.13008</description>13009</param>13010<param id="protection_domain">13011<jobject/>13012<description>13013The <code>ProtectionDomain</code> of the class.13014</description>13015</param>13016<param id="class_data_len">13017<jint/>13018<description>13019Length of current class file data buffer.13020</description>13021</param>13022<param id="class_data">13023<vmbuf><uchar/></vmbuf>13024<description>13025Pointer to the current class file data buffer.13026</description>13027</param>13028<param id="new_class_data_len">13029<outptr><jint/></outptr>13030<description>13031Pointer to the length of the new class file data buffer.13032</description>13033</param>13034<param id="new_class_data">13035<agentbuf incount="new_class_data_len"><uchar/></agentbuf>13036<description>13037Pointer to the pointer to the instrumented class file data buffer.13038</description>13039</param>13040</parameters>13041</event>1304213043<event label="VM Start Event"13044id="VMStart" const="JVMTI_EVENT_VM_START" num="57" phase="start">13045<description>13046The VM start event signals the start of the VM.13047At this time JNI is live but the VM is not yet fully initialized.13048Once this event is generated, the agent is free to call any JNI function.13049This event signals the beginning of the start phase,13050<jvmti/> functions permitted in the start phase may be called.13051<p/>13052The timing of this event may depend on whether the agent has added the13053<internallink id="jvmtiCapabilities.can_generate_early_vmstart">13054<code>can_generate_early_vmstart</code></internallink> capability or not.13055If the capability has been added then the VM posts the event as early13056as possible. The VM is capable of executing bytecode but it may not have13057initialized to the point where it can load classes in modules other than13058<code>java.base</code>, or even arbitrary classes in <code>java.base</code>.13059Agents that do load-time instrumentation in this13060phase must take great care when instrumenting code that potentially13061executes in this phase. Extreme care should also be taken with JNI13062<code>FindClass</code> as it may not be possible to load classes and attempts13063to do so may result in unpredictable behavior, maybe even stability issues13064on some VM implementations.13065If the capability has not been added then the VM delays posting this13066event until it is capable of loading classes in modules other than13067<code>java.base</code> or the VM has completed its initialization.13068Agents that create more than one JVM TI environment, where the13069capability is added to some but not all environments, may observe the13070start phase beginning earlier in the JVM TI environments that possess13071the capability.13072<p/>13073In the case of VM start-up failure, this event will not be sent.13074</description>13075<origin>jvmdi</origin>13076<capabilities>13077</capabilities>13078<parameters>13079<param id="jni_env">13080<outptr>13081<struct>JNIEnv</struct>13082</outptr>13083<description>13084The JNI environment of the event (current) thread.13085</description>13086</param>13087</parameters>13088</event>1308913090<event label="VM Initialization Event"13091id="VMInit" const="JVMTI_EVENT_VM_INIT" num="50">13092<description>13093The VM initialization event signals the completion of VM initialization. Once13094this event is generated, the agent is free to call any JNI or <jvmti/>13095function. The VM initialization event can be preceded by or can be concurrent13096with other events, but13097the preceding events should be handled carefully, if at all, because the13098VM has not completed its initialization. The thread start event for the13099main application thread is guaranteed not to occur until after the13100handler for the VM initialization event returns.13101<p/>13102In the case of VM start-up failure, this event will not be sent.13103</description>13104<origin>jvmdi</origin>13105<capabilities>13106</capabilities>13107<parameters>13108<param id="jni_env">13109<outptr>13110<struct>JNIEnv</struct>13111</outptr>13112<description>13113The JNI environment of the event (current) thread.13114</description>13115</param>13116<param id="thread">13117<jthread/>13118<description>13119The initial thread13120</description>13121</param>13122</parameters>13123</event>1312413125<event label="VM Death Event"13126id="VMDeath" const="JVMTI_EVENT_VM_DEATH" num="51">13127<description>13128The VM death event notifies the agent of the termination of the VM.13129No events will occur after the VMDeath event.13130<p/>13131In the case of VM start-up failure, this event will not be sent.13132Note that <internallink id="onunload">Agent_OnUnload</internallink>13133will still be called in these cases.13134</description>13135<origin>jvmdi</origin>13136<capabilities>13137</capabilities>13138<parameters>13139<param id="jni_env">13140<outptr>13141<struct>JNIEnv</struct>13142</outptr>13143<description>13144The JNI environment of the event (current) thread13145</description>13146</param>13147</parameters>13148</event>1314913150<event label="Compiled Method Load" phase="start"13151id="CompiledMethodLoad" const="JVMTI_EVENT_COMPILED_METHOD_LOAD" num="68">13152<description>13153Sent when a method is compiled and loaded into memory by the VM.13154If it is unloaded, the <eventlink id="CompiledMethodUnload"/> event is sent.13155If it is moved, the <eventlink id="CompiledMethodUnload"/> event is sent,13156followed by a new <code>CompiledMethodLoad</code> event.13157Note that a single method may have multiple compiled forms, and that13158this event will be sent for each form.13159Note also that several methods may be inlined into a single13160address range, and that this event will be sent for each method.13161<p/>13162These events can be sent after their initial occurrence with13163<functionlink id="GenerateEvents"></functionlink>.13164</description>13165<origin>jvmpi</origin>13166<typedef id="jvmtiAddrLocationMap" label="Native address to location entry">13167<field id="start_address">13168<vmbuf><void/></vmbuf>13169<description>13170Starting native address of code corresponding to a location13171</description>13172</field>13173<field id="location">13174<jlocation/>13175<description>13176Corresponding location. See13177<functionlink id="GetJLocationFormat"></functionlink>13178for the meaning of location.13179</description>13180</field>13181</typedef>13182<capabilities>13183<required id="can_generate_compiled_method_load_events"></required>13184</capabilities>13185<parameters>13186<param id="klass">13187<jclass method="method"/>13188<description>13189Class of the method being compiled and loaded13190</description>13191</param>13192<param id="method">13193<jmethodID class="klass"/>13194<description>13195Method being compiled and loaded13196</description>13197</param>13198<param id="code_size">13199<jint/>13200<description>13201Size of compiled code13202</description>13203</param>13204<param id="code_addr">13205<vmbuf><void/></vmbuf>13206<description>13207Address where compiled method code is loaded13208</description>13209</param>13210<param id="map_length">13211<jint/>13212<description>13213Number of <typelink id="jvmtiAddrLocationMap"></typelink>13214entries in the address map.13215Zero if mapping information cannot be supplied.13216</description>13217</param>13218<param id="map">13219<vmbuf><struct>jvmtiAddrLocationMap</struct></vmbuf>13220<description>13221Map from native addresses to location.13222The native address range of each entry is from13223<fieldlink id="start_address" struct="jvmtiAddrLocationMap"></fieldlink>13224to <code>start_address-1</code> of the next entry.13225<code>NULL</code> if mapping information cannot be supplied.13226</description>13227</param>13228<param id="compile_info">13229<vmbuf><void/></vmbuf>13230<description>13231VM-specific compilation information.13232The referenced compile information is managed by the VM13233and must not depend on the agent for collection.13234A VM implementation defines the content and lifetime13235of the information.13236</description>13237</param>13238</parameters>13239</event>1324013241<event label="Compiled Method Unload" phase="start"13242id="CompiledMethodUnload" const="JVMTI_EVENT_COMPILED_METHOD_UNLOAD" num="69">13243<description>13244Sent when a compiled method is unloaded from memory.13245This event might not be sent on the thread which performed the unload.13246This event may be sent sometime after the unload occurs, but13247will be sent before the memory is reused13248by a newly generated compiled method. This event may be sent after13249the class is unloaded.13250</description>13251<origin>jvmpi</origin>13252<capabilities>13253<required id="can_generate_compiled_method_load_events"></required>13254</capabilities>13255<parameters>13256<param id="klass">13257<jclass method="method"/>13258<description>13259Class of the compiled method being unloaded.13260</description>13261</param>13262<param id="method">13263<jmethodID class="klass"/>13264<description>13265Compiled method being unloaded.13266For identification of the compiled method only -- the class13267may be unloaded and therefore the method should not be used13268as an argument to further JNI or <jvmti/> functions.13269</description>13270</param>13271<param id="code_addr">13272<vmbuf><void/></vmbuf>13273<description>13274Address where compiled method code was loaded.13275For identification of the compiled method only --13276the space may have been reclaimed.13277</description>13278</param>13279</parameters>13280</event>1328113282<event label="Dynamic Code Generated" phase="any"13283id="DynamicCodeGenerated" const="JVMTI_EVENT_DYNAMIC_CODE_GENERATED" num="70">13284<description>13285Sent when a component of the virtual machine is generated dynamically.13286This does not correspond to Java programming language code that is13287compiled--see <eventlink id="CompiledMethodLoad"></eventlink>.13288This is for native code--for example, an interpreter that is generated13289differently depending on command-line options.13290<p/>13291Note that this event has no controlling capability.13292If a VM cannot generate these events, it simply does not send any.13293<p/>13294These events can be sent after their initial occurrence with13295<functionlink id="GenerateEvents"></functionlink>.13296</description>13297<origin>jvmpi</origin>13298<capabilities>13299</capabilities>13300<parameters>13301<param id="name">13302<vmbuf><char/></vmbuf>13303<description>13304Name of the code, encoded as a13305<internallink id="mUTF">modified UTF-8</internallink> string.13306Intended for display to an end-user.13307The name might not be unique.13308</description>13309</param>13310<param id="address">13311<vmbuf><void/></vmbuf>13312<description>13313Native address of the code13314</description>13315</param>13316<param id="length">13317<jint/>13318<description>13319Length in bytes of the code13320</description>13321</param>13322</parameters>13323</event>1332413325<event label="Data Dump Request"13326id="DataDumpRequest" const="JVMTI_EVENT_DATA_DUMP_REQUEST" num="71">13327<description>13328Sent by the VM to request the agent to dump its data. This13329is just a hint and the agent need not react to this event.13330This is useful for processing command-line signals from users. For13331example, in the Java 2 SDK a CTRL-Break on Win32 and a CTRL-\ on Linux13332causes the VM to send this event to the agent.13333</description>13334<origin>jvmpi</origin>13335<capabilities>13336</capabilities>13337<parameters>13338</parameters>13339</event>1334013341<event label="Monitor Contended Enter"13342id="MonitorContendedEnter" const="JVMTI_EVENT_MONITOR_CONTENDED_ENTER" filtered="thread" num="75">13343<description>13344Sent when a thread is attempting to enter a Java programming language13345monitor already acquired by another thread.13346</description>13347<origin>jvmpi</origin>13348<capabilities>13349<required id="can_generate_monitor_events"></required>13350</capabilities>13351<parameters>13352<param id="jni_env">13353<outptr>13354<struct>JNIEnv</struct>13355</outptr>13356<description>13357The JNI environment of the event (current) thread13358</description>13359</param>13360<param id="thread">13361<jthread/>13362<description>13363JNI local reference to the thread13364attempting to enter the monitor13365</description>13366</param>13367<param id="object">13368<jobject/>13369<description>13370JNI local reference to the monitor13371</description>13372</param>13373</parameters>13374</event>1337513376<event label="Monitor Contended Entered"13377id="MonitorContendedEntered" const="JVMTI_EVENT_MONITOR_CONTENDED_ENTERED" filtered="thread" num="76">13378<description>13379Sent when a thread enters a Java programming language13380monitor after waiting for it to be released by another thread.13381</description>13382<origin>jvmpi</origin>13383<capabilities>13384<required id="can_generate_monitor_events"></required>13385</capabilities>13386<parameters>13387<param id="jni_env">13388<outptr>13389<struct>JNIEnv</struct>13390</outptr>13391<description>13392The JNI environment of the event (current) thread13393</description>13394</param>13395<param id="thread">13396<jthread/>13397<description>13398JNI local reference to the thread entering13399the monitor13400</description>13401</param>13402<param id="object">13403<jobject/>13404<description>13405JNI local reference to the monitor13406</description>13407</param>13408</parameters>13409</event>1341013411<event label="Monitor Wait"13412id="MonitorWait" const="JVMTI_EVENT_MONITOR_WAIT" filtered="thread" num="73">13413<description>13414Sent when a thread is about to wait on an object.13415</description>13416<origin>jvmpi</origin>13417<capabilities>13418<required id="can_generate_monitor_events"></required>13419</capabilities>13420<parameters>13421<param id="jni_env">13422<outptr>13423<struct>JNIEnv</struct>13424</outptr>13425<description>13426The JNI environment of the event (current) thread13427</description>13428</param>13429<param id="thread">13430<jthread/>13431<description>13432JNI local reference to the thread about to wait13433</description>13434</param>13435<param id="object">13436<jobject/>13437<description>13438JNI local reference to the monitor13439</description>13440</param>13441<param id="timeout">13442<jlong/>13443<description>13444The number of milliseconds the thread will wait13445</description>13446</param>13447</parameters>13448</event>1344913450<event label="Monitor Waited"13451id="MonitorWaited" const="JVMTI_EVENT_MONITOR_WAITED" filtered="thread" num="74">13452<description>13453Sent when a thread finishes waiting on an object.13454</description>13455<origin>jvmpi</origin>13456<capabilities>13457<required id="can_generate_monitor_events"></required>13458</capabilities>13459<parameters>13460<param id="jni_env">13461<outptr>13462<struct>JNIEnv</struct>13463</outptr>13464<description>13465The JNI environment of the event (current) thread13466</description>13467</param>13468<param id="thread">13469<jthread/>13470<description>13471JNI local reference to the thread that was finished waiting13472</description>13473</param>13474<param id="object">13475<jobject/>13476<description>13477JNI local reference to the monitor.13478</description>13479</param>13480<param id="timed_out">13481<jboolean/>13482<description>13483True if the monitor timed out13484</description>13485</param>13486</parameters>13487</event>1348813489<event label="Resource Exhausted"13490id="ResourceExhausted" const="JVMTI_EVENT_RESOURCE_EXHAUSTED" num="80"13491since="1.1">13492<description>13493Sent when a VM resource needed by a running application has been exhausted.13494Except as required by the optional capabilities, the set of resources13495which report exhaustion is implementation dependent.13496<p/>13497The following bit flags define the properties of the resource exhaustion:13498<constants id="jvmtiResourceExhaustionFlags"13499label="Resource Exhaustion Flags"13500kind="bits"13501since="1.1">13502<constant id="JVMTI_RESOURCE_EXHAUSTED_OOM_ERROR" num="0x0001">13503After this event returns, the VM will throw a13504<code>java.lang.OutOfMemoryError</code>.13505</constant>13506<constant id="JVMTI_RESOURCE_EXHAUSTED_JAVA_HEAP" num="0x0002">13507The VM was unable to allocate memory from the <tm>Java</tm>13508platform <i>heap</i>.13509The <i>heap</i> is the runtime13510data area from which memory for all class instances and13511arrays are allocated.13512</constant>13513<constant id="JVMTI_RESOURCE_EXHAUSTED_THREADS" num="0x0004">13514The VM was unable to create a thread.13515</constant>13516</constants>13517</description>13518<origin>new</origin>13519<capabilities>13520<capability id="can_generate_resource_exhaustion_heap_events">13521Can generate events when the VM is unable to allocate memory from the13522<internallink id="JVMTI_RESOURCE_EXHAUSTED_JAVA_HEAP">heap</internallink>.13523</capability>13524<capability id="can_generate_resource_exhaustion_threads_events">13525Can generate events when the VM is unable to13526<internallink id="JVMTI_RESOURCE_EXHAUSTED_THREADS">create13527a thread</internallink>.13528</capability>13529</capabilities>13530<parameters>13531<param id="jni_env">13532<outptr>13533<struct>JNIEnv</struct>13534</outptr>13535<description>13536The JNI environment of the event (current) thread13537</description>13538</param>13539<param id="flags">13540<jint/>13541<description>13542Flags defining the properties of the of resource exhaustion13543as specified by the13544<internallink id="jvmtiResourceExhaustionFlags">Resource13545Exhaustion Flags</internallink>.13546</description>13547</param>13548<param id="reserved">13549<vmbuf><void/></vmbuf>13550<description>13551Reserved.13552</description>13553</param>13554<param id="description">13555<vmbuf><char/></vmbuf>13556<description>13557Description of the resource exhaustion, encoded as a13558<internallink id="mUTF">modified UTF-8</internallink> string.13559</description>13560</param>13561</parameters>13562</event>1356313564<event label="VM Object Allocation"13565id="VMObjectAlloc" const="JVMTI_EVENT_VM_OBJECT_ALLOC" num="84">13566<description>13567Sent when a method causes the virtual machine to directly allocate an13568Object visible to Java programming language code.13569Generally object allocation should be detected by instrumenting13570the bytecodes of allocating methods.13571Object allocation generated in native code by JNI function13572calls should be detected using13573<internallink id="jniIntercept">JNI function interception</internallink>.13574Some methods might not have associated bytecodes and are not13575native methods, they instead are executed directly by the13576VM. These methods should send this event.13577Virtual machines which are incapable of bytecode instrumentation13578for some or all of their methods can send this event.1357913580Note that the <internallink13581id="SampledObjectAlloc">SampledObjectAlloc</internallink>13582event is triggered on all Java object allocations, including those13583caused by bytecode method execution, JNI method execution, and13584directly by VM methods.13585<p/>13586Typical examples where this event might be sent:13587<ul>13588<li>Reflection -- for example, <code>java.lang.Class.newInstance()</code></li>13589<li>Methods not represented by bytecodes -- for example, VM intrinsics and13590J2ME preloaded classes</li>13591</ul>13592Cases where this event would not be generated:13593<ul>13594<li>Allocation due to bytecodes -- for example, the <code>new</code>13595and <code>newarray</code> VM instructions</li>13596<li>Allocation due to JNI function calls -- for example,13597<code>AllocObject</code></li>13598<li>Allocations during VM initialization</li>13599<li>VM internal objects</li>13600</ul>13601</description>13602<origin>new</origin>13603<capabilities>13604<required id="can_generate_vm_object_alloc_events"></required>13605</capabilities>13606<parameters>13607<param id="jni_env">13608<outptr>13609<struct>JNIEnv</struct>13610</outptr>13611<description>13612The JNI environment of the event (current) thread13613</description>13614</param>13615<param id="thread">13616<jthread/>13617<description>13618Thread allocating the object.13619</description>13620</param>13621<param id="object">13622<jobject/>13623<description>13624JNI local reference to the object that was allocated.13625</description>13626</param>13627<param id="object_klass">13628<jclass/>13629<description>13630JNI local reference to the class of the object.13631</description>13632</param>13633<param id="size">13634<jlong/>13635<description>13636Size of the object (in bytes). See <functionlink id="GetObjectSize"/>.13637</description>13638</param>13639</parameters>13640</event>1364113642<event label="Sampled Object Allocation"13643id="SampledObjectAlloc" const="JVMTI_EVENT_SAMPLED_OBJECT_ALLOC" filtered="thread" num="86" since="11">13644<description>13645Sent when an allocated object is sampled.13646By default, the sampling interval is set to 512KB. The sampling is semi-random to avoid13647pattern-based bias and provides an approximate overall average interval over long periods of13648sampling.13649<p/>13650Each thread tracks how many bytes it has allocated since it sent the last event.13651When the number of bytes exceeds the sampling interval, it will send another event.13652This implies that, on average, one object will be sampled every time a thread has13653allocated 512KB bytes since the last sample.13654<p/>13655Note that the sampler is pseudo-random: it will not sample every 512KB precisely.13656The goal of this is to ensure high quality sampling even if allocation is13657happening in a fixed pattern (i.e., the same set of objects are being allocated13658every 512KB).13659<p/>13660If another sampling interval is required, the user can call13661<functionlink id="SetHeapSamplingInterval"></functionlink> with a strictly positive integer value,13662representing the new sampling interval.13663<p/>13664This event is sent once the sampled allocation has been performed. It provides the object, stack trace13665of the allocation, the thread allocating, the size of allocation, and the object's class.13666<p/>13667A typical use case of this system is to determine where heap allocations originate.13668In conjunction with weak references and the function13669<functionlink id="GetStackTrace"></functionlink>, a user can track which objects were allocated from which13670stack trace, and which are still live during the execution of the program.13671</description>13672<origin>new</origin>13673<capabilities>13674<required id="can_generate_sampled_object_alloc_events"></required>13675</capabilities>13676<parameters>13677<param id="jni_env">13678<outptr>13679<struct>JNIEnv</struct>13680</outptr>13681<description>13682The JNI environment of the event (current) thread.13683</description>13684</param>13685<param id="thread">13686<jthread/>13687<description>13688Thread allocating the object.13689</description>13690</param>13691<param id="object">13692<jobject/>13693<description>13694JNI local reference to the object that was allocated.13695</description>13696</param>13697<param id="object_klass">13698<jclass/>13699<description>13700JNI local reference to the class of the object13701</description>13702</param>13703<param id="size">13704<jlong/>13705<description>13706Size of the object (in bytes). See <functionlink id="GetObjectSize"/>.13707</description>13708</param>13709</parameters>13710</event>1371113712<event label="Object Free"13713id="ObjectFree" const="JVMTI_EVENT_OBJECT_FREE" num="83">13714<description>13715An Object Free event is sent when the garbage collector frees an object.13716Events are only sent for tagged objects--see13717<internallink id="Heap">heap functions</internallink>.13718<p/>13719The event handler must not use JNI functions and13720must not use <jvmti/> functions except those which13721specifically allow such use (see the raw monitor, memory management,13722and environment local storage functions).13723</description>13724<origin>new</origin>13725<capabilities>13726<required id="can_generate_object_free_events"></required>13727</capabilities>13728<parameters>13729<param id="tag">13730<jlong/>13731<description>13732The freed object's tag13733</description>13734</param>13735</parameters>13736</event>1373713738<event label="Garbage Collection Start"13739id="GarbageCollectionStart" const="JVMTI_EVENT_GARBAGE_COLLECTION_START" num="81">13740<description>13741A Garbage Collection Start event is sent when a13742garbage collection pause begins.13743Only stop-the-world collections are reported--that is, collections during13744which all threads cease to modify the state of the Java virtual machine.13745This means that some collectors will never generate these events.13746This event is sent while the VM is still stopped, thus13747the event handler must not use JNI functions and13748must not use <jvmti/> functions except those which13749specifically allow such use (see the raw monitor, memory management,13750and environment local storage functions).13751<p/>13752This event is always sent as a matched pair with13753<eventlink id="GarbageCollectionFinish"/>13754(assuming both events are enabled) and no garbage collection13755events will occur between them.13756</description>13757<origin>new</origin>13758<capabilities>13759<required id="can_generate_garbage_collection_events"></required>13760</capabilities>13761<parameters>13762</parameters>13763</event>1376413765<event label="Garbage Collection Finish"13766id="GarbageCollectionFinish" const="JVMTI_EVENT_GARBAGE_COLLECTION_FINISH" num="82">13767<description>13768A Garbage Collection Finish event is sent when a13769garbage collection pause ends.13770This event is sent while the VM is still stopped, thus13771the event handler must not use JNI functions and13772must not use <jvmti/> functions except those which13773specifically allow such use (see the raw monitor, memory management,13774and environment local storage functions).13775<p/>13776Some agents may need to do post garbage collection operations that13777require the use of the disallowed <jvmti/> or JNI functions. For these13778cases an agent thread can be created which waits on a raw monitor,13779and the handler for the Garbage Collection Finish event simply13780notifies the raw monitor13781<p/>13782This event is always sent as a matched pair with13783<eventlink id="GarbageCollectionStart"/> (assuming both events are enabled).13784<issue>13785The most important use of this event is to provide timing information,13786and thus additional information is not required. However,13787information about the collection which is "free" should be included -13788what that information is needs to be determined.13789</issue>13790</description>13791<origin>new</origin>13792<capabilities>13793<required id="can_generate_garbage_collection_events"></required>13794</capabilities>13795<parameters>13796</parameters>13797</event>1379813799<elide>13800<event label="Verbose Output" phase="any"13801id="VerboseOutput" const="JVMTI_EVENT_VERBOSE_OUTPUT" num="85">13802<description>13803Send verbose messages as strings.13804<issue>13805This format is extremely fragile, as it can change with each13806platform, collector and version. Alternatives include:13807<ul>13808<li>building off Java programming language M and M APIs</li>13809<li>XML</li>13810<li>key/value pairs</li>13811<li>removing it</li>13812</ul>13813</issue>13814<issue>13815Though this seemed trivial to implement.13816In the RI it appears this will be quite complex.13817</issue>13818</description>13819<origin>new</origin>13820<capabilities>13821</capabilities>13822<parameters>13823<param id="flag">13824<enum>jvmtiVerboseFlag</enum>13825<description>13826Which verbose output is being sent.13827</description>13828</param>13829<param id="message">13830<vmbuf><char/></vmbuf>13831<description>13832Message text, encoded as a13833<internallink id="mUTF">modified UTF-8</internallink> string.13834</description>13835</param>13836</parameters>13837</event>13838</elide>1383913840</eventsection>1384113842<datasection>13843<intro>13844<jvmti/> extends the data types defined by JNI.13845</intro>13846<basetypes id="jniTypes" label="JNI Types Used in the JVM Tool Interface">13847<basetype id="jboolean">13848<description>13849Holds a Java programming language <code>boolean</code>.13850Unsigned 8 bits.13851</description>13852</basetype>13853<basetype id="jchar">13854<description>13855Holds a Java programming language <code>char</code>.13856Unsigned 16 bits.13857</description>13858</basetype>13859<basetype id="jint">13860<description>13861Holds a Java programming language <code>int</code>.13862Signed 32 bits.13863</description>13864</basetype>13865<basetype id="jlong">13866<description>13867Holds a Java programming language <code>long</code>.13868Signed 64 bits.13869</description>13870</basetype>13871<basetype id="jfloat">13872<description>13873Holds a Java programming language <code>float</code>.1387432 bits.13875</description>13876</basetype>13877<basetype id="jdouble">13878<description>13879Holds a Java programming language <code>double</code>.1388064 bits.13881</description>13882</basetype>13883<basetype id="jobject">13884<description>13885Holds a Java programming language object.13886</description>13887</basetype>13888<basetype id="jclass">13889<description>13890Holds a Java programming language class.13891</description>13892</basetype>13893<basetype id="jvalue">13894<description>13895Is a union of all primitive types and <code>jobject</code>. Thus, holds any Java13896programming language value.13897</description>13898</basetype>13899<basetype id="jfieldID">13900<description>13901Identifies a Java programming language field.13902<code>jfieldID</code>s returned by <jvmti/> functions and events may be13903safely stored.13904</description>13905</basetype>13906<basetype id="jmethodID">13907<description>13908Identifies a Java programming language method, initializer, or constructor.13909<code>jmethodID</code>s returned by <jvmti/> functions and events may be13910safely stored. However, if the class is unloaded, they become invalid13911and must not be used.13912</description>13913</basetype>13914<basetype id="JNIEnv">13915<description>13916Pointer to the JNI function table. Pointer to this (<code>JNIEnv *</code>)13917is a JNI environment.13918</description>13919</basetype>13920</basetypes>1392113922<basetypes id="jvmtiTypes" label="JVM Tool Interface Base Types">13923<basetype id="jvmtiEnv">13924<description>13925The <jvmti/> <internallink id="environments">environment</internallink> pointer.13926See the <internallink id="FunctionSection">Function Section</internallink>.13927<code>jvmtiEnv</code> points to the13928<internallink id="FunctionTable">function table</internallink> pointer.13929</description>13930</basetype>13931<basetype id="jthread">13932<definition>typedef jobject jthread;</definition>13933<description>13934Subtype of <datalink id="jobject"></datalink> that holds a thread.13935</description>13936</basetype>13937<basetype id="jthreadGroup">13938<definition>typedef jobject jthreadGroup;</definition>13939<description>13940Subtype of <datalink id="jobject"></datalink> that holds a thread group.13941</description>13942</basetype>13943<basetype id="jlocation">13944<definition>typedef jlong jlocation;</definition>13945<description>13946A 64 bit value, representing a monotonically increasing13947executable position within a method.13948<code>-1</code> indicates a native method.13949See <functionlink id="GetJLocationFormat"></functionlink> for the format on a13950given VM.13951</description>13952</basetype>13953<basetype id="jrawMonitorID">13954<definition>struct _jrawMonitorID;13955typedef struct _jrawMonitorID *jrawMonitorID;</definition>13956<description>13957A raw monitor.13958</description>13959</basetype>13960<basetype id="jvmtiError">13961<description>13962Holds an error return code.13963See the <internallink id="ErrorSection">Error section</internallink> for possible values.13964<example>13965typedef enum {13966JVMTI_ERROR_NONE = 0,13967JVMTI_ERROR_INVALID_THREAD = 10,13968...13969} jvmtiError;13970</example>13971</description>13972</basetype>13973<basetype id="jvmtiEvent">13974<description>13975An identifier for an event type.13976See the <internallink id="EventSection">Event section</internallink> for possible values.13977It is guaranteed that future versions of this specification will13978never assign zero as an event type identifier.13979<example>13980typedef enum {13981JVMTI_EVENT_SINGLE_STEP = 1,13982JVMTI_EVENT_BREAKPOINT = 2,13983...13984} jvmtiEvent;13985</example>13986</description>13987</basetype>13988<basetype id="jvmtiEventCallbacks" name="eventCallbacks">13989<description>13990The callbacks used for events.13991<example>13992typedef struct {13993jvmtiEventVMInit VMInit;13994jvmtiEventVMDeath VMDeath;13995...13996} jvmtiEventCallbacks;13997</example>13998See <internallink id="jvmtiEventCallbacks">event callbacks</internallink>13999for the complete structure.14000<p/>14001Where, for example, the VM initialization callback is defined:14002<example>14003typedef void (JNICALL *jvmtiEventVMInit)14004(jvmtiEnv *jvmti_env,14005JNIEnv* jni_env,14006jthread thread);14007</example>14008See the individual events for the callback function definition.14009</description>14010</basetype>14011<basetype id="jniNativeInterface">14012<definition>typedef struct JNINativeInterface_ jniNativeInterface;</definition>14013<description>14014Typedef for the JNI function table <code>JNINativeInterface</code>14015defined in the14016<externallink id="jni/functions.html#interface-function-table">14017JNI Specification</externallink>.14018The JNI reference implementation defines this with an underscore.14019</description>14020</basetype>14021</basetypes>1402214023</datasection>1402414025<issuessection label="Issues">14026<intro id="suspendRequired" label="Resolved Issue: Suspend - Required or Automatic">14027JVMDI requires that the agent suspend threads before calling14028certain sensitive functions. JVMPI requires garbage collection to be14029disabled before calling certain sensitive functions.14030It was suggested that rather than have this requirement, that14031VM place itself in a suitable state before performing an14032operation. This makes considerable sense since each VM14033knows its requirements and can most easily arrange a14034safe state.14035<p/>14036The ability to externally suspend/resume threads will, of14037course, remain. The ability to enable/disable garbage collection will not.14038<p/>14039This issue is resolved--suspend will not14040be required. The spec has been updated to reflect this.14041</intro>1404214043<intro id="stackSampling" label="Resolved Issue: Call Stack Sampling">14044There are a variety of approaches to sampling call stacks.14045The biggest bifurcation is between VM controlled and agent14046controlled.14047<p/>14048This issue is resolved--agent controlled14049sampling will be the approach.14050</intro>1405114052<intro id="threadRepresentation" label="Resolved Issue: Thread Representation">14053JVMDI represents threads as jthread. JVMPI primarily14054uses JNIEnv* to represent threads.14055<p/>14056The Expert Group has chosen jthread as the representation14057for threads in <jvmti/>.14058JNIEnv* is sent by14059events since it is needed to JNI functions. JNIEnv, per the14060JNI spec, are not supposed to be used outside their thread.14061</intro>1406214063<intro id="design" label="Resolved Issue: Method Representation">14064The JNI spec allows an implementation to depend on jclass/jmethodID14065pairs, rather than simply a jmethodID, to reference a method.14066JVMDI, for consistency, choose the same representation.14067JVMPI, however, specifies that a jmethodID alone maps to a14068method. Both of the Sun <tm>J2SE</tm> virtual machines (Classic and <tm>HotSpot</tm>) store14069pointers in jmethodIDs, and as a result, a jmethodID is sufficient.14070In fact, any JVM implementation that supports JVMPI must have14071such a representation.14072<jvmti/> will use jmethodID as a unique representation of a method14073(no jclass is used).14074There should be efficiency gains, particularly in14075functionality like stack dumping, to this representation.14076<p/>14077Note that fields were not used in JVMPI and that the access profile14078of fields differs from methods--for implementation efficiency14079reasons, a jclass/jfieldID pair will still be needed for field14080reference.14081</intro>1408214083<intro id="localReferenceIssue" label="Resolved Issue: Local References">14084Functions return local references.14085</intro>1408614087<intro id="frameRep" label="Resolved Issue: Representation of frames">14088In JVMDI, a frame ID is used to represent a frame. Problem with this14089is that a VM must track when a frame becomes invalid, a far better14090approach, and the one used in <jvmti/>, is to reference frames by depth.14091</intro>1409214093<intro id="requiredCapabilities" label="Issue: Required Capabilities">14094Currently, having a required capabilities means that the functionality14095is optional. Capabilities are useful even for required functionality14096since they can inform the VM is needed set-up. Thus, there should be14097a set of capabilities that a conformant implementation must provide14098(if requested during Agent_OnLoad).14099</intro>1410014101<intro id="taghint" label="Proposal: add tag hint function">14102A hint of the percentage of objects that will be tagged would14103help the VM pick a good implementation.14104</intro>1410514106<intro id="moreMonitorQueries" label="Request: More Monitor Quires">14107How difficult or easy would be to extend the monitor_info category to include14108<pre>14109- current number of monitors14110- enumeration of monitors14111- enumeration of threads waiting on a given monitor14112</pre>14113The reason for my question is the fact that current get_monitor_info support14114requires the agent to specify a given thread to get the info which is probably14115OK in the profiling/debugging space, while in the monitoring space the agent14116could be watching the monitor list and then decide which thread to ask for14117the info. You might ask why is this important for monitoring .... I think it14118can aid in the detection/prediction of application contention caused by hot-locks.14119</intro>14120</issuessection>1412114122<changehistory id="ChangeHistory" update="09/05/07">14123<intro>14124The <jvmti/> specification is an evolving document with major, minor,14125and micro version numbers.14126A released version of the specification is uniquely identified14127by its major and minor version.14128The functions, events, and capabilities in this specification14129indicate a "Since" value which is the major and minor version in14130which it was introduced.14131The version of the specification implemented by the VM can14132be retrieved at runtime with the <functionlink id="GetVersionNumber"/>14133function.14134</intro>14135<change date="14 Nov 2002">14136Converted to XML document.14137</change>14138<change date="14 Nov 2002">14139Elided heap dump functions (for now) since what was there14140was wrong.14141</change>14142<change date="18 Nov 2002">14143Added detail throughout.14144</change>14145<change date="18 Nov 2002">14146Changed JVMTI_THREAD_STATUS_RUNNING to JVMTI_THREAD_STATUS_RUNNABLE.14147</change>14148<change date="19 Nov 2002">14149Added AsyncGetStackTrace.14150</change>14151<change date="19 Nov 2002">14152Added jframeID return to GetStackTrace.14153</change>14154<change date="19 Nov 2002">14155Elided GetCurrentFrame and GetCallingFrame functions (for now) since what was there14156since they are redundant with GetStackTrace.14157</change>14158<change date="19 Nov 2002">14159Elided ClearAllBreakpoints since it has always been redundant.14160</change>14161<change date="19 Nov 2002">14162Added GetSystemProperties.14163</change>14164<change date="19 Nov 2002">14165Changed the thread local storage functions to use jthread.14166</change>14167<change date="20 Nov 2002">14168Added GetJLocationFormat.14169</change>14170<change date="22 Nov 2002">14171Added events and introductory text.14172</change>14173<change date="22 Nov 2002">14174Cross reference type and constant definitions.14175</change>14176<change date="24 Nov 2002">14177Added DTD.14178</change>14179<change date="24 Nov 2002">14180Added capabilities function section.14181</change>14182<change date="29 Nov 2002">14183Assign capabilities to each function and event.14184</change>14185<change date="29 Nov 2002">14186Add <internallink id="jniIntercept">JNI interception functions</internallink>.14187</change>14188<change date="30 Nov 2002">14189Auto generate SetEventNotificationMode capabilities.14190</change>14191<change date="30 Nov 2002">14192Add <eventlink id="VMObjectAlloc"></eventlink> event.14193</change>14194<change date="30 Nov 2002">14195Add <eventlink id="DynamicCodeGenerated"></eventlink> event.14196</change>14197<change date="30 Nov 2002">14198Add const to declarations.14199</change>14200<change date="30 Nov 2002">14201Change method exit and frame pop to send on exception.14202</change>14203<change date="1 Dec 2002">14204Add ForceGarbageCollection.14205</change>14206<change date="2 Dec 2002">14207Redo Xrun section; clarify GetStackTrace and add example;14208Fix width problems; use "agent" consistently.14209</change>14210<change date="8 Dec 2002">14211Remove previous start-up intro.14212Add <internallink id="environments"><jvmti/> Environments</internallink>14213section.14214</change>14215<change date="8 Dec 2002">14216Add <functionlink id="DisposeEnvironment"></functionlink>.14217</change>14218<change date="9 Dec 2002">14219Numerous minor updates.14220</change>14221<change date="15 Dec 2002">14222Add heap profiling functions added:14223get/set annotation, iterate live objects/heap.14224Add heap profiling functions place holder added:14225heap roots.14226Heap profiling event added: object free.14227Heap profiling event redesigned: vm object allocation.14228Heap profiling event placeholders added: garbage collection start/finish.14229Native method bind event added.14230</change>14231<change date="19 Dec 2002">14232Revamp suspend/resume functions.14233Add origin information with jvmdi tag.14234Misc fixes.14235</change>14236<change date="24 Dec 2002">14237Add semantics to types.14238</change>14239<change date="27 Dec 2002">14240Add local reference section.14241Autogenerate parameter descriptions from types.14242</change>14243<change date="28 Dec 2002">14244Document that RunAgentThread sends threadStart.14245</change>14246<change date="29 Dec 2002">14247Remove redundant local ref and dealloc warning.14248Convert GetRawMonitorName to allocated buffer.14249Add GenerateEvents.14250</change>14251<change date="30 Dec 2002">14252Make raw monitors a type and rename to "jrawMonitorID".14253</change>14254<change date="1 Jan 2003">14255Include origin information.14256Clean-up JVMDI issue references.14257Remove Deallocate warnings which are now automatically generated.14258</change>14259<change date="2 Jan 2003">14260Fix representation issues for jthread.14261</change>14262<change date="3 Jan 2003">14263Make capabilities buffered out to 64 bits - and do it automatically.14264</change>14265<change date="4 Jan 2003">14266Make constants which are enumeration into enum types.14267Parameters now of enum type.14268Clean-up and index type section.14269Replace remaining datadef entities with callback.14270</change>14271<change date="7 Jan 2003">14272Correct GenerateEvents description.14273More internal semantics work.14274</change>14275<change date="9 Jan 2003">14276Replace previous GetSystemProperties with two functions14277which use allocated information instead fixed.14278Add SetSystemProperty.14279More internal semantics work.14280</change>14281<change date="12 Jan 2003">14282Add varargs to end of SetEventNotificationMode.14283</change>14284<change date="20 Jan 2003">14285Finish fixing spec to reflect that alloc sizes are jlong.14286</change>14287<change date="22 Jan 2003">14288Allow NULL as RunAgentThread arg.14289</change>14290<change date="22 Jan 2003">14291Fixed names to standardized naming convention14292Removed AsyncGetStackTrace.14293</change>14294<change date="29 Jan 2003">14295Since we are using jthread, removed GetThread.14296</change>14297<change date="31 Jan 2003">14298Change GetFieldName to allow NULLs like GetMethodName.14299</change>14300<change date="29 Feb 2003" version="v40">14301Rewrite the introductory text, adding sections on14302start-up, environments and bytecode instrumentation.14303Change the command line arguments per EG discussions.14304Add an introduction to the capabilities section.14305Add the extension mechanism category and functions.14306Mark for deletion, but clarified anyhow, SuspendAllThreads.14307Rename IterateOverLiveObjects to IterateOverReachableObjects and14308change the text accordingly.14309Clarify IterateOverHeap.14310Clarify CompiledMethodLoad.14311Discuss prerequisite state for Calling Functions.14312Clarify SetAllocationHooks.14313Added issues ("To be resolved:") through-out.14314And so on...14315</change>14316<change date="6 Mar 2003" version="v41">14317Remove struct from the call to GetOwnedMonitorInfo.14318Automatically generate most error documentation, remove14319(rather broken) hand written error doc.14320Better describe capability use (empty initial set).14321Add min value to jint params.14322Remove the capability can_access_thread_local_storage.14323Rename error JVMTI_ERROR_NOT_IMPLEMENTED to JVMTI_ERROR_MUST_POSSESS_CAPABILITY;14324same for *NOT_IMPLEMENTED.14325Description fixes.14326</change>14327<change date="8 Mar 2003" version="v42">14328Rename GetClassSignature to GetClassName.14329Rename IterateOverClassObjects to IterateOverInstancesOfClass.14330Remove GetMaxStack (operand stack isn't used in <jvmti/>).14331Description fixes: define launch-time, remove native frame pop14332from PopFrame, and assorted clarifications.14333</change>14334<change date="8 Mar 2003" version="v43">14335Fix minor editing problem.14336</change>14337<change date="10 Mar 2003" version="v44">14338Add phase information.14339Remap (compact) event numbers.14340</change>14341<change date="11 Mar 2003" version="v45">14342More phase information - allow "any".14343Elide raw monitor queries and events.14344Minor description fixes.14345</change>14346<change date="12 Mar 2003" version="v46">14347Add GetPhase.14348Use "phase" through document.14349Elide GetRawMonitorName.14350Elide GetObjectMonitors.14351</change>14352<change date="12 Mar 2003" version="v47">14353Fixes from link, XML, and spell checking.14354Auto-generate the callback structure.14355</change>14356<change date="13 Mar 2003" version="v48">14357One character XML fix.14358</change>14359<change date="13 Mar 2003" version="v49">14360Change function parameter names to be consistent with14361event parameters (fooBarBaz becomes foo_bar_baz).14362</change>14363<change date="14 Mar 2003" version="v50">14364Fix broken link. Fix thread markers.14365</change>14366<change date="14 Mar 2003" version="v51">14367Change constants so they are under 128 to workaround14368compiler problems.14369</change>14370<change date="23 Mar 2003" version="v52">14371Overhaul capabilities. Separate GetStackTrace into14372GetStackTrace and GetStackFrames.14373</change>14374<change date="8 Apr 2003" version="v54">14375Use depth instead of jframeID to reference frames.14376Remove the now irrelevant GetCurrentFrame, GetCallerFrame and GetStackFrames.14377Remove frame arg from events.14378</change>14379<change date="9 Apr 2003" version="v55">14380Remove GetObjectWithAnnotation since tests show bufferred approach more efficient.14381Add missing annotation_count to GetObjectsWithAnnotations14382</change>14383<change date="10 Apr 2003" version="v56">14384Remove confusing parenthetical statement in GetObjectsWithAnnotations14385</change>14386<change date="13 Apr 2003" version="v58">14387Replace jclass/jmethodID representation of method with simply jmethodID;14388Pass JvmtiEnv* as first arg of every event; remove JNIEnv* where inappropriate.14389Replace can_access_frames with can_access_local_variables; remove from purely stack access.14390Use can_get_synthetic_attribute; fix description.14391Clarify that zero length arrays must be deallocated.14392Clarify RelinquishCapabilities.14393Generalize JVMTI_ERROR_VM_DEAD to JVMTI_ERROR_WRONG_PHASE.14394</change>14395<change date="27 Apr 2003" version="v59">14396Remove lingering indirect references to OBSOLETE_METHOD_ID.14397</change>14398<change date="4 May 2003" version="v60">14399Allow DestroyRawMonitor during OnLoad.14400</change>14401<change date="7 May 2003" version="v61">14402Added not monitor owner error return to DestroyRawMonitor.14403</change>14404<change date="13 May 2003" version="v62">14405Clarify semantics of raw monitors.14406Change flags on <code>GetThreadStatus</code>.14407<code>GetClassLoader</code> return NULL for the bootstrap class loader.14408Add <code>GetClassName</code> issue.14409Define local variable signature.14410Disallow zero in annotations array of <code>GetObjectsWithAnnotations</code>.14411Remove over specification in <code>GetObjectsWithAnnotations</code>.14412Elide <code>SetAllocationHooks</code>.14413Elide <code>SuspendAllThreads</code>.14414</change>14415<change date="14 May 2003" version="v63">14416Define the data type <code>jvmtiEventCallbacks</code>.14417Zero length allocations return NULL.14418Keep SetAllocationHooks in JVMDI, but remove from <jvmti/>.14419Add JVMTI_THREAD_STATUS_FLAG_INTERRUPTED.14420</change>14421<change date="15 May 2003" version="v64">14422Better wording, per review.14423</change>14424<change date="15 May 2003" version="v65">14425First Alpha.14426Make jmethodID and jfieldID unique, jclass not used.14427</change>14428<change date="27 May 2003" version="v66">14429Fix minor XSLT errors.14430</change>14431<change date="13 June 2003" version="v67">14432Undo making jfieldID unique (jmethodID still is).14433</change>14434<change date="17 June 2003" version="v68">14435Changes per June 11th Expert Group meeting --14436Overhaul Heap functionality: single callback,14437remove GetHeapRoots, add reachable iterators,14438and rename "annotation" to "tag".14439NULL thread parameter on most functions is current14440thread.14441Add timers.14442Remove ForceExit.14443Add GetEnvironmentLocalStorage.14444Add verbose flag and event.14445Add AddToBootstrapClassLoaderSearch.14446Update ClassFileLoadHook.14447</change>14448<change date="18 June 2003" version="v69">14449Clean up issues sections.14450Rename GetClassName back to GetClassSignature and14451fix description.14452Add generic signature to GetClassSignature,14453GetFieldSignature, GetMethodSignature, and14454GetLocalVariableTable.14455Elide EstimateCostOfCapabilities.14456Clarify that the system property functions operate14457on the VM view of system properties.14458Clarify Agent_OnLoad.14459Remove "const" from JNIEnv* in events.14460Add metadata accessors.14461</change>14462<change date="18 June 2003" version="v70">14463Add start_depth to GetStackTrace.14464Move system properties to a new category.14465Add GetObjectSize.14466Remove "X" from command line flags.14467XML, HTML, and spell check corrections.14468</change>14469<change date="19 June 2003" version="v71">14470Fix JVMTI_HEAP_ROOT_THREAD to be 6.14471Make each synopsis match the function name.14472Fix unclear wording.14473</change>14474<change date="26 June 2003" version="v72">14475SetThreadLocalStorage and SetEnvironmentLocalStorage should allow value14476to be set to NULL.14477NotifyFramePop, GetFrameLocationm and all the local variable operations14478needed to have their wording about frames fixed.14479Grammar and clarity need to be fixed throughout.14480Capitalization and puntuation need to be consistent.14481Need micro version number and masks for accessing major, minor, and micro.14482The error code lists should indicate which must be returned by14483an implementation.14484The command line properties should be visible in the properties functions.14485Disallow popping from the current thread.14486Allow implementations to return opaque frame error when they cannot pop.14487The NativeMethodBind event should be sent during any phase.14488The DynamicCodeGenerated event should be sent during any phase.14489The following functions should be allowed to operate before VMInit:14490Set/GetEnvironmentLocalStorage14491GetMethodDeclaringClass14492GetClassSignature14493GetClassModifiers14494IsInterface14495IsArrayClass14496GetMethodName14497GetMethodModifiers14498GetMaxLocals14499GetArgumentsSize14500GetLineNumberTable14501GetMethodLocation14502IsMethodNative14503IsMethodSynthetic.14504Other changes (to XSL):14505Argument description should show asterisk after not before pointers.14506NotifyFramePop, GetFrameLocationm and all the local variable operations14507should hsve the NO_MORE_FRAMES error added.14508Not alive threads should have a different error return than invalid thread.14509</change>14510<change date="7 July 2003" version="v73">14511VerboseOutput event was missing message parameter.14512Minor fix-ups.14513</change>14514<change date="14 July 2003" version="v74">14515Technical Publications Department corrections.14516Allow thread and environment local storage to be set to NULL.14517</change>14518<change date="23 July 2003" version="v75">14519Use new Agent_OnLoad rather than overloaded JVM_OnLoad.14520Add JNICALL to callbacks (XSL).14521Document JNICALL requirement for both events and callbacks (XSL).14522Restrict RedefineClasses to methods and attributes.14523Elide the VerboseOutput event.14524VMObjectAlloc: restrict when event is sent and remove method parameter.14525Finish loose ends from Tech Pubs edit.14526</change>14527<change date="24 July 2003" version="v76">14528Change ClassFileLoadHook event to send the class instead of a boolean of redefine.14529</change>14530<change date="24 July 2003" version="v77">14531XML fixes.14532Minor text clarifications and corrections.14533</change>14534<change date="24 July 2003" version="v78">14535Remove GetExceptionHandlerTable and GetThrownExceptions from <jvmti/>.14536Clarify that stack frames are JVM Spec frames.14537Split can_get_source_info into can_get_source_file_name, can_get_line_numbers,14538and can_get_source_debug_extension.14539PopFrame cannot have a native calling method.14540Removed incorrect statement in GetClassloaderClasses14541(see <vmspec chapter="4.4"/>).14542</change>14543<change date="24 July 2003" version="v79">14544XML and text fixes.14545Move stack frame description into Stack Frame category.14546</change>14547<change date="26 July 2003" version="v80">14548Allow NULL (means bootstrap loader) for GetClassloaderClasses.14549Add new heap reference kinds for references from classes.14550Add timer information struct and query functions.14551Add AvailableProcessors.14552Rename GetOtherThreadCpuTime to GetThreadCpuTime.14553Explicitly add JVMTI_ERROR_INVALID_THREAD and JVMTI_ERROR_THREAD_NOT_ALIVE14554to SetEventNotification mode.14555Add initial thread to the VM_INIT event.14556Remove platform assumptions from AddToBootstrapClassLoaderSearch.14557</change>14558<change date="26 July 2003" version="v81">14559Grammar and clarity changes per review.14560</change>14561<change date="27 July 2003" version="v82">14562More grammar and clarity changes per review.14563Add Agent_OnUnload.14564</change>14565<change date="28 July 2003" version="v83">14566Change return type of Agent_OnUnload to void.14567</change>14568<change date="28 July 2003" version="v84">14569Rename JVMTI_REFERENCE_ARRAY to JVMTI_REFERENCE_ARRAY_ELEMENT.14570</change>14571<change date="28 July 2003" version="v85">14572Steal java.lang.Runtime.availableProcessors() wording for14573AvailableProcessors().14574Guarantee that zero will never be an event ID.14575Remove some issues which are no longer issues.14576Per review, rename and more completely document the timer14577information functions.14578</change>14579<change date="29 July 2003" version="v86">14580Non-spec visible change to XML controlled implementation:14581SetThreadLocalStorage must run in VM mode.14582</change>14583<change date="5 August 2003" version="0.1.87">14584Add GetErrorName.14585Add varargs warning to jvmtiExtensionEvent.14586Remove "const" on the jvmtiEnv* of jvmtiExtensionEvent.14587Remove unused can_get_exception_info capability.14588Pass jvmtiEnv* and JNIEnv* to the jvmtiStartFunction.14589Fix jvmtiExtensionFunctionInfo.func declared type.14590Extension function returns error code.14591Use new version numbering.14592</change>14593<change date="5 August 2003" version="0.2.88">14594Remove the ClassUnload event.14595</change>14596<change date="8 August 2003" version="0.2.89">14597Heap reference iterator callbacks return an enum that14598allows outgoing object references to be ignored.14599Allow JNIEnv as a param type to extension events/functions.14600</change>14601<change date="15 August 2003" version="0.2.90">14602Fix a typo.14603</change>14604<change date="2 September 2003" version="0.2.91">14605Remove all metadata functions: GetClassMetadata,14606GetFieldMetadata, and GetMethodMetadata.14607</change>14608<change date="1 October 2003" version="0.2.92">14609Mark the functions Allocate. Deallocate, RawMonitor*,14610SetEnvironmentLocalStorage, and GetEnvironmentLocalStorage14611as safe for use in heap callbacks and GC events.14612</change>14613<change date="24 November 2003" version="0.2.93">14614Add pass through opaque user data pointer to heap iterate14615functions and callbacks.14616In the CompiledMethodUnload event, send the code address.14617Add GarbageCollectionOccurred event.14618Add constant pool reference kind.14619Mark the functions CreateRawMonitor and DestroyRawMonitor14620as safe for use in heap callbacks and GC events.14621Clarify: VMDeath, GetCurrentThreadCpuTimerInfo,14622GetThreadCpuTimerInfo, IterateOverReachableObjects,14623IterateOverObjectsReachableFromObject, GetTime and14624JVMTI_ERROR_NULL_POINTER.14625Add missing errors to: GenerateEvents and14626AddToBootstrapClassLoaderSearch.14627Fix description of ClassFileLoadHook name parameter.14628In heap callbacks and GC/ObjectFree events, specify14629that only explicitly allowed functions can be called.14630Allow GetCurrentThreadCpuTimerInfo, GetCurrentThreadCpuTime,14631GetTimerInfo, and GetTime during callback.14632Allow calling SetTag/GetTag during the onload phase.14633SetEventNotificationMode, add: error attempted inappropriate14634thread level control.14635Remove jvmtiExceptionHandlerEntry.14636Fix handling of native methods on the stack --14637location_ptr param of GetFrameLocation, remove14638JVMTI_ERROR_OPAQUE_FRAME from GetFrameLocation,14639jvmtiFrameInfo.location, and jlocation.14640Remove typo (from JVMPI) implying that the MonitorWaited14641event is sent on sleep.14642</change>14643<change date="25 November 2003" version="0.2.94">14644Clarifications and typos.14645</change>14646<change date="3 December 2003" version="0.2.95">14647Allow NULL user_data in heap iterators.14648</change>14649<change date="28 January 2004" version="0.2.97">14650Add GetThreadState, deprecate GetThreadStatus.14651</change>14652<change date="29 January 2004" version="0.2.98">14653INVALID_SLOT and TYPE_MISMATCH errors should be optional.14654</change>14655<change date="12 February 2004" version="0.2.102">14656Remove MonitorContendedExit.14657Added JNIEnv parameter to VMObjectAlloc.14658Clarified definition of class_tag and referrer_index14659parameters to heap callbacks.14660</change>14661<change date="16 Febuary 2004" version="0.2.103">14662Document JAVA_TOOL_OPTIONS.14663</change>14664<change date="17 Febuary 2004" version="0.2.105">14665Divide start phase into primordial and start.14666Add VMStart event14667Change phase associations of functions and events.14668</change>14669<change date="18 Febuary 2004" version="0.3.6">14670Elide deprecated GetThreadStatus.14671Bump minor version, subtract 100 from micro version14672</change>14673<change date="18 Febuary 2004" version="0.3.7">14674Document that timer nanosecond values are unsigned.14675Clarify text having to do with native methods.14676</change>14677<change date="19 Febuary 2004" version="0.3.8">14678Fix typos.14679Remove elided deprecated GetThreadStatus.14680</change>14681<change date="23 Febuary 2004" version="0.3.9">14682Require NotifyFramePop to act on suspended threads.14683</change>14684<change date="24 Febuary 2004" version="0.3.10">14685Add capabilities14686(<internallink id="jvmtiCapabilities.can_redefine_any_class"14687><code>can_redefine_any_class</code></internallink>14688and14689<internallink id="jvmtiCapabilities.can_generate_all_class_hook_events"14690><code>can_generate_all_class_hook_events</code></internallink>)14691and an error (<errorlink id="JVMTI_ERROR_UNMODIFIABLE_CLASS"></errorlink>)14692which allow some classes to be unmodifiable.14693</change>14694<change date="28 Febuary 2004" version="0.3.11">14695Add JVMTI_ERROR_MUST_POSSESS_CAPABILITY to SetEventNotificationMode.14696</change>14697<change date="8 March 2004" version="0.3.12">14698Clarified CompiledMethodUnload so that it is clear the event14699may be posted after the class has been unloaded.14700</change>14701<change date="5 March 2004" version="0.3.13">14702Change the size parameter of VMObjectAlloc to jlong to match GetObjectSize.14703</change>14704<change date="13 March 2004" version="0.3.14">14705Added guideline for the use of the JNI FindClass function in event14706callback functions.14707</change>14708<change date="15 March 2004" version="0.3.15">14709Add GetAllStackTraces and GetThreadListStackTraces.14710</change>14711<change date="19 March 2004" version="0.3.16">14712ClassLoad and ClassPrepare events can be posted during start phase.14713</change>14714<change date="25 March 2004" version="0.3.17">14715Add JVMTI_ERROR_NATIVE_METHOD to GetLineNumberTable, GetLocalVariableTable,14716GetMaxLocals, GetArgumentsSize, GetMethodLocation, GetBytecodes.14717</change>14718<change date="29 March 2004" version="0.3.18">14719Return the timer kind in the timer information structure.14720</change>14721<change date="31 March 2004" version="0.3.19">14722Spec clarifications:14723JVMTI_THREAD_STATE_IN_NATIVE might not include JNI or <jvmti/>.14724ForceGarbageCollection does not run finalizers.14725The context of the specification is the Java platform.14726Warn about early instrumentation.14727</change>14728<change date="1 April 2004" version="0.3.20">14729Refinements to the above clarifications and14730Clarify that an error returned by Agent_OnLoad terminates the VM.14731</change>14732<change date="1 April 2004" version="0.3.21">14733Array class creation does not generate a class load event.14734</change>14735<change date="7 April 2004" version="0.3.22">14736Align thread state hierarchy more closely with java.lang.Thread.State.14737</change>14738<change date="12 April 2004" version="0.3.23">14739Clarify the documentation of thread state.14740</change>14741<change date="19 April 2004" version="0.3.24">14742Remove GarbageCollectionOccurred event -- can be done by agent.14743</change>14744<change date="22 April 2004" version="0.3.25">14745Define "command-line option".14746</change>14747<change date="29 April 2004" version="0.3.26">14748Describe the intended use of bytecode instrumentation.14749Fix description of extension event first parameter.14750</change>14751<change date="30 April 2004" version="0.3.27">14752Clarification and typos.14753</change>14754<change date="18 May 2004" version="0.3.28">14755Remove DataDumpRequest event.14756</change>14757<change date="18 May 2004" version="0.3.29">14758Clarify RawMonitorWait with zero timeout.14759Clarify thread state after RunAgentThread.14760</change>14761<change date="24 May 2004" version="0.3.30">14762Clean-up: fix bad/old links, etc.14763</change>14764<change date="30 May 2004" version="0.3.31">14765Clarifications including:14766All character strings are modified UTF-8.14767Agent thread visibiity.14768Meaning of obsolete method version.14769Thread invoking heap callbacks,14770</change>14771<change date="1 June 2004" version="1.0.32">14772Bump major.minor version numbers to "1.0".14773</change>14774<change date="2 June 2004" version="1.0.33">14775Clarify interaction between ForceGarbageCollection14776and ObjectFree.14777</change>14778<change date="6 June 2004" version="1.0.34">14779Restrict AddToBootstrapClassLoaderSearch and14780SetSystemProperty to the OnLoad phase only.14781</change>14782<change date="11 June 2004" version="1.0.35">14783Fix typo in SetTag.14784</change>14785<change date="18 June 2004" version="1.0.36">14786Fix trademarks.14787Add missing parameter in example GetThreadState usage.14788</change>14789<change date="4 August 2004" version="1.0.37">14790Copyright updates.14791</change>14792<change date="5 November 2004" version="1.0.38">14793Add missing function table layout.14794Add missing description of C++ member function format of functions.14795Clarify that name in CFLH can be NULL.14796Released as part of <tm>J2SE</tm> 5.0.14797</change>14798<change date="24 April 2005" version="1.1.47">14799Bump major.minor version numbers to "1.1".14800Add ForceEarlyReturn* functions.14801Add GetOwnedMonitorStackDepthInfo function.14802Add GetCurrentThread function.14803Add "since" version marker.14804Add AddToSystemClassLoaderSearch.14805Allow AddToBootstrapClassLoaderSearch be used in live phase.14806Fix historic rubbish in the descriptions of the heap_object_callback14807parameter of IterateOverHeap and IterateOverInstancesOfClass functions;14808disallow NULL for this parameter.14809Clarify, correct and make consistent: wording about current thread,14810opaque frames and insufficient number of frames in PopFrame.14811Consistently use "current frame" rather than "topmost".14812Clarify the JVMTI_ERROR_TYPE_MISMATCH errors in GetLocal* and SetLocal*14813by making them compatible with those in ForceEarlyReturn*.14814Many other clarifications and wording clean ups.14815</change>14816<change date="25 April 2005" version="1.1.48">14817Add GetConstantPool.14818Switch references to the first edition of the VM Spec, to the seconds edition.14819</change>14820<change date="26 April 2005" version="1.1.49">14821Clarify minor/major version order in GetConstantPool.14822</change>14823<change date="26 April 2005" version="1.1.50">14824Add SetNativeMethodPrefix and SetNativeMethodPrefixes.14825Reassign GetOwnedMonitorStackDepthInfo to position 153.14826Break out Class Loader Search in its own documentation category.14827Deal with overly long lines in XML source.14828</change>14829<change date="29 April 2005" version="1.1.51">14830Allow agents be started in the live phase.14831Added paragraph about deploying agents.14832</change>14833<change date="30 April 2005" version="1.1.52">14834Add specification description to SetNativeMethodPrefix(es).14835Better define the conditions on GetConstantPool.14836</change>14837<change date="30 April 2005" version="1.1.53">14838Break out the GetClassVersionNumber function from GetConstantPool.14839Clean-up the references to the VM Spec.14840</change>14841<change date="1 May 2005" version="1.1.54">14842Allow SetNativeMethodPrefix(es) in any phase.14843Add clarifications about the impact of redefinition on GetConstantPool.14844</change>14845<change date="2 May 2005" version="1.1.56">14846Various clarifications to SetNativeMethodPrefix(es).14847</change>14848<change date="2 May 2005" version="1.1.57">14849Add missing performance warning to the method entry event.14850</change>14851<change date="5 May 2005" version="1.1.58">14852Remove internal JVMDI support.14853</change>14854<change date="8 May 2005" version="1.1.59">14855Add <functionlink id="RetransformClasses"/>.14856Revamp the bytecode instrumentation documentation.14857Change <functionlink id="IsMethodObsolete"/> to no longer14858require the can_redefine_classes capability.14859</change>14860<change date="11 May 2005" version="1.1.63">14861Clarifications for retransformation.14862</change>14863<change date="11 May 2005" version="1.1.64">14864Clarifications for retransformation, per review.14865Lock "retransformation (in)capable" at class load enable time.14866</change>14867<change date="4 June 2005" version="1.1.67">14868Add new heap functionity which supports reporting primitive values,14869allows setting the referrer tag, and has more powerful filtering:14870FollowReferences, IterateThroughHeap, and their associated14871callbacks, structs, enums, and constants.14872</change>14873<change date="4 June 2005" version="1.1.68">14874Clarification.14875</change>14876<change date="6 June 2005" version="1.1.69">14877FollowReferences, IterateThroughHeap: Put callbacks in a struct;14878Add missing error codes; reduce bits in the visit control flags.14879</change>14880<change date="14 June 2005" version="1.1.70">14881More on new heap functionity: spec clean-up per review.14882</change>14883<change date="15 June 2005" version="1.1.71">14884More on new heap functionity: Rename old heap section to Heap (1.0).14885</change>14886<change date="21 June 2005" version="1.1.72">14887Fix typos.14888</change>14889<change date="27 June 2005" version="1.1.73">14890Make referrer info structure a union.14891</change>14892<change date="9 September 2005" version="1.1.74">14893In new heap functions:14894Add missing superclass reference kind.14895Use a single scheme for computing field indexes.14896Remove outdated references to struct based referrer info.14897</change>14898<change date="12 September 2005" version="1.1.75">14899Don't callback during FollowReferences on frivolous java.lang.Object superclass.14900</change>14901<change date="13 September 2005" version="1.1.76">14902In string primitive callback, length now Unicode length.14903In array and string primitive callbacks, value now "const".14904Note possible compiler impacts on setting JNI function table.14905</change>14906<change date="13 September 2005" version="1.1.77">14907GetClassVersionNumbers() and GetConstantPool() should return14908error on array or primitive class.14909</change>14910<change date="14 September 2005" version="1.1.78">14911Grammar fixes.14912</change>14913<change date="26 September 2005" version="1.1.79">14914Add IsModifiableClass query.14915</change>14916<change date="9 February 2006" version="1.1.81">14917Add referrer_class_tag parameter to jvmtiHeapReferenceCallback.14918</change>14919<change date="13 February 2006" version="1.1.82">14920Doc fixes: update can_redefine_any_class to include retransform.14921Clarify that exception events cover all Throwables.14922In GetStackTrace, no test is done for start_depth too big if start_depth is zero,14923Clarify fields reported in Primitive Field Callback -- static vs instance.14924Repair confusing names of heap types, including callback names.14925Require consistent usage of stack depth in the face of thread launch methods.14926Note incompatibility of <jvmti/> memory management with other systems.14927</change>14928<change date="14 February 2006" version="1.1.85">14929Fix typos and missing renames.14930</change>14931<change date="13 March 2006" version="1.1.86">14932Clarify that jmethodIDs and jfieldIDs can be saved.14933Clarify that Iterate Over Instances Of Class includes subclasses.14934</change>14935<change date="14 March 2006" version="1.1.87">14936Better phrasing.14937</change>14938<change date="16 March 2006" version="1.1.88">14939Match the referrer_index for static fields in Object Reference Callback14940with the Reference Implementation (and all other known implementations);14941that is, make it match the definition for instance fields.14942In GetThreadListStackTraces, add JVMTI_ERROR_INVALID_THREAD to cover14943an invalid thread in the list; and specify that not started threads14944return empty stacks.14945</change>14946<change date="17 March 2006" version="1.1.89">14947Typo.14948</change>14949<change date="25 March 2006" version="1.1.90">14950Typo.14951</change>14952<change date="6 April 2006" version="1.1.91">14953Remove restrictions on AddToBootstrapClassLoaderSearch and14954AddToSystemClassLoaderSearch.14955</change>14956<change date="1 May 2006" version="1.1.93">14957Changed spec to return -1 for monitor stack depth for the14958implementation which can not determine stack depth.14959</change>14960<change date="3 May 2006" version="1.1.94">14961Corrections for readability and accuracy courtesy of Alan Pratt of IBM.14962List the object relationships reported in FollowReferences.14963</change>14964<change date="5 May 2006" version="1.1.95">14965Clarify the object relationships reported in FollowReferences.14966</change>14967<change date="28 June 2006" version="1.1.98">14968Clarify DisposeEnvironment; add warning.14969Fix typos in SetLocalXXX "retrieve" => "set".14970Clarify that native method prefixes must remain set while used.14971Clarify that exactly one Agent_OnXXX is called per agent.14972Clarify that library loading is independent from start-up.14973Remove ambiguous reference to Agent_OnLoad in the Agent_OnUnload spec.14974</change>14975<change date="31 July 2006" version="1.1.99">14976Clarify the interaction between functions and exceptions.14977Clarify and give examples of field indices.14978Remove confusing "That is" sentence from MonitorWait and MonitorWaited events.14979Update links to point to Java 6.14980</change>14981<change date="6 August 2006" version="1.1.102">14982Add ResourceExhaustedEvent.14983</change>14984<change date="11 October 2012" version="1.2.2">14985Fixed the "HTTP" and "Missing Anchor" errors reported by the LinkCheck tool.14986</change>14987<change date="19 June 2013" version="1.2.3">14988Added support for statically linked agents.14989</change>14990<change date="13 October 2016" version="9.0.0">14991Support for modules:14992- The majorversion is 9 now14993- The ClassFileLoadHook events are not sent during the primordial phase anymore.14994- Allow CompiledMethodLoad events at start phase14995- Add new capabilities:14996- can_generate_early_vmstart14997- can_generate_early_class_hook_events14998- Add new functions:14999- GetAllModules15000- AddModuleReads, AddModuleExports, AddModuleOpens, AddModuleUses, AddModuleProvides15001- IsModifiableModule15002Clarified can_redefine_any_classes, can_retransform_any_classes and IsModifiableClass API to15003disallow some implementation defined classes.15004</change>15005<change date="12 February 2017" version="9.0.0">15006Minor update for GetCurrentThread function:15007- The function may return NULL in the start phase if the15008can_generate_early_vmstart capability is enabled.15009</change>15010<change date="7 February 2018" version="11.0.0">15011Minor update for new class file NestHost and NestMembers attributes:15012- Specify that RedefineClasses and RetransformClasses are not allowed15013to change the class file NestHost and NestMembers attributes.15014- Add new error JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_ATTRIBUTE_CHANGED15015that can be returned by RedefineClasses and RetransformClasses.15016</change>15017<change date="20 May 2019" version="13.0.0">15018Minor spec update for the capability "can_redefine_any_class".15019It now says:15020"RedefineClasses can be called on any modifiable class. See IsModifiableClass.15021(can_redefine_classes must also be set)"15022</change>15023<change date="5 June 2019" version="13.0.0">15024Minor PopFrame spec update:15025- The specified thread must be suspended or must be the current thread.15026(It was not allowed to be the current thread before.)15027</change>15028<change date="10 October 2019" version="14.0.0">15029Minor update for new class file Record attribute:15030- Specify that RedefineClasses and RetransformClasses are not allowed15031to change the class file Record attribute.15032</change>15033<change date="13 May 2020" version="15.0.0">15034Minor update for new class file PermittedSubclasses attribute:15035- Specify that RedefineClasses and RetransformClasses are not allowed15036to change the class file PermittedSubclasses attribute.15037</change>15038<change date="15 January 2021" version="17.0.0">15039Minor clarification in the section "Agent Shutdown" that says the15040implementation may choose to not call the Agent_OnUnload function15041if the Agent_OnAttach/Agent_OnAttach_L function reported an error.15042</change>15043<change date="8 June 2021" version="17.0.0">15044Minor update to deprecate Heap functions 1.0.15045</change>15046</changehistory>1504715048</specification>15049<!-- Keep this comment at the end of the file15050Local variables:15051mode: sgml15052sgml-omittag:t15053sgml-shorttag:t15054sgml-namecase-general:t15055sgml-general-insert-case:lower15056sgml-minimize-attributes:nil15057sgml-always-quote-attributes:t15058sgml-indent-step:215059sgml-indent-data:t15060sgml-parent-document:nil15061sgml-exposed-tags:nil15062sgml-local-catalogs:nil15063sgml-local-ecat-files:nil15064End:15065-->150661506715068