Path: blob/master/src/hotspot/share/prims/jvmti.xml
41145 views
<?xml version="1.0" encoding="ISO-8859-1"?>1<?xml-stylesheet type="text/xsl" href="jvmti.xsl"?>2<!--3Copyright (c) 2002, 2020, 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 and have been superseded by more4966</b>4967<internallink id="Heap"><b>powerful and flexible versions</b></internallink>4968<b>4969which:4970</b>4971<ul>4972<li>4973<b>4974Allow access to primitive values (the value of Strings, arrays,4975and primitive fields)4976</b>4977</li>4978<li>4979<b>4980Allow the tag of the referrer to be set, thus enabling more4981efficient localized reference graph building4982</b>4983</li>4984<li>4985<b>4986Provide more extensive filtering abilities4987</b>4988</li>4989<li>4990<b>4991Are extensible, allowing their abilities to grow in future versions of <jvmti/>4992</b>4993</li>4994</ul>4995<p/>4996<b>Please use the </b>4997<internallink id="Heap"><b>current Heap functions</b></internallink>.4998<p/>4999<constants id="jvmtiHeapObjectFilter" label="Heap Object Filter Enumeration" kind="enum">5000<constant id="JVMTI_HEAP_OBJECT_TAGGED" num="1">5001Tagged objects only.5002</constant>5003<constant id="JVMTI_HEAP_OBJECT_UNTAGGED" num="2">5004Untagged objects only.5005</constant>5006<constant id="JVMTI_HEAP_OBJECT_EITHER" num="3">5007Either tagged or untagged objects.5008</constant>5009</constants>50105011<constants id="jvmtiHeapRootKind" label="Heap Root Kind Enumeration" kind="enum">5012<constant id="JVMTI_HEAP_ROOT_JNI_GLOBAL" num="1">5013JNI global reference.5014</constant>5015<constant id="JVMTI_HEAP_ROOT_SYSTEM_CLASS" num="2">5016System class.5017</constant>5018<constant id="JVMTI_HEAP_ROOT_MONITOR" num="3">5019Monitor.5020</constant>5021<constant id="JVMTI_HEAP_ROOT_STACK_LOCAL" num="4">5022Stack local.5023</constant>5024<constant id="JVMTI_HEAP_ROOT_JNI_LOCAL" num="5">5025JNI local reference.5026</constant>5027<constant id="JVMTI_HEAP_ROOT_THREAD" num="6">5028Thread.5029</constant>5030<constant id="JVMTI_HEAP_ROOT_OTHER" num="7">5031Other.5032</constant>5033</constants>50345035<constants id="jvmtiObjectReferenceKind" label="Object Reference Enumeration" kind="enum">5036<constant id="JVMTI_REFERENCE_CLASS" num="1">5037Reference from an object to its class.5038</constant>5039<constant id="JVMTI_REFERENCE_FIELD" num="2">5040Reference from an object to the value of one of its instance fields.5041For references of this kind the <code>referrer_index</code>5042parameter to the <internallink id="jvmtiObjectReferenceCallback">5043jvmtiObjectReferenceCallback</internallink> is the index of the5044the instance field. The index is based on the order of all the5045object's fields. This includes all fields of the directly declared5046static and instance fields in the class, and includes all fields (both5047public and private) fields declared in superclasses and superinterfaces.5048The index is thus calculated by summing the index of the field in the directly5049declared class (see <functionlink id="GetClassFields"/>), with the total5050number of fields (both public and private) declared in all superclasses5051and superinterfaces. The index starts at zero.5052</constant>5053<constant id="JVMTI_REFERENCE_ARRAY_ELEMENT" num="3">5054Reference from an array to one of its elements.5055For references of this kind the <code>referrer_index</code>5056parameter to the <internallink id="jvmtiObjectReferenceCallback">5057jvmtiObjectReferenceCallback</internallink> is the array index.5058</constant>5059<constant id="JVMTI_REFERENCE_CLASS_LOADER" num="4">5060Reference from a class to its class loader.5061</constant>5062<constant id="JVMTI_REFERENCE_SIGNERS" num="5">5063Reference from a class to its signers array.5064</constant>5065<constant id="JVMTI_REFERENCE_PROTECTION_DOMAIN" num="6">5066Reference from a class to its protection domain.5067</constant>5068<constant id="JVMTI_REFERENCE_INTERFACE" num="7">5069Reference from a class to one of its interfaces.5070</constant>5071<constant id="JVMTI_REFERENCE_STATIC_FIELD" num="8">5072Reference from a class to the value of one of its static fields.5073For references of this kind the <code>referrer_index</code>5074parameter to the <internallink id="jvmtiObjectReferenceCallback">5075jvmtiObjectReferenceCallback</internallink> is the index of the5076the static field. The index is based on the order of all the5077object's fields. This includes all fields of the directly declared5078static and instance fields in the class, and includes all fields (both5079public and private) fields declared in superclasses and superinterfaces.5080The index is thus calculated by summing the index of the field in the directly5081declared class (see <functionlink id="GetClassFields"/>), with the total5082number of fields (both public and private) declared in all superclasses5083and superinterfaces. The index starts at zero.5084Note: this definition differs from that in the <jvmti/> 1.0 Specification.5085<rationale>No known implementations used the 1.0 definition.</rationale>5086</constant>5087<constant id="JVMTI_REFERENCE_CONSTANT_POOL" num="9">5088Reference from a class to a resolved entry in the constant pool.5089For references of this kind the <code>referrer_index</code>5090parameter to the <internallink id="jvmtiObjectReferenceCallback">5091jvmtiObjectReferenceCallback</internallink> is the index into5092constant pool table of the class, starting at 1. See5093<vmspec chapter="4.4"/>.5094</constant>5095</constants>50965097<constants id="jvmtiIterationControl" label="Iteration Control Enumeration" kind="enum">5098<constant id="JVMTI_ITERATION_CONTINUE" num="1">5099Continue the iteration.5100If this is a reference iteration, follow the references of this object.5101</constant>5102<constant id="JVMTI_ITERATION_IGNORE" num="2">5103Continue the iteration.5104If this is a reference iteration, ignore the references of this object.5105</constant>5106<constant id="JVMTI_ITERATION_ABORT" num="0">5107Abort the iteration.5108</constant>5109</constants>5110</intro>51115112<callback id="jvmtiHeapObjectCallback">5113<enum>jvmtiIterationControl</enum>5114<synopsis>Heap Object Callback</synopsis>5115<description>5116Agent supplied callback function.5117Describes (but does not pass in) an object in the heap.5118<p/>5119Return value should be <code>JVMTI_ITERATION_CONTINUE</code> to continue iteration,5120or <code>JVMTI_ITERATION_ABORT</code> to stop iteration.5121<p/>5122See the <internallink id="heapCallbacks">heap callback5123function restrictions</internallink>.5124</description>5125<parameters>5126<param id="class_tag">5127<jlong/>5128<description>5129The tag of the class of object (zero if the class is not tagged).5130If the object represents a runtime class,5131the <code>class_tag</code> is the tag5132associated with <code>java.lang.Class</code>5133(zero if <code>java.lang.Class</code> is not tagged).5134</description>5135</param>5136<param id="size">5137<jlong/>5138<description>5139Size of the object (in bytes). See <functionlink id="GetObjectSize"/>.5140</description>5141</param>5142<param id="tag_ptr">5143<outptr><jlong/></outptr>5144<description>5145The object tag value, or zero if the object is not tagged.5146To set the tag value to be associated with the object5147the agent sets the <code>jlong</code> pointed to by the parameter.5148</description>5149</param>5150<param id="user_data">5151<outptr><void/></outptr>5152<description>5153The user supplied data that was passed into the iteration function.5154</description>5155</param>5156</parameters>5157</callback>51585159<callback id="jvmtiHeapRootCallback">5160<enum>jvmtiIterationControl</enum>5161<synopsis>Heap Root Object Callback</synopsis>5162<description>5163Agent supplied callback function.5164Describes (but does not pass in) an object that is a root for the purposes5165of garbage collection.5166<p/>5167Return value should be <code>JVMTI_ITERATION_CONTINUE</code> to continue iteration,5168<code>JVMTI_ITERATION_IGNORE</code> to continue iteration without pursuing5169references from referree object or <code>JVMTI_ITERATION_ABORT</code> to stop iteration.5170<p/>5171See the <internallink id="heapCallbacks">heap callback5172function restrictions</internallink>.5173</description>5174<parameters>5175<param id="root_kind">5176<enum>jvmtiHeapRootKind</enum>5177<description>5178The kind of heap root.5179</description>5180</param>5181<param id="class_tag">5182<jlong/>5183<description>5184The tag of the class of object (zero if the class is not tagged).5185If the object represents a runtime class, the <code>class_tag</code> is the tag5186associated with <code>java.lang.Class</code>5187(zero if <code>java.lang.Class</code> is not tagged).5188</description>5189</param>5190<param id="size">5191<jlong/>5192<description>5193Size of the object (in bytes). See <functionlink id="GetObjectSize"/>.5194</description>5195</param>5196<param id="tag_ptr">5197<outptr><jlong/></outptr>5198<description>5199The object tag value, or zero if the object is not tagged.5200To set the tag value to be associated with the object5201the agent sets the <code>jlong</code> pointed to by the parameter.5202</description>5203</param>5204<param id="user_data">5205<outptr><void/></outptr>5206<description>5207The user supplied data that was passed into the iteration function.5208</description>5209</param>5210</parameters>5211</callback>52125213<callback id="jvmtiStackReferenceCallback">5214<enum>jvmtiIterationControl</enum>5215<synopsis>Stack Reference Object Callback</synopsis>5216<description>5217Agent supplied callback function.5218Describes (but does not pass in) an object on the stack that is a root for5219the purposes of garbage collection.5220<p/>5221Return value should be <code>JVMTI_ITERATION_CONTINUE</code> to continue iteration,5222<code>JVMTI_ITERATION_IGNORE</code> to continue iteration without pursuing5223references from referree object or <code>JVMTI_ITERATION_ABORT</code> to stop iteration.5224<p/>5225See the <internallink id="heapCallbacks">heap callback5226function restrictions</internallink>.5227</description>5228<parameters>5229<param id="root_kind">5230<enum>jvmtiHeapRootKind</enum>5231<description>5232The kind of root (either <code>JVMTI_HEAP_ROOT_STACK_LOCAL</code> or5233<code>JVMTI_HEAP_ROOT_JNI_LOCAL</code>).5234</description>5235</param>5236<param id="class_tag">5237<jlong/>5238<description>5239The tag of the class of object (zero if the class is not tagged).5240If the object represents a runtime class, the <code>class_tag</code> is the tag5241associated with <code>java.lang.Class</code>5242(zero if <code>java.lang.Class</code> is not tagged).5243</description>5244</param>5245<param id="size">5246<jlong/>5247<description>5248Size of the object (in bytes). See <functionlink id="GetObjectSize"/>.5249</description>5250</param>5251<param id="tag_ptr">5252<outptr><jlong/></outptr>5253<description>5254The object tag value, or zero if the object is not tagged.5255To set the tag value to be associated with the object5256the agent sets the <code>jlong</code> pointed to by the parameter.5257</description>5258</param>5259<param id="thread_tag">5260<jlong/>5261<description>5262The tag of the thread corresponding to this stack, zero if not tagged.5263</description>5264</param>5265<param id="depth">5266<jint/>5267<description>5268The depth of the frame.5269</description>5270</param>5271<param id="method">5272<jmethodID/>5273<description>5274The method executing in this frame.5275</description>5276</param>5277<param id="slot">5278<jint/>5279<description>5280The slot number.5281</description>5282</param>5283<param id="user_data">5284<outptr><void/></outptr>5285<description>5286The user supplied data that was passed into the iteration function.5287</description>5288</param>5289</parameters>5290</callback>52915292<callback id="jvmtiObjectReferenceCallback">5293<enum>jvmtiIterationControl</enum>5294<synopsis>Object Reference Callback</synopsis>5295<description>5296Agent supplied callback function.5297Describes a reference from an object (the referrer) to another object5298(the referree).5299<p/>5300Return value should be <code>JVMTI_ITERATION_CONTINUE</code> to continue iteration,5301<code>JVMTI_ITERATION_IGNORE</code> to continue iteration without pursuing5302references from referree object or <code>JVMTI_ITERATION_ABORT</code> to stop iteration.5303<p/>5304See the <internallink id="heapCallbacks">heap callback5305function restrictions</internallink>.5306</description>5307<parameters>5308<param id="reference_kind">5309<enum>jvmtiObjectReferenceKind</enum>5310<description>5311The type of reference.5312</description>5313</param>5314<param id="class_tag">5315<jlong/>5316<description>5317The tag of the class of referree object (zero if the class is not tagged).5318If the referree object represents a runtime class,5319the <code>class_tag</code> is the tag5320associated with <code>java.lang.Class</code>5321(zero if <code>java.lang.Class</code> is not tagged).5322</description>5323</param>5324<param id="size">5325<jlong/>5326<description>5327Size of the referree object (in bytes).5328See <functionlink id="GetObjectSize"/>.5329</description>5330</param>5331<param id="tag_ptr">5332<outptr><jlong/></outptr>5333<description>5334The referree object tag value, or zero if the object is not5335tagged.5336To set the tag value to be associated with the object5337the agent sets the <code>jlong</code> pointed to by the parameter.5338</description>5339</param>5340<param id="referrer_tag">5341<jlong/>5342<description>5343The tag of the referrer object, or zero if the referrer5344object is not tagged.5345</description>5346</param>5347<param id="referrer_index">5348<jint/>5349<description>5350For references of type <code>JVMTI_REFERENCE_FIELD</code> or5351<code>JVMTI_REFERENCE_STATIC_FIELD</code> the index5352of the field in the referrer object. The index is based on the5353order of all the object's fields - see <internallink5354id="JVMTI_REFERENCE_FIELD">JVMTI_REFERENCE_FIELD</internallink>5355or <internallink5356id="JVMTI_REFERENCE_STATIC_FIELD">JVMTI_REFERENCE_STATIC_FIELD5357</internallink> for further description.5358<p/>5359For references of type <code>JVMTI_REFERENCE_ARRAY_ELEMENT</code>5360the array index - see <internallink id="JVMTI_REFERENCE_ARRAY_ELEMENT">5361JVMTI_REFERENCE_ARRAY_ELEMENT</internallink> for further description.5362<p/>5363For references of type <code>JVMTI_REFERENCE_CONSTANT_POOL</code>5364the index into the constant pool of the class - see5365<internallink id="JVMTI_REFERENCE_CONSTANT_POOL">5366JVMTI_REFERENCE_CONSTANT_POOL</internallink> for further5367description.5368<p/>5369For references of other kinds the <code>referrer_index</code> is5370<code>-1</code>.5371</description>5372</param>5373<param id="user_data">5374<outptr><void/></outptr>5375<description>5376The user supplied data that was passed into the iteration function.5377</description>5378</param>5379</parameters>5380</callback>53815382<function id="IterateOverObjectsReachableFromObject" num="109">5383<synopsis>Iterate Over Objects Reachable From Object</synopsis>5384<description>5385This function iterates over all objects that are directly5386and indirectly reachable from the specified object.5387For each object <i>A</i> (known5388as the referrer) with a reference to object <i>B</i> the specified5389callback function is called to describe the object reference.5390The callback is called exactly once for each reference from a referrer;5391this is true even if there are reference cycles or multiple paths to5392the referrer.5393There may be more than one reference between a referrer and a referree,5394These may be distinguished by the5395<datalink id="jvmtiObjectReferenceCallback.reference_kind"></datalink> and5396<datalink id="jvmtiObjectReferenceCallback.referrer_index"></datalink>.5397The callback for an object will always occur after the callback for5398its referrer.5399<p/>5400See <functionlink id="FollowReferences"/> for the object5401references which are reported.5402<p/>5403During the execution of this function the state of the heap5404does not change: no objects are allocated, no objects are5405garbage collected, and the state of objects (including5406held values) does not change.5407As a result, threads executing Java5408programming language code, threads attempting to resume the5409execution of Java programming language code, and threads5410attempting to execute JNI functions are typically stalled.5411</description>5412<origin>new</origin>5413<capabilities>5414<required id="can_tag_objects"></required>5415</capabilities>5416<parameters>5417<param id="object">5418<jobject/>5419<description>5420The object5421</description>5422</param>5423<param id="object_reference_callback">5424<ptrtype>5425<struct>jvmtiObjectReferenceCallback</struct>5426</ptrtype>5427<description>5428The callback to be called to describe each5429object reference.5430</description>5431</param>5432<param id="user_data">5433<inbuf>5434<void/>5435<nullok><code>NULL</code> is passed as the user supplied data</nullok>5436</inbuf>5437<description>5438User supplied data to be passed to the callback.5439</description>5440</param>5441</parameters>5442<errors>5443</errors>5444</function>54455446<function id="IterateOverReachableObjects" num="110">5447<synopsis>Iterate Over Reachable Objects</synopsis>5448<description>5449This function iterates over the root objects and all objects that5450are directly and indirectly reachable from the root objects.5451The root objects comprise the set of system classes,5452JNI globals, references from thread stacks, and other objects used as roots5453for the purposes of garbage collection.5454<p/>5455For each root the <paramlink id="heap_root_callback"></paramlink>5456or <paramlink id="stack_ref_callback"></paramlink> callback is called.5457An object can be a root object for more than one reason and in that case5458the appropriate callback is called for each reason.5459<p/>5460For each object reference the <paramlink id="object_ref_callback"></paramlink>5461callback function is called to describe the object reference.5462The callback is called exactly once for each reference from a referrer;5463this is true even if there are reference cycles or multiple paths to5464the referrer.5465There may be more than one reference between a referrer and a referree,5466These may be distinguished by the5467<datalink id="jvmtiObjectReferenceCallback.reference_kind"></datalink> and5468<datalink id="jvmtiObjectReferenceCallback.referrer_index"></datalink>.5469The callback for an object will always occur after the callback for5470its referrer.5471<p/>5472See <functionlink id="FollowReferences"/> for the object5473references which are reported.5474<p/>5475Roots are always reported to the profiler before any object references5476are reported. In other words, the <paramlink id="object_ref_callback"></paramlink>5477callback will not be called until the appropriate callback has been called5478for all roots. If the <paramlink id="object_ref_callback"></paramlink> callback is5479specified as <code>NULL</code> then this function returns after5480reporting the root objects to the profiler.5481<p/>5482During the execution of this function the state of the heap5483does not change: no objects are allocated, no objects are5484garbage collected, and the state of objects (including5485held values) does not change.5486As a result, threads executing Java5487programming language code, threads attempting to resume the5488execution of Java programming language code, and threads5489attempting to execute JNI functions are typically stalled.5490</description>5491<origin>new</origin>5492<capabilities>5493<required id="can_tag_objects"></required>5494</capabilities>5495<parameters>5496<param id="heap_root_callback">5497<ptrtype>5498<struct>jvmtiHeapRootCallback</struct>5499<nullok>do not report heap roots</nullok>5500</ptrtype>5501<description>5502The callback function to be called for each heap root of type5503<code>JVMTI_HEAP_ROOT_JNI_GLOBAL</code>,5504<code>JVMTI_HEAP_ROOT_SYSTEM_CLASS</code>,5505<code>JVMTI_HEAP_ROOT_MONITOR</code>,5506<code>JVMTI_HEAP_ROOT_THREAD</code>, or5507<code>JVMTI_HEAP_ROOT_OTHER</code>.5508</description>5509</param>5510<param id="stack_ref_callback">5511<ptrtype>5512<struct>jvmtiStackReferenceCallback</struct>5513<nullok>do not report stack references</nullok>5514</ptrtype>5515<description>5516The callback function to be called for each heap root of5517<code>JVMTI_HEAP_ROOT_STACK_LOCAL</code> or5518<code>JVMTI_HEAP_ROOT_JNI_LOCAL</code>.5519</description>5520</param>5521<param id="object_ref_callback">5522<ptrtype>5523<struct>jvmtiObjectReferenceCallback</struct>5524<nullok>do not follow references from the root objects</nullok>5525</ptrtype>5526<description>5527The callback function to be called for each object reference.5528</description>5529</param>5530<param id="user_data">5531<inbuf>5532<void/>5533<nullok><code>NULL</code> is passed as the user supplied data</nullok>5534</inbuf>5535<description>5536User supplied data to be passed to the callback.5537</description>5538</param>5539</parameters>5540<errors>5541</errors>5542</function>55435544<function id="IterateOverHeap" num="111">5545<synopsis>Iterate Over Heap</synopsis>5546<description>5547Iterate over all objects in the heap. This includes both reachable and5548unreachable objects.5549<p/>5550The <paramlink id="object_filter"></paramlink> parameter indicates the5551objects for which the callback function is called. If this parameter5552is <code>JVMTI_HEAP_OBJECT_TAGGED</code> then the callback will only be5553called for every object that is tagged. If the parameter is5554<code>JVMTI_HEAP_OBJECT_UNTAGGED</code> then the callback will only be5555for objects that are not tagged. If the parameter5556is <code>JVMTI_HEAP_OBJECT_EITHER</code> then the callback will be5557called for every object in the heap, irrespective of whether it is5558tagged or not.5559<p/>5560During the execution of this function the state of the heap5561does not change: no objects are allocated, no objects are5562garbage collected, and the state of objects (including5563held values) does not change.5564As a result, threads executing Java5565programming language code, threads attempting to resume the5566execution of Java programming language code, and threads5567attempting to execute JNI functions are typically stalled.5568</description>5569<origin>new</origin>5570<capabilities>5571<required id="can_tag_objects"></required>5572</capabilities>5573<parameters>5574<param id="object_filter">5575<enum>jvmtiHeapObjectFilter</enum>5576<description>5577Indicates the objects for which the callback function is called.5578</description>5579</param>5580<param id="heap_object_callback">5581<ptrtype>5582<struct>jvmtiHeapObjectCallback</struct>5583</ptrtype>5584<description>5585The iterator function to be called for each5586object matching the <paramlink id="object_filter"/>.5587</description>5588</param>5589<param id="user_data">5590<inbuf>5591<void/>5592<nullok><code>NULL</code> is passed as the user supplied data</nullok>5593</inbuf>5594<description>5595User supplied data to be passed to the callback.5596</description>5597</param>5598</parameters>5599<errors>5600</errors>5601</function>56025603<function id="IterateOverInstancesOfClass" num="112">5604<synopsis>Iterate Over Instances Of Class</synopsis>5605<description>5606Iterate over all objects in the heap that are instances of the specified class.5607This includes direct instances of the specified class and5608instances of all subclasses of the specified class.5609This includes both reachable and unreachable objects.5610<p/>5611The <paramlink id="object_filter"></paramlink> parameter indicates the5612objects for which the callback function is called. If this parameter5613is <code>JVMTI_HEAP_OBJECT_TAGGED</code> then the callback will only be5614called for every object that is tagged. If the parameter is5615<code>JVMTI_HEAP_OBJECT_UNTAGGED</code> then the callback will only be5616called for objects that are not tagged. If the parameter5617is <code>JVMTI_HEAP_OBJECT_EITHER</code> then the callback will be5618called for every object in the heap, irrespective of whether it is5619tagged or not.5620<p/>5621During the execution of this function the state of the heap5622does not change: no objects are allocated, no objects are5623garbage collected, and the state of objects (including5624held values) does not change.5625As a result, threads executing Java5626programming language code, threads attempting to resume the5627execution of Java programming language code, and threads5628attempting to execute JNI functions are typically stalled.5629</description>5630<origin>new</origin>5631<capabilities>5632<required id="can_tag_objects"></required>5633</capabilities>5634<parameters>5635<param id="klass">5636<jclass/>5637<description>5638Iterate over objects of this class only.5639</description>5640</param>5641<param id="object_filter">5642<enum>jvmtiHeapObjectFilter</enum>5643<description>5644Indicates the objects for which the callback function is called.5645</description>5646</param>5647<param id="heap_object_callback">5648<ptrtype>5649<struct>jvmtiHeapObjectCallback</struct>5650</ptrtype>5651<description>5652The iterator function to be called for each5653<paramlink id="klass"/> instance matching5654the <paramlink id="object_filter"/>.5655</description>5656</param>5657<param id="user_data">5658<inbuf>5659<void/>5660<nullok><code>NULL</code> is passed as the user supplied data</nullok>5661</inbuf>5662<description>5663User supplied data to be passed to the callback.5664</description>5665</param>5666</parameters>5667<errors>5668</errors>5669</function>56705671</category>56725673<category id="local" label="Local Variable">56745675<intro>5676These functions are used to retrieve or set the value of a local variable.5677The variable is identified by the depth of the frame containing its5678value and the variable's slot number within that frame.5679The mapping of variables to5680slot numbers can be obtained with the function5681<functionlink id="GetLocalVariableTable"></functionlink>.5682</intro>56835684<function id="GetLocalObject" num="21">5685<synopsis>Get Local Variable - Object</synopsis>5686<description>5687This function can be used to retrieve the value of a local5688variable whose type is <code>Object</code> or a subclass of <code>Object</code>.5689</description>5690<origin>jvmdi</origin>5691<capabilities>5692<required id="can_access_local_variables"></required>5693</capabilities>5694<parameters>5695<param id="thread">5696<jthread null="current" frame="frame"/>5697<description>5698The thread of the frame containing the variable's value.5699</description>5700</param>5701<param id="depth">5702<jframeID thread="thread"/>5703<description>5704The depth of the frame containing the variable's value.5705</description>5706</param>5707<param id="slot">5708<jint/>5709<description>5710The variable's slot number.5711</description>5712</param>5713<param id="value_ptr">5714<outptr><jobject/></outptr>5715<description>5716On return, points to the variable's value.5717</description>5718</param>5719</parameters>5720<errors>5721<error id="JVMTI_ERROR_INVALID_SLOT">5722Invalid <code>slot</code>.5723</error>5724<error id="JVMTI_ERROR_TYPE_MISMATCH">5725The variable type is not5726<code>Object</code> or a subclass of <code>Object</code>.5727</error>5728<error id="JVMTI_ERROR_OPAQUE_FRAME">5729Not a visible frame5730</error>5731</errors>5732</function>57335734<function id="GetLocalInstance" num="155" since="1.2">5735<synopsis>Get Local Instance</synopsis>5736<description>5737This function can be used to retrieve the value of the local object5738variable at slot 0 (the "<code>this</code>" object) from non-static5739frames. This function can retrieve the "<code>this</code>" object from5740native method frames, whereas <code>GetLocalObject()</code> would5741return <code>JVMTI_ERROR_OPAQUE_FRAME</code> in those cases.5742</description>5743<origin>new</origin>5744<capabilities>5745<required id="can_access_local_variables"></required>5746</capabilities>5747<parameters>5748<param id="thread">5749<jthread null="current" frame="frame"/>5750<description>5751The thread of the frame containing the variable's value.5752</description>5753</param>5754<param id="depth">5755<jframeID thread="thread"/>5756<description>5757The depth of the frame containing the variable's value.5758</description>5759</param>5760<param id="value_ptr">5761<outptr><jobject/></outptr>5762<description>5763On return, points to the variable's value.5764</description>5765</param>5766</parameters>5767<errors>5768<error id="JVMTI_ERROR_INVALID_SLOT">5769If the specified frame is a static method frame.5770</error>5771</errors>5772</function>5773<function id="GetLocalInt" num="22">5774<synopsis>Get Local Variable - Int</synopsis>5775<description>5776This function can be used to retrieve the value of a local5777variable whose type is <code>int</code>,5778<code>short</code>, <code>char</code>, <code>byte</code>, or5779<code>boolean</code>.5780</description>5781<origin>jvmdi</origin>5782<capabilities>5783<required id="can_access_local_variables"></required>5784</capabilities>5785<parameters>5786<param id="thread">5787<jthread null="current" frame="frame"/>5788<description>5789The thread of the frame containing the variable's value.5790</description>5791</param>5792<param id="depth">5793<jframeID thread="thread"/>5794<description>5795The depth of the frame containing the variable's value.5796</description>5797</param>5798<param id="slot">5799<jint/>5800<description>5801The variable's slot number.5802</description>5803</param>5804<param id="value_ptr">5805<outptr><jint/></outptr>5806<description>5807On return, points to the variable's value.5808</description>5809</param>5810</parameters>5811<errors>5812<error id="JVMTI_ERROR_INVALID_SLOT">5813Invalid <code>slot</code>.5814</error>5815<error id="JVMTI_ERROR_TYPE_MISMATCH">5816The variable type is not5817<code>int</code>, <code>short</code>,5818<code>char</code>, <code>byte</code>, or5819<code>boolean</code>.5820</error>5821<error id="JVMTI_ERROR_OPAQUE_FRAME">5822Not a visible frame5823</error>5824</errors>5825</function>58265827<function id="GetLocalLong" num="23">5828<synopsis>Get Local Variable - Long</synopsis>5829<description>5830This function can be used to retrieve the value of a local5831variable whose type is <code>long</code>.5832</description>5833<origin>jvmdi</origin>5834<capabilities>5835<required id="can_access_local_variables"></required>5836</capabilities>5837<parameters>5838<param id="thread">5839<jthread null="current" frame="frame"/>5840<description>5841The thread of the frame containing the variable's value.5842</description>5843</param>5844<param id="depth">5845<jframeID thread="thread"/>5846<description>5847The depth of the frame containing the variable's value.5848</description>5849</param>5850<param id="slot">5851<jint/>5852<description>5853The variable's slot number.5854</description>5855</param>5856<param id="value_ptr">5857<outptr><jlong/></outptr>5858<description>5859On return, points to the variable's value.5860</description>5861</param>5862</parameters>5863<errors>5864<error id="JVMTI_ERROR_INVALID_SLOT">5865Invalid <code>slot</code>.5866</error>5867<error id="JVMTI_ERROR_TYPE_MISMATCH">5868The variable type is not <code>long</code>.5869</error>5870<error id="JVMTI_ERROR_OPAQUE_FRAME">5871Not a visible frame5872</error>5873</errors>5874</function>58755876<function id="GetLocalFloat" num="24">5877<synopsis>Get Local Variable - Float</synopsis>5878<description>5879This function can be used to retrieve the value of a local5880variable whose type is <code>float</code>.5881</description>5882<origin>jvmdi</origin>5883<capabilities>5884<required id="can_access_local_variables"></required>5885</capabilities>5886<parameters>5887<param id="thread">5888<jthread null="current" frame="frame"/>5889<description>5890The thread of the frame containing the variable's value.5891</description>5892</param>5893<param id="depth">5894<jframeID thread="thread"/>5895<description>5896The depth of the frame containing the variable's value.5897</description>5898</param>5899<param id="slot">5900<jint/>5901<description>5902The variable's slot number.5903</description>5904</param>5905<param id="value_ptr">5906<outptr><jfloat/></outptr>5907<description>5908On return, points to the variable's value.5909</description>5910</param>5911</parameters>5912<errors>5913<error id="JVMTI_ERROR_INVALID_SLOT">5914Invalid <code>slot</code>.5915</error>5916<error id="JVMTI_ERROR_TYPE_MISMATCH">5917The variable type is not <code>float</code>.5918</error>5919<error id="JVMTI_ERROR_OPAQUE_FRAME">5920Not a visible frame5921</error>5922</errors>5923</function>59245925<function id="GetLocalDouble" num="25">5926<synopsis>Get Local Variable - Double</synopsis>5927<description>5928This function can be used to retrieve the value of a local5929variable whose type is <code>long</code>.5930</description>5931<origin>jvmdi</origin>5932<capabilities>5933<required id="can_access_local_variables"></required>5934</capabilities>5935<parameters>5936<param id="thread">5937<jthread null="current" frame="frame"/>5938<description>5939The thread of the frame containing the variable's value.5940</description>5941</param>5942<param id="depth">5943<jframeID thread="thread"/>5944<description>5945The depth of the frame containing the variable's value.5946</description>5947</param>5948<param id="slot">5949<jint/>5950<description>5951The variable's slot number.5952</description>5953</param>5954<param id="value_ptr">5955<outptr><jdouble/></outptr>5956<description>5957On return, points to the variable's value.5958</description>5959</param>5960</parameters>5961<errors>5962<error id="JVMTI_ERROR_INVALID_SLOT">5963Invalid <code>slot</code>.5964</error>5965<error id="JVMTI_ERROR_TYPE_MISMATCH">5966The variable type is not <code>double</code>.5967</error>5968<error id="JVMTI_ERROR_OPAQUE_FRAME">5969Not a visible frame5970</error>5971</errors>5972</function>59735974<function id="SetLocalObject" num="26">5975<synopsis>Set Local Variable - Object</synopsis>5976<description>5977This function can be used to set the value of a local5978variable whose type is <code>Object</code> or a subclass of <code>Object</code>.5979</description>5980<origin>jvmdi</origin>5981<capabilities>5982<required id="can_access_local_variables"></required>5983</capabilities>5984<parameters>5985<param id="thread">5986<jthread null="current" frame="frame"/>5987<description>5988The thread of the frame containing the variable's value.5989</description>5990</param>5991<param id="depth">5992<jframeID thread="thread"/>5993<description>5994The depth of the frame containing the variable's value.5995</description>5996</param>5997<param id="slot">5998<jint/>5999<description>6000The variable's slot number.6001</description>6002</param>6003<param id="value">6004<jobject/>6005<description>6006The new value for the variable.6007</description>6008</param>6009</parameters>6010<errors>6011<error id="JVMTI_ERROR_INVALID_SLOT">6012Invalid <code>slot</code>.6013</error>6014<error id="JVMTI_ERROR_TYPE_MISMATCH">6015The variable type is not6016<code>Object</code> or a subclass of <code>Object</code>.6017</error>6018<error id="JVMTI_ERROR_TYPE_MISMATCH">6019The supplied <paramlink id="value"/> is not compatible6020with the variable type.6021</error>6022<error id="JVMTI_ERROR_OPAQUE_FRAME">6023Not a visible frame6024</error>6025</errors>6026</function>60276028<function id="SetLocalInt" num="27">6029<synopsis>Set Local Variable - Int</synopsis>6030<description>6031This function can be used to set the value of a local6032variable whose type is <code>int</code>,6033<code>short</code>, <code>char</code>, <code>byte</code>, or6034<code>boolean</code>.6035</description>6036<origin>jvmdi</origin>6037<capabilities>6038<required id="can_access_local_variables"></required>6039</capabilities>6040<parameters>6041<param id="thread">6042<jthread null="current" frame="frame"/>6043<description>6044The thread of the frame containing the variable's value.6045</description>6046</param>6047<param id="depth">6048<jframeID thread="thread"/>6049<description>6050The depth of the frame containing the variable's value.6051</description>6052</param>6053<param id="slot">6054<jint/>6055<description>6056The variable's slot number.6057</description>6058</param>6059<param id="value">6060<jint/>6061<description>6062The new value for the variable.6063</description>6064</param>6065</parameters>6066<errors>6067<error id="JVMTI_ERROR_INVALID_SLOT">6068Invalid <code>slot</code>.6069</error>6070<error id="JVMTI_ERROR_TYPE_MISMATCH">6071The variable type is not6072<code>int</code>, <code>short</code>,6073<code>char</code>, <code>byte</code>, or6074<code>boolean</code>.6075</error>6076<error id="JVMTI_ERROR_OPAQUE_FRAME">6077Not a visible frame6078</error>6079</errors>6080</function>60816082<function id="SetLocalLong" num="28">6083<synopsis>Set Local Variable - Long</synopsis>6084<description>6085This function can be used to set the value of a local6086variable whose type is <code>long</code>.6087</description>6088<origin>jvmdi</origin>6089<capabilities>6090<required id="can_access_local_variables"></required>6091</capabilities>6092<parameters>6093<param id="thread">6094<jthread null="current" frame="frame"/>6095<description>6096The thread of the frame containing the variable's value.6097</description>6098</param>6099<param id="depth">6100<jframeID thread="thread"/>6101<description>6102The depth of the frame containing the variable's value.6103</description>6104</param>6105<param id="slot">6106<jint/>6107<description>6108The variable's slot number.6109</description>6110</param>6111<param id="value">6112<jlong/>6113<description>6114The new value for the variable.6115</description>6116</param>6117</parameters>6118<errors>6119<error id="JVMTI_ERROR_INVALID_SLOT">6120Invalid <code>slot</code>.6121</error>6122<error id="JVMTI_ERROR_TYPE_MISMATCH">6123The variable type is not <code>long</code>.6124</error>6125<error id="JVMTI_ERROR_OPAQUE_FRAME">6126Not a visible frame6127</error>6128</errors>6129</function>61306131<function id="SetLocalFloat" num="29">6132<synopsis>Set Local Variable - Float</synopsis>6133<description>6134This function can be used to set the value of a local6135variable whose type is <code>float</code>.6136</description>6137<origin>jvmdi</origin>6138<capabilities>6139<required id="can_access_local_variables"></required>6140</capabilities>6141<parameters>6142<param id="thread">6143<jthread null="current" frame="frame"/>6144<description>6145The thread of the frame containing the variable's value.6146</description>6147</param>6148<param id="depth">6149<jframeID thread="thread"/>6150<description>6151The depth of the frame containing the variable's value.6152</description>6153</param>6154<param id="slot">6155<jint/>6156<description>6157The variable's slot number.6158</description>6159</param>6160<param id="value">6161<jfloat/>6162<description>6163The new value for the variable.6164</description>6165</param>6166</parameters>6167<errors>6168<error id="JVMTI_ERROR_INVALID_SLOT">6169Invalid <code>slot</code>.6170</error>6171<error id="JVMTI_ERROR_TYPE_MISMATCH">6172The variable type is not <code>float</code>.6173</error>6174<error id="JVMTI_ERROR_OPAQUE_FRAME">6175Not a visible frame6176</error>6177</errors>6178</function>61796180<function id="SetLocalDouble" num="30">6181<synopsis>Set Local Variable - Double</synopsis>6182<description>6183This function can be used to set the value of a local6184variable whose type is <code>double</code>.6185</description>6186<origin>jvmdi</origin>6187<capabilities>6188<required id="can_access_local_variables"></required>6189</capabilities>6190<parameters>6191<param id="thread">6192<jthread null="current" frame="frame"/>6193<description>6194The thread of the frame containing the variable's value.6195</description>6196</param>6197<param id="depth">6198<jframeID thread="thread"/>6199<description>6200The depth of the frame containing the variable's value.6201</description>6202</param>6203<param id="slot">6204<jint/>6205<description>6206The variable's slot number.6207</description>6208</param>6209<param id="value">6210<jdouble/>6211<description>6212The new value for the variable.6213</description>6214</param>6215</parameters>6216<errors>6217<error id="JVMTI_ERROR_INVALID_SLOT">6218Invalid <code>slot</code>.6219</error>6220<error id="JVMTI_ERROR_TYPE_MISMATCH">6221The variable type is not <code>double</code>.6222</error>6223<error id="JVMTI_ERROR_OPAQUE_FRAME">6224Not a visible frame6225</error>6226</errors>6227</function>6228</category>62296230<category id="breakpointCategory" label="Breakpoint">62316232<intro>6233</intro>62346235<function id="SetBreakpoint" num="38">6236<synopsis>Set Breakpoint</synopsis>6237<description>6238Set a breakpoint at the instruction indicated by6239<code>method</code> and <code>location</code>.6240An instruction can only have one breakpoint.6241<p/>6242Whenever the designated instruction is about to be executed, a6243<eventlink id="Breakpoint"></eventlink> event is generated.6244</description>6245<origin>jvmdi</origin>6246<capabilities>6247<required id="can_generate_breakpoint_events"></required>6248</capabilities>6249<parameters>6250<param id="klass">6251<jclass method="method"/>6252<description>6253The class in which to set the breakpoint6254</description>6255</param>6256<param id="method">6257<jmethodID class="klass"/>6258<description>6259The method in which to set the breakpoint6260</description>6261</param>6262<param id="location">6263<jlocation/>6264<description>6265the index of the instruction at which to set the breakpoint62666267</description>6268</param>6269</parameters>6270<errors>6271<error id="JVMTI_ERROR_DUPLICATE">6272The designated bytecode already has a breakpoint.6273</error>6274</errors>6275</function>62766277<function id="ClearBreakpoint" num="39">6278<synopsis>Clear Breakpoint</synopsis>6279<description>6280Clear the breakpoint at the bytecode indicated by6281<code>method</code> and <code>location</code>.6282</description>6283<origin>jvmdi</origin>6284<capabilities>6285<required id="can_generate_breakpoint_events"></required>6286</capabilities>6287<parameters>6288<param id="klass">6289<jclass method="method"/>6290<description>6291The class in which to clear the breakpoint6292</description>6293</param>6294<param id="method">6295<jmethodID class="klass"/>6296<description>6297The method in which to clear the breakpoint6298</description>6299</param>6300<param id="location">6301<jlocation/>6302<description>6303the index of the instruction at which to clear the breakpoint6304</description>6305</param>6306</parameters>6307<errors>6308<error id="JVMTI_ERROR_NOT_FOUND">6309There's no breakpoint at the designated bytecode.6310</error>6311</errors>6312</function>63136314</category>63156316<category id="fieldWatch" label="Watched Field">63176318<intro>6319</intro>63206321<function id="SetFieldAccessWatch" num="41">6322<synopsis>Set Field Access Watch</synopsis>6323<description>6324Generate a <eventlink id="FieldAccess"></eventlink> event6325when the field specified6326by <code>klass</code> and6327<code>field</code> is about to be accessed.6328An event will be generated for each access of the field6329until it is canceled with6330<functionlink id="ClearFieldAccessWatch"></functionlink>.6331Field accesses from Java programming language code or from JNI code are watched,6332fields modified by other means are not watched.6333Note that <jvmti/> users should be aware that their own field accesses6334will trigger the watch.6335A field can only have one field access watch set.6336Modification of a field is not considered an access--use6337<functionlink id="SetFieldModificationWatch"></functionlink>6338to monitor modifications.6339</description>6340<origin>jvmdi</origin>6341<capabilities>6342<required id="can_generate_field_access_events"></required>6343</capabilities>6344<parameters>6345<param id="klass">6346<jclass field="field"/>6347<description>6348The class containing the field to watch6349</description>6350</param>6351<param id="field">6352<jfieldID class="klass"/>6353<description>6354The field to watch63556356</description>6357</param>6358</parameters>6359<errors>6360<error id="JVMTI_ERROR_DUPLICATE">6361The designated field is already being watched for accesses.6362</error>6363</errors>6364</function>63656366<function id="ClearFieldAccessWatch" num="42">6367<synopsis>Clear Field Access Watch</synopsis>6368<description>6369Cancel a field access watch previously set by6370<functionlink id="SetFieldAccessWatch"></functionlink>, on the6371field specified6372by <code>klass</code> and6373<code>field</code>.6374</description>6375<origin>jvmdi</origin>6376<capabilities>6377<required id="can_generate_field_access_events"></required>6378</capabilities>6379<parameters>6380<param id="klass">6381<jclass field="field"/>6382<description>6383The class containing the field to watch6384</description>6385</param>6386<param id="field">6387<jfieldID class="klass"/>6388<description>6389The field to watch63906391</description>6392</param>6393</parameters>6394<errors>6395<error id="JVMTI_ERROR_NOT_FOUND">6396The designated field is not being watched for accesses.6397</error>6398</errors>6399</function>64006401<function id="SetFieldModificationWatch" num="43">6402<synopsis>Set Field Modification Watch</synopsis>6403<description>6404Generate a <eventlink id="FieldModification"></eventlink> event6405when the field specified6406by <code>klass</code> and6407<code>field</code> is about to be modified.6408An event will be generated for each modification of the field6409until it is canceled with6410<functionlink id="ClearFieldModificationWatch"></functionlink>.6411Field modifications from Java programming language code or from JNI code are watched,6412fields modified by other means are not watched.6413Note that <jvmti/> users should be aware that their own field modifications6414will trigger the watch.6415A field can only have one field modification watch set.6416</description>6417<origin>jvmdi</origin>6418<capabilities>6419<required id="can_generate_field_modification_events"></required>6420</capabilities>6421<parameters>6422<param id="klass">6423<jclass field="field"/>6424<description>6425The class containing the field to watch6426</description>6427</param>6428<param id="field">6429<jfieldID class="klass"/>6430<description>6431The field to watch64326433</description>6434</param>6435</parameters>6436<errors>6437<error id="JVMTI_ERROR_DUPLICATE">6438The designated field is already being watched for modifications.6439</error>6440</errors>6441</function>64426443<function id="ClearFieldModificationWatch" num="44">6444<synopsis>Clear Field Modification Watch</synopsis>6445<description>64466447Cancel a field modification watch previously set by6448<functionlink id="SetFieldModificationWatch"></functionlink>, on the6449field specified6450by <code>klass</code> and6451<code>field</code>.6452</description>6453<origin>jvmdi</origin>6454<capabilities>6455<required id="can_generate_field_modification_events"></required>6456</capabilities>6457<parameters>6458<param id="klass">6459<jclass field="field"/>6460<description>6461The class containing the field to watch6462</description>6463</param>6464<param id="field">6465<jfieldID class="klass"/>6466<description>6467The field to watch64686469</description>6470</param>6471</parameters>6472<errors>6473<error id="JVMTI_ERROR_NOT_FOUND">6474The designated field is not being watched for modifications.6475</error>6476</errors>6477</function>6478</category>64796480<category id="module" label="Module">64816482<intro>6483</intro>64846485<function id="GetAllModules" num="3" since="9">6486<synopsis>Get All Modules</synopsis>6487<description>6488Return an array of all modules loaded in the virtual machine.6489The array includes the unnamed module for each class loader.6490The number of modules in the array is returned via6491<code>module_count_ptr</code>, and the array itself via6492<code>modules_ptr</code>.6493<p/>6494</description>6495<origin>new</origin>6496<capabilities>6497</capabilities>6498<parameters>6499<param id="module_count_ptr">6500<outptr><jint/></outptr>6501<description>6502On return, points to the number of returned modules.6503</description>6504</param>6505<param id="modules_ptr">6506<allocbuf outcount="module_count_ptr"><jobject/></allocbuf>6507<description>6508On return, points to an array of references, one6509for each module.6510</description>6511</param>6512</parameters>6513<errors>6514</errors>6515</function>65166517<function id="GetNamedModule" num="40" since="9">6518<synopsis>Get Named Module</synopsis>6519<description>6520Return the <code>java.lang.Module</code> object for a named6521module defined to a class loader that contains a given package.6522The module is returned via <code>module_ptr</code>.6523<p/>6524If a named module is defined to the class loader and it6525contains the package then that named module is returned,6526otherwise <code>NULL</code> is returned.6527<p/>6528</description>6529<origin>new</origin>6530<capabilities>6531</capabilities>6532<parameters>6533<param id="class_loader">6534<ptrtype>6535<jobject/>6536<nullok>the bootstrap loader is assumed</nullok>6537</ptrtype>6538<description>6539A class loader.6540If the <code>class_loader</code> is not <code>NULL</code>6541or a subclass of <code>java.lang.ClassLoader</code>6542this function returns6543<errorlink id="JVMTI_ERROR_ILLEGAL_ARGUMENT"></errorlink>.6544</description>6545</param>6546<param id="package_name">6547<inbuf><char/></inbuf>6548<description>6549The name of the package, encoded as a6550<internallink id="mUTF">modified UTF-8</internallink> string.6551The package name is in internal form (JVMS 4.2.1);6552identifiers are separated by forward slashes rather than periods.6553</description>6554</param>6555<param id="module_ptr">6556<outptr><jobject/></outptr>6557<description>6558On return, points to a <code>java.lang.Module</code> object6559or points to <code>NULL</code>.6560</description>6561</param>6562</parameters>6563<errors>6564<error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">6565If class loader is not <code>NULL</code> and is not a class loader object.6566</error>6567</errors>6568</function>65696570<function id="AddModuleReads" num="94" since="9">6571<synopsis>Add Module Reads</synopsis>6572<description>6573Update a module to read another module. This function is a no-op6574when <paramlink id="module"></paramlink> is an unnamed module.6575This function facilitates the instrumentation of code6576in named modules where that instrumentation requires6577expanding the set of modules that a module reads.6578</description>6579<origin>new</origin>6580<capabilities>6581</capabilities>6582<parameters>6583<param id="module">6584<ptrtype><jobject/></ptrtype>6585<description>6586The module to update.6587</description>6588</param>6589<param id="to_module">6590<ptrtype><jobject/></ptrtype>6591<description>6592The additional module to read.6593</description>6594</param>6595</parameters>6596<errors>6597<error id="JVMTI_ERROR_INVALID_MODULE">6598If <paramlink id="module"></paramlink> is not a module object.6599</error>6600<error id="JVMTI_ERROR_INVALID_MODULE">6601If <paramlink id="to_module"></paramlink> is not a module object.6602</error>6603<error id="JVMTI_ERROR_UNMODIFIABLE_MODULE">6604if the module cannot be modified.6605See <functionlink id="IsModifiableModule"/>.6606</error>6607</errors>6608</function>66096610<function id="AddModuleExports" num="95" since="9">6611<synopsis>Add Module Exports</synopsis>6612<description>6613Update a module to export a package to another module.6614This function is a no-op when <paramlink id="module"></paramlink>6615is an unnamed module or an open module.6616This function facilitates the instrumentation of code6617in named modules where that instrumentation requires6618expanding the set of packages that a module exports.6619</description>6620<origin>new</origin>6621<capabilities>6622</capabilities>6623<parameters>6624<param id="module">6625<ptrtype><jobject/></ptrtype>6626<description>6627The module to update.6628</description>6629</param>6630<param id="pkg_name">6631<inbuf><char/></inbuf>6632<description>6633The exported package name.6634</description>6635</param>6636<param id="to_module">6637<ptrtype><jobject/></ptrtype>6638<description>6639The module the package is exported to.6640If the <code>to_module</code> is not a subclass of6641<code>java.lang.Module</code> this function returns6642<errorlink id="JVMTI_ERROR_INVALID_MODULE"></errorlink>.6643</description>6644</param>6645</parameters>6646<errors>6647<error id="JVMTI_ERROR_INVALID_MODULE">6648If <paramlink id="module"></paramlink> is not a module object.6649</error>6650<error id="JVMTI_ERROR_INVALID_MODULE">6651If <paramlink id="to_module"></paramlink> is not a module object.6652</error>6653<error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">6654If the package <paramlink id="pkg_name"></paramlink>6655does not belong to the module.6656</error>6657<error id="JVMTI_ERROR_UNMODIFIABLE_MODULE">6658if the module cannot be modified.6659See <functionlink id="IsModifiableModule"/>.6660</error>6661</errors>6662</function>66636664<function id="AddModuleOpens" num="96" since="9">6665<synopsis>Add Module Opens</synopsis>6666<description>6667Update a module to open a package to another module.6668This function is a no-op when <paramlink id="module"></paramlink>6669is an unnamed module or an open module.6670This function facilitates the instrumentation of code6671in modules where that instrumentation requires6672expanding the set of packages that a module opens to6673other modules.6674</description>6675<origin>new</origin>6676<capabilities>6677</capabilities>6678<parameters>6679<param id="module">6680<ptrtype><jobject/></ptrtype>6681<description>6682The module to update.6683</description>6684</param>6685<param id="pkg_name">6686<inbuf><char/></inbuf>6687<description>6688The package name of the package to open.6689</description>6690</param>6691<param id="to_module">6692<ptrtype><jobject/></ptrtype>6693<description>6694The module with the package to open.6695If the <code>to_module</code> is not a subclass of6696<code>java.lang.Module</code> this function returns6697<errorlink id="JVMTI_ERROR_INVALID_MODULE"></errorlink>.6698</description>6699</param>6700</parameters>6701<errors>6702<error id="JVMTI_ERROR_INVALID_MODULE">6703If <paramlink id="module"></paramlink> is not a module object.6704</error>6705<error id="JVMTI_ERROR_INVALID_MODULE">6706If <paramlink id="to_module"></paramlink> is not a module object.6707</error>6708<error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">6709If the package <paramlink id="pkg_name"></paramlink>6710does not belong to the module.6711</error>6712<error id="JVMTI_ERROR_UNMODIFIABLE_MODULE">6713if the module cannot be modified.6714See <functionlink id="IsModifiableModule"/>.6715</error>6716</errors>6717</function>67186719<function id="AddModuleUses" num="97" since="9">6720<synopsis>Add Module Uses</synopsis>6721<description>6722Updates a module to add a service to the set of services that6723a module uses. This function is a no-op when the module6724is an unnamed module.6725This function facilitates the instrumentation of code6726in named modules where that instrumentation requires6727expanding the set of services that a module is using.6728</description>6729<origin>new</origin>6730<capabilities>6731</capabilities>6732<parameters>6733<param id="module">6734<ptrtype><jobject/></ptrtype>6735<description>6736The module to update.6737</description>6738</param>6739<param id="service">6740<ptrtype><jclass/></ptrtype>6741<description>6742The service to use.6743</description>6744</param>6745</parameters>6746<errors>6747<error id="JVMTI_ERROR_INVALID_MODULE">6748If <paramlink id="module"></paramlink> is not a module object.6749</error>6750<error id="JVMTI_ERROR_INVALID_CLASS">6751If <paramlink id="service"></paramlink> is not a class object.6752</error>6753<error id="JVMTI_ERROR_UNMODIFIABLE_MODULE">6754if the module cannot be modified.6755See <functionlink id="IsModifiableModule"/>.6756</error>6757</errors>6758</function>67596760<function id="AddModuleProvides" num="98" since="9">6761<synopsis>Add Module Provides</synopsis>6762<description>6763Updates a module to add a service to the set of services that6764a module provides. This function is a no-op when the module6765is an unnamed module.6766This function facilitates the instrumentation of code6767in named modules where that instrumentation requires6768changes to the services that are provided.6769</description>6770<origin>new</origin>6771<capabilities>6772</capabilities>6773<parameters>6774<param id="module">6775<ptrtype><jobject/></ptrtype>6776<description>6777The module to update.6778</description>6779</param>6780<param id="service">6781<ptrtype><jclass/></ptrtype>6782<description>6783The service to provide.6784</description>6785</param>6786<param id="impl_class">6787<ptrtype><jclass/></ptrtype>6788<description>6789The implementation class for the provided service.6790</description>6791</param>6792</parameters>6793<errors>6794<error id="JVMTI_ERROR_INVALID_MODULE">6795If <paramlink id="module"></paramlink> is not a module object.6796</error>6797<error id="JVMTI_ERROR_INVALID_CLASS">6798If <paramlink id="service"></paramlink> is not a class object.6799</error>6800<error id="JVMTI_ERROR_INVALID_CLASS">6801If <paramlink id="impl_class"></paramlink> is not a class object.6802</error>6803<error id="JVMTI_ERROR_UNMODIFIABLE_MODULE">6804if the module cannot be modified.6805See <functionlink id="IsModifiableModule"/>.6806</error>6807</errors>6808</function>68096810<function id="IsModifiableModule" num="99" since="9">6811<synopsis>Is Modifiable Module</synopsis>6812<description>6813Determines whether a module is modifiable.6814If a module is modifiable then this module can be updated with6815<functionlink id="AddModuleReads"/>, <functionlink id="AddModuleExports"/>,6816<functionlink id="AddModuleOpens"/>, <functionlink id="AddModuleUses"/>,6817and <functionlink id="AddModuleProvides"/>. If a module is not modifiable6818then the module can not be updated with these functions. The result of6819this function is always <code>JNI_TRUE</code> when called to determine6820if an unnamed module is modifiable.6821</description>6822<origin>new</origin>6823<capabilities>6824</capabilities>6825<parameters>6826<param id="module">6827<ptrtype><jobject/></ptrtype>6828<description>6829The module to query.6830</description>6831</param>6832<param id="is_modifiable_module_ptr">6833<outptr><jboolean/></outptr>6834<description>6835On return, points to the boolean result of this function.6836</description>6837</param>6838</parameters>6839<errors>6840<error id="JVMTI_ERROR_INVALID_MODULE">6841If <paramlink id="module"></paramlink> is not a module object.6842</error>6843</errors>6844</function>68456846</category>68476848<category id="class" label="Class">6849<function id="GetLoadedClasses" jkernel="yes" num="78">6850<synopsis>Get Loaded Classes</synopsis>6851<description>6852Return an array of all classes loaded in the virtual machine.6853The number of classes in the array is returned via6854<code>class_count_ptr</code>, and the array itself via6855<code>classes_ptr</code>.6856<p/>6857A class or interface creation can be triggered by one of the following:6858<ul>6859<li>By loading and deriving a class from a <code>class</code> file representation6860using a class loader (see <vmspec chapter="5.3"/>).</li>6861<li>By invoking <externallink id="../api/java.base/java/lang/invoke/MethodHandles.Lookup.html#defineHiddenClass(byte[],boolean,java.lang.invoke.MethodHandles.Lookup.ClassOption...)">Lookup::defineHiddenClass</externallink>6862that creates a hidden class or interface from a <code>class</code> file representation.</li>6863<li>By invoking methods in certain Java SE Platform APIs such as reflection.</li>6864</ul>6865<p/>6866An array class is created directly by the Java virtual machine. The creation6867can be triggered by using class loaders or by invoking methods in certain6868Java SE Platform APIs such as reflection.6869<p/>6870The returned list includes all classes and interfaces, including6871<externallink id="../api/java.base/java/lang/Class.html#isHidden()">6872hidden classes or interfaces</externallink>,6873and also array classes of all types6874(including arrays of primitive types).6875Primitive classes (for example, <code>java.lang.Integer.TYPE</code>) are6876<i>not</i> included in the returned list.6877</description>6878<origin>jvmdi</origin>6879<capabilities>6880</capabilities>6881<parameters>6882<param id="class_count_ptr">6883<outptr><jint/></outptr>6884<description>6885On return, points to the number of classes.6886</description>6887</param>6888<param id="classes_ptr">6889<allocbuf outcount="class_count_ptr"><jclass/></allocbuf>6890<description>6891On return, points to an array of references, one6892for each class.6893</description>6894</param>6895</parameters>6896<errors>6897</errors>6898</function>68996900<function id="GetClassLoaderClasses" jkernel="yes" num="79">6901<synopsis>Get Classloader Classes</synopsis>6902<description>6903Returns an array of all classes which this class loader6904can find by name via6905<externallink id="../api/java.base/java/lang/ClassLoader.html#loadClass(java.lang.String,boolean)">ClassLoader::loadClass</externallink>,6906<externallink id="../api/java.base/java/lang/Class.html#forName(java.lang.String,boolean,java.lang.ClassLoader)">Class::forName</externallink> and bytecode linkage.6907That is, all classes for which <code>initiating_loader</code>6908has been recorded as an initiating loader.6909Each class in the returned array was created by this class loader,6910either by defining it directly or by delegation to another class loader.6911See <vmspec chapter="5.3"/>.6912<p/>6913The returned list does not include6914<externallink id="../api/java.base/java/lang/Class.html#isHidden()">hidden6915classes or interfaces</externallink> or array classes whose6916element type is a hidden class or interface as they cannot be discovered6917by any class loader.6918<p/>6919The number of classes in the array is returned via6920<code>class_count_ptr</code>, and the array itself via6921<code>classes_ptr</code>.6922<p/>6923See <externallink id="../api/java.base/java/lang/invoke/MethodHandles.Lookup.html#defineHiddenClass(byte[],boolean,java.lang.invoke.MethodHandles.Lookup.ClassOption...)">Lookup::defineHiddenClass</externallink>.6924</description>6925<origin>jvmdi</origin>6926<capabilities>6927</capabilities>6928<parameters>6929<param id="initiating_loader">6930<ptrtype>6931<jobject/>6932<nullok>the classes initiated by the bootstrap loader will be returned</nullok>6933</ptrtype>6934<description>6935An initiating class loader.6936</description>6937</param>6938<param id="class_count_ptr">6939<outptr><jint/></outptr>6940<description>6941On return, points to the number of classes.6942</description>6943</param>6944<param id="classes_ptr">6945<allocbuf outcount="class_count_ptr"><jclass/></allocbuf>6946<description>6947On return, points to an array of references, one6948for each class.6949</description>6950</param>6951</parameters>6952<errors>6953</errors>6954</function>69556956<function id="GetClassSignature" phase="start" num="48">6957<synopsis>Get Class Signature</synopsis>6958<description>6959Return the name and the generic signature of the class indicated by <code>klass</code>.6960<p/>6961If the class is a class or interface, then:6962<ul>6963<li>If the class or interface is not <externallink id="../api/java.base/java/lang/Class.html#isHidden()">hidden</externallink>,6964then the returned name is the <externallink id="jni/types.html#type-signatures">6965JNI type signature</externallink>.6966For example, java.util.List is "Ljava/util/List;"6967</li>6968<li>If the class or interface is <externallink id="../api/java.base/java/lang/Class.html#isHidden()">hidden</externallink>,6969then the returned name is a string of the form:6970<code>"L" + N + "." + S + ";"</code>6971where <code>N</code> is the binary name encoded in internal form (JVMS 4.2.1)6972indicated by the <code>class</code> file passed to6973<externallink id="../api/java.base/java/lang/invoke/MethodHandles.Lookup.html#defineHiddenClass(byte[],boolean,java.lang.invoke.MethodHandles.Lookup.ClassOption...)">Lookup::defineHiddenClass</externallink>,6974and <code>S</code> is an unqualified name.6975The returned name is not a type descriptor and does not conform to JVMS 4.3.2.6976For example, com.foo.Foo/AnySuffix is "Lcom/foo/Foo.AnySuffix;"6977</li>6978</ul>6979<p/>6980If the class indicated by <code>klass</code> represents an array class, then6981the returned name is a string consisting of one or more "<code>[</code>" characters6982representing the depth of the array nesting, followed by the class signature6983of the element type. For example the class signature of java.lang.String[] is6984"[Ljava/lang/String;" and that of int[] is "[I".6985<p/>6986If the class indicated by <code>klass</code> represents primitive type or <code>void</code>,6987then the returned name is the <externallink id="jni/types.html#type-signatures">6988type signature character of the corresponding primitive type</externallink>.6989For example, java.lang.Integer.TYPE is "I".6990</description>6991<origin>jvmdiClone</origin>6992<capabilities>6993</capabilities>6994<parameters>6995<param id="klass">6996<jclass/>6997<description>6998The class to query.6999</description>7000</param>7001<param id="signature_ptr">7002<allocbuf>7003<char/>7004<nullok>the signature is not returned</nullok>7005</allocbuf>7006<description>7007On return, points to the JNI type signature of the class, encoded as a7008<internallink id="mUTF">modified UTF-8</internallink> string.7009</description>7010</param>7011<param id="generic_ptr">7012<allocbuf>7013<char/>7014<nullok>the generic signature is not returned</nullok>7015</allocbuf>7016<description>7017On return, points to the generic signature of the class, encoded as a7018<internallink id="mUTF">modified UTF-8</internallink> string.7019If there is no generic signature attribute for the class, then,7020on return, points to <code>NULL</code>.7021</description>7022</param>7023</parameters>7024<errors>7025</errors>7026</function>70277028<function id="GetClassStatus" phase="start" num="49">7029<synopsis>Get Class Status</synopsis>7030<description>7031Get the status of the class. Zero or more of the following bits can be7032set.7033<constants id="jvmtiClassStatus" label="Class Status Flags" kind="bits">7034<constant id="JVMTI_CLASS_STATUS_VERIFIED" num="1">7035Class bytecodes have been verified7036</constant>7037<constant id="JVMTI_CLASS_STATUS_PREPARED" num="2">7038Class preparation is complete7039</constant>7040<constant id="JVMTI_CLASS_STATUS_INITIALIZED" num="4">7041Class initialization is complete. Static initializer has been run.7042</constant>7043<constant id="JVMTI_CLASS_STATUS_ERROR" num="8">7044Error during initialization makes class unusable7045</constant>7046<constant id="JVMTI_CLASS_STATUS_ARRAY" num="16">7047Class is an array. If set, all other bits are zero.7048</constant>7049<constant id="JVMTI_CLASS_STATUS_PRIMITIVE" num="32">7050Class is a primitive class (for example, <code>java.lang.Integer.TYPE</code>).7051If set, all other bits are zero.7052</constant>7053</constants>7054</description>7055<origin>jvmdi</origin>7056<capabilities>7057</capabilities>7058<parameters>7059<param id="klass">7060<jclass/>7061<description>7062The class to query.7063</description>7064</param>7065<param id="status_ptr">7066<outptr><jint/></outptr>7067<description>7068On return, points to the current state of this class as one or7069more of the <internallink id="jvmtiClassStatus">class status flags</internallink>.7070</description>7071</param>7072</parameters>7073<errors>7074</errors>7075</function>70767077<function id="GetSourceFileName" phase="start" num="50">7078<synopsis>Get Source File Name</synopsis>7079<description>7080For the class indicated by <code>klass</code>, return the source file7081name via <code>source_name_ptr</code>. The returned string7082is a file name only and never contains a directory name.7083<p/>7084For primitive classes (for example, <code>java.lang.Integer.TYPE</code>)7085and for arrays this function returns7086<errorlink id="JVMTI_ERROR_ABSENT_INFORMATION"></errorlink>.7087</description>7088<origin>jvmdi</origin>7089<capabilities>7090<required id="can_get_source_file_name"></required>7091</capabilities>7092<parameters>7093<param id="klass">7094<jclass/>7095<description>7096The class to query.7097</description>7098</param>7099<param id="source_name_ptr">7100<allocbuf><char/></allocbuf>7101<description>7102On return, points to the class's source file name, encoded as a7103<internallink id="mUTF">modified UTF-8</internallink> string.7104</description>7105</param>7106</parameters>7107<errors>7108<error id="JVMTI_ERROR_ABSENT_INFORMATION">7109Class information does not include a source file name. This includes7110cases where the class is an array class or primitive class.7111</error>7112</errors>7113</function>71147115<function id="GetClassModifiers" phase="start" num="51">7116<synopsis>Get Class Modifiers</synopsis>7117<description>7118For the class indicated by <code>klass</code>, return the access7119flags7120via <code>modifiers_ptr</code>.7121Access flags are defined in <vmspec chapter="4"/>.7122<p/>7123If the class is an array class, then its public, private, and protected7124modifiers are the same as those of its component type. For arrays of7125primitives, this component type is represented by one of the primitive7126classes (for example, <code>java.lang.Integer.TYPE</code>).7127<p/>7128If the class is a primitive class, its public modifier is always true,7129and its protected and private modifiers are always false.7130<p/>7131If the class is an array class or a primitive class then its final7132modifier is always true and its interface modifier is always false.7133The values of its other modifiers are not determined by this specification.71347135</description>7136<origin>jvmdi</origin>7137<capabilities>7138</capabilities>7139<parameters>7140<param id="klass">7141<jclass/>7142<description>7143The class to query.7144</description>7145</param>7146<param id="modifiers_ptr">7147<outptr><jint/></outptr>7148<description>7149On return, points to the current access flags of this class.71507151</description>7152</param>7153</parameters>7154<errors>7155</errors>7156</function>71577158<function id="GetClassMethods" phase="start" num="52">7159<synopsis>Get Class Methods</synopsis>7160<description>7161For the class indicated by <code>klass</code>, return a count of7162methods via <code>method_count_ptr</code> and a list of7163method IDs via <code>methods_ptr</code>. The method list contains7164constructors and static initializers as well as true methods.7165Only directly declared methods are returned (not inherited methods).7166An empty method list is returned for array classes and primitive classes7167(for example, <code>java.lang.Integer.TYPE</code>).7168</description>7169<origin>jvmdi</origin>7170<capabilities>7171<capability id="can_maintain_original_method_order"/>7172</capabilities>7173<parameters>7174<param id="klass">7175<jclass/>7176<description>7177The class to query.7178</description>7179</param>7180<param id="method_count_ptr">7181<outptr><jint/></outptr>7182<description>7183On return, points to the number of methods declared in this class.7184</description>7185</param>7186<param id="methods_ptr">7187<allocbuf outcount="method_count_ptr"><jmethodID class="klass"/></allocbuf>7188<description>7189On return, points to the method ID array.7190</description>7191</param>7192</parameters>7193<errors>7194<error id="JVMTI_ERROR_CLASS_NOT_PREPARED">7195<paramlink id="klass"></paramlink> is not prepared.7196</error>7197</errors>7198</function>71997200<function id="GetClassFields" phase="start" num="53">7201<synopsis>Get Class Fields</synopsis>7202<description>7203For the class indicated by <code>klass</code>, return a count of fields7204via <code>field_count_ptr</code> and a list of field IDs via7205<code>fields_ptr</code>.7206Only directly declared fields are returned (not inherited fields).7207Fields are returned in the order they occur in the class file.7208An empty field list is returned for array classes and primitive classes7209(for example, <code>java.lang.Integer.TYPE</code>).7210Use JNI to determine the length of an array.7211</description>7212<origin>jvmdi</origin>7213<capabilities>7214</capabilities>7215<parameters>7216<param id="klass">7217<jclass/>7218<description>7219The class to query.7220</description>7221</param>7222<param id="field_count_ptr">7223<outptr><jint/></outptr>7224<description>7225On return, points to the number of fields declared in this class.7226</description>7227</param>7228<param id="fields_ptr">7229<allocbuf outcount="field_count_ptr"><jfieldID/></allocbuf>7230<description>7231On return, points to the field ID array.7232</description>7233</param>7234</parameters>7235<errors>7236<error id="JVMTI_ERROR_CLASS_NOT_PREPARED">7237<paramlink id="klass"></paramlink> is not prepared.7238</error>7239</errors>7240</function>72417242<function id="GetImplementedInterfaces" phase="start" num="54">7243<synopsis>Get Implemented Interfaces</synopsis>7244<description>7245Return the direct super-interfaces of this class. For a class, this7246function returns the interfaces declared in its <code>implements</code>7247clause. For an interface, this function returns the interfaces declared in7248its <code>extends</code> clause.7249An empty interface list is returned for array classes and primitive classes7250(for example, <code>java.lang.Integer.TYPE</code>).7251</description>7252<origin>jvmdi</origin>7253<capabilities>7254</capabilities>7255<parameters>7256<param id="klass">7257<jclass/>7258<description>7259The class to query.7260</description>7261</param>7262<param id="interface_count_ptr">7263<outptr><jint/></outptr>7264<description>7265On return, points to the number of interfaces.7266</description>7267</param>7268<param id="interfaces_ptr">7269<allocbuf outcount="interface_count_ptr"><jclass/></allocbuf>7270<description>7271On return, points to the interface array.7272</description>7273</param>7274</parameters>7275<errors>7276<error id="JVMTI_ERROR_CLASS_NOT_PREPARED">7277<paramlink id="klass"></paramlink> is not prepared.7278</error>7279</errors>7280</function>72817282<function id="GetClassVersionNumbers" phase="start" num="145" since="1.1">7283<synopsis>Get Class Version Numbers</synopsis>7284<description>7285For the class indicated by <code>klass</code>,7286return the minor and major version numbers,7287as defined in7288<vmspec chapter="4"/>.7289</description>7290<origin>new</origin>7291<capabilities>7292</capabilities>7293<parameters>7294<param id="klass">7295<jclass/>7296<description>7297The class to query.7298</description>7299</param>7300<param id="minor_version_ptr">7301<outptr><jint/></outptr>7302<description>7303On return, points to the value of the7304<code>minor_version</code> item of the7305Class File Format.7306Note: to be consistent with the Class File Format,7307the minor version number is the first parameter.7308</description>7309</param>7310<param id="major_version_ptr">7311<outptr><jint/></outptr>7312<description>7313On return, points to the value of the7314<code>major_version</code> item of the7315Class File Format.7316</description>7317</param>7318</parameters>7319<errors>7320<error id="JVMTI_ERROR_ABSENT_INFORMATION">7321The class is a primitive or array class.7322</error>7323</errors>7324</function>73257326<function id="GetConstantPool" phase="start" num="146" since="1.1">7327<synopsis>Get Constant Pool</synopsis>7328<description>7329For the class indicated by <code>klass</code>,7330return the raw bytes of the constant pool in the format of the7331<code>constant_pool</code> item of7332<vmspec chapter="4"/>.7333The format of the constant pool may differ between versions7334of the Class File Format, so, the7335<functionlink id="GetClassVersionNumbers">minor and major7336class version numbers</functionlink> should be checked for7337compatibility.7338<p/>7339The returned constant pool might not have the same layout or7340contents as the constant pool in the defining class file.7341The constant pool returned by GetConstantPool() may have7342more or fewer entries than the defining constant pool.7343Entries may be in a different order.7344The constant pool returned by GetConstantPool() will match the7345constant pool used by7346<functionlink id="GetBytecodes">GetBytecodes()</functionlink>.7347That is, the bytecodes returned by GetBytecodes() will have7348constant pool indices which refer to constant pool entries returned7349by GetConstantPool().7350Note that since <functionlink id="RetransformClasses"/>7351and <functionlink id="RedefineClasses"/> can change7352the constant pool, the constant pool returned by this function7353can change accordingly. Thus, the correspondence between7354GetConstantPool() and GetBytecodes() does not hold if there7355is an intervening class retransformation or redefinition.7356The value of a constant pool entry used by a given bytecode will7357match that of the defining class file (even if the indices don't match).7358Constant pool entries which are not used directly or indirectly by7359bytecodes (for example, UTF-8 strings associated with annotations) are7360not required to exist in the returned constant pool.7361</description>7362<origin>new</origin>7363<capabilities>7364<required id="can_get_constant_pool"></required>7365</capabilities>7366<parameters>7367<param id="klass">7368<jclass/>7369<description>7370The class to query.7371</description>7372</param>7373<param id="constant_pool_count_ptr">7374<outptr><jint/></outptr>7375<description>7376On return, points to the number of entries7377in the constant pool table plus one.7378This corresponds to the <code>constant_pool_count</code>7379item of the Class File Format.7380</description>7381</param>7382<param id="constant_pool_byte_count_ptr">7383<outptr><jint/></outptr>7384<description>7385On return, points to the number of bytes7386in the returned raw constant pool.7387</description>7388</param>7389<param id="constant_pool_bytes_ptr">7390<allocbuf outcount="constant_pool_byte_count_ptr"><uchar/></allocbuf>7391<description>7392On return, points to the raw constant pool, that is the bytes7393defined by the <code>constant_pool</code> item of the7394Class File Format7395</description>7396</param>7397</parameters>7398<errors>7399<error id="JVMTI_ERROR_ABSENT_INFORMATION">7400The class is a primitive or array class.7401</error>7402</errors>7403</function>74047405<function id="IsInterface" phase="start" num="55">7406<synopsis>Is Interface</synopsis>7407<description>7408Determines whether a class object reference represents an interface.7409The <code>jboolean</code> result is7410<code>JNI_TRUE</code> if the "class" is actually an interface,7411<code>JNI_FALSE</code> otherwise.7412</description>7413<origin>jvmdi</origin>7414<capabilities>7415</capabilities>7416<parameters>7417<param id="klass">7418<jclass/>7419<description>7420The class to query.7421</description>7422</param>7423<param id="is_interface_ptr">7424<outptr><jboolean/></outptr>7425<description>7426On return, points to the boolean result of this function.74277428</description>7429</param>7430</parameters>7431<errors>7432</errors>7433</function>74347435<function id="IsArrayClass" phase="start" num="56">7436<synopsis>Is Array Class</synopsis>7437<description>7438Determines whether a class object reference represents an array.7439The <code>jboolean</code> result is7440<code>JNI_TRUE</code> if the class is an array,7441<code>JNI_FALSE</code> otherwise.7442</description>7443<origin>jvmdi</origin>7444<capabilities>7445</capabilities>7446<parameters>7447<param id="klass">7448<jclass/>7449<description>7450The class to query.7451</description>7452</param>7453<param id="is_array_class_ptr">7454<outptr><jboolean/></outptr>7455<description>7456On return, points to the boolean result of this function.74577458</description>7459</param>7460</parameters>7461<errors>7462</errors>7463</function>74647465<function id="IsModifiableClass" jkernel="yes" phase="start" num="45" since="1.1">7466<synopsis>Is Modifiable Class</synopsis>7467<description>7468Determines whether a class is modifiable.7469If a class is modifiable (<paramlink id="is_modifiable_class_ptr"/>7470returns <code>JNI_TRUE</code>) the class can be7471redefined with <functionlink id="RedefineClasses"/> (assuming7472the agent possesses the7473<fieldlink id="can_redefine_classes" struct="jvmtiCapabilities"/>7474capability) or7475retransformed with <functionlink id="RetransformClasses"/> (assuming7476the agent possesses the7477<fieldlink id="can_retransform_classes" struct="jvmtiCapabilities"/>7478capability).7479If a class is not modifiable (<paramlink id="is_modifiable_class_ptr"/>7480returns <code>JNI_FALSE</code>) the class can be neither7481redefined nor retransformed.7482<p/>7483Primitive classes (for example, <code>java.lang.Integer.TYPE</code>),7484array classes, and some implementation defined classes are never modifiable.7485<p/>7486</description>7487<origin>new</origin>7488<capabilities>7489<capability id="can_redefine_any_class">7490If possessed then all classes (except primitive, array, and some implementation defined7491classes) are modifiable with <functionlink id="RedefineClasses"/>.7492</capability>7493<capability id="can_retransform_any_class">7494If possessed then all classes (except primitive, array, and some implementation defined7495classes) are modifiable with <functionlink id="RetransformClasses"/>.7496</capability>7497<capability id="can_redefine_classes">7498No effect on the result of the function.7499But must additionally be possessed to modify the class with7500<functionlink id="RedefineClasses"/>.7501</capability>7502<capability id="can_retransform_classes">7503No effect on the result of the function.7504But must additionally be possessed to modify the class with7505<functionlink id="RetransformClasses"/>.7506</capability>7507</capabilities>7508<parameters>7509<param id="klass">7510<jclass/>7511<description>7512The class to query.7513</description>7514</param>7515<param id="is_modifiable_class_ptr">7516<outptr><jboolean/></outptr>7517<description>7518On return, points to the boolean result of this function.7519</description>7520</param>7521</parameters>7522<errors>7523</errors>7524</function>75257526<function id="GetClassLoader" phase="start" num="57">7527<synopsis>Get Class Loader</synopsis>7528<description>7529For the class indicated by <code>klass</code>, return via7530<code>classloader_ptr</code> a reference to the class loader for the7531class.7532</description>7533<origin>jvmdi</origin>7534<capabilities>7535</capabilities>7536<parameters>7537<param id="klass">7538<jclass/>7539<description>7540The class to query.7541</description>7542</param>7543<param id="classloader_ptr">7544<outptr><jobject/></outptr>7545<description>7546On return, points to the class loader that loaded7547this class.7548If the class was not created by a class loader7549or if the class loader is the bootstrap class loader,7550points to <code>NULL</code>.7551</description>7552</param>7553</parameters>7554<errors>7555</errors>75567557</function>75587559<function id="GetSourceDebugExtension" phase="start" num="90">7560<synopsis>Get Source Debug Extension</synopsis>7561<description>7562For the class indicated by <code>klass</code>, return the debug7563extension via <code>source_debug_extension_ptr</code>.7564The returned string7565contains exactly the debug extension information present in the7566class file of <code>klass</code>.7567</description>7568<origin>jvmdi</origin>7569<capabilities>7570<required id="can_get_source_debug_extension"></required>7571</capabilities>7572<parameters>7573<param id="klass">7574<jclass/>7575<description>7576The class to query.7577</description>7578</param>7579<param id="source_debug_extension_ptr">7580<allocbuf><char/></allocbuf>7581<description>7582On return, points to the class's debug extension, encoded as a7583<internallink id="mUTF">modified UTF-8</internallink> string.7584</description>7585</param>7586</parameters>7587<errors>7588<error id="JVMTI_ERROR_ABSENT_INFORMATION">7589Class information does not include a debug extension.7590</error>7591</errors>7592</function>75937594<function id="RetransformClasses" jkernel="yes" num="152" since="1.1">7595<synopsis>Retransform Classes</synopsis>7596<description>7597This function facilitates the7598<internallink id="bci">bytecode instrumentation</internallink>7599of already loaded classes.7600To replace the class definition without reference to the existing7601bytecodes, as one might do when recompiling from source for7602fix-and-continue debugging, <functionlink id="RedefineClasses"/>7603function should be used instead.7604<p/>7605When classes are initially loaded or when they are7606<functionlink id="RedefineClasses">redefined</functionlink>,7607the initial class file bytes can be transformed with the7608<eventlink id="ClassFileLoadHook"/> event.7609This function reruns the transformation process7610(whether or not a transformation has previously occurred).7611This retransformation follows these steps:7612<ul>7613<li>starting from the initial class file bytes7614</li>7615<li>for each <fieldlink id="can_retransform_classes"7616struct="jvmtiCapabilities">retransformation7617incapable</fieldlink>7618agent which received a7619<code>ClassFileLoadHook</code> event during the previous7620load or redefine, the bytes it returned7621(via the <code>new_class_data</code> parameter)7622are reused as the output of the transformation;7623note that this is equivalent to reapplying7624the previous transformation, unaltered. except that7625the <code>ClassFileLoadHook</code> event7626is <b>not</b> sent to these agents7627</li>7628<li>for each <fieldlink id="can_retransform_classes"7629struct="jvmtiCapabilities">retransformation7630capable</fieldlink>7631agent, the <code>ClassFileLoadHook</code> event is sent,7632allowing a new transformation to be applied7633</li>7634<li>the transformed class file bytes are installed as the new7635definition of the class7636</li>7637</ul>7638See the <eventlink id="ClassFileLoadHook"/> event for more details.7639<p/>7640The initial class file bytes represent the bytes passed to7641<code>ClassLoader.defineClass</code>7642or <code>RedefineClasses</code> (before any transformations7643were applied), however they may not exactly match them.7644The constant pool may differ in ways described in7645<functionlink id="GetConstantPool"/>.7646Constant pool indices in the bytecodes of methods will correspond.7647Some attributes may not be present.7648Where order is not meaningful, for example the order of methods,7649order may not be preserved.7650<p/>7651Retransformation can cause new versions of methods to be installed.7652Old method versions may become7653<internallink id="obsoleteMethods">obsolete</internallink>7654The new method version will be used on new invokes.7655If a method has active stack frames, those active frames continue to7656run the bytecodes of the original method version.7657<p/>7658This function does not cause any initialization except that which7659would occur under the customary JVM semantics.7660In other words, retransforming a class does not cause its initializers to be7661run. The values of static fields will remain as they were7662prior to the call.7663<p/>7664Threads need not be suspended.7665<p/>7666All breakpoints in the class are cleared.7667<p/>7668All attributes are updated.7669<p/>7670Instances of the retransformed class are not affected -- fields retain their7671previous values.7672<functionlink id="GetTag">Tags</functionlink> on the instances are7673also unaffected.7674<p/>7675In response to this call, no events other than the7676<eventlink id="ClassFileLoadHook"/> event7677will be sent.7678<p/>7679The retransformation may change method bodies, the constant pool and attributes7680(unless explicitly prohibited).7681The retransformation must not add, remove or rename fields or methods, change the7682signatures of methods, change modifiers, or change inheritance.7683The retransformation must not change the <code>NestHost</code>,7684<code>NestMembers</code>, <code>Record</code>, or <code>PermittedSubclasses</code>7685attributes.7686These restrictions may be lifted in future versions.7687See the error return description below for information on error codes7688returned if an unsupported retransformation is attempted.7689The class file bytes are not verified or installed until they have passed7690through the chain of <eventlink id="ClassFileLoadHook"/> events, thus the7691returned error code reflects the result of the transformations.7692If any error code is returned other than <code>JVMTI_ERROR_NONE</code>,7693none of the classes to be retransformed will have a new definition installed.7694When this function returns (with the error code of <code>JVMTI_ERROR_NONE</code>)7695all of the classes to be retransformed will have their new definitions installed.7696</description>7697<origin>new</origin>7698<capabilities>7699<required id="can_retransform_classes"></required>7700<capability id="can_retransform_any_class"></capability>7701</capabilities>7702<parameters>7703<param id="class_count">7704<jint min="0"/>7705<description>7706The number of classes to be retransformed.7707</description>7708</param>7709<param id="classes">7710<inbuf incount="class_count"><jclass/></inbuf>7711<description>7712The array of classes to be retransformed.7713</description>7714</param>7715</parameters>7716<errors>7717<error id="JVMTI_ERROR_UNMODIFIABLE_CLASS">7718One of the <paramlink id="classes"/> cannot be modified.7719See <functionlink id="IsModifiableClass"/>.7720</error>7721<error id="JVMTI_ERROR_INVALID_CLASS">7722One of the <paramlink id="classes"/> is not a valid class.7723</error>7724<error id="JVMTI_ERROR_UNSUPPORTED_VERSION">7725A retransformed class file has a version number not supported by this VM.7726</error>7727<error id="JVMTI_ERROR_INVALID_CLASS_FORMAT">7728A retransformed class file is malformed (The VM would return a <code>ClassFormatError</code>).7729</error>7730<error id="JVMTI_ERROR_CIRCULAR_CLASS_DEFINITION">7731The retransformed class file definitions would lead to a circular definition7732(the VM would return a <code>ClassCircularityError</code>).7733</error>7734<error id="JVMTI_ERROR_FAILS_VERIFICATION">7735The retransformed class file bytes fail verification.7736</error>7737<error id="JVMTI_ERROR_NAMES_DONT_MATCH">7738The class name defined in a retransformed class file is7739different from the name in the old class object.7740</error>7741<error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_ADDED">7742A retransformed class file would require adding a method.7743</error>7744<error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED">7745A retransformed class file changes a field.7746</error>7747<error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED">7748A direct superclass is different for a retransformed class file,7749or the set of directly implemented7750interfaces is different.7751</error>7752<error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_DELETED">7753A retransformed class file does not declare a method7754declared in the old class version.7755</error>7756<error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_ATTRIBUTE_CHANGED">7757A retransformed class file has unsupported differences in class attributes.7758</error>7759<error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED">7760A retransformed class file has different class modifiers.7761</error>7762<error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED">7763A method in the retransformed class file has different modifiers7764than its counterpart in the old class version.7765</error>7766</errors>7767</function>77687769<function id="RedefineClasses" jkernel="yes" num="87">7770<synopsis>Redefine Classes</synopsis>7771<typedef id="jvmtiClassDefinition" label="Class redefinition description">7772<field id="klass">7773<jclass/>7774<description>7775Class object for this class7776</description>7777</field>7778<field id="class_byte_count">7779<jint/>7780<description>7781Number of bytes defining class (below)7782</description>7783</field>7784<field id="class_bytes">7785<inbuf incount="class_byte_count"><uchar/></inbuf>7786<description>7787Bytes defining class (in <vmspec chapter="4"/>)7788</description>7789</field>7790</typedef>7791<description>7792All classes given are redefined according to the definitions7793supplied.7794This function is used to replace the definition of a class7795with a new definition, as might be needed in fix-and-continue7796debugging.7797Where the existing class file bytes are to be transformed, for7798example in7799<internallink id="bci">bytecode instrumentation</internallink>,7800<functionlink id="RetransformClasses"/> should be used.7801<p/>7802Redefinition can cause new versions of methods to be installed.7803Old method versions may become7804<internallink id="obsoleteMethods">obsolete</internallink>7805The new method version will be used on new invokes.7806If a method has active stack frames, those active frames continue to7807run the bytecodes of the original method version.7808If resetting of stack frames is desired, use7809<functionlink id="PopFrame"></functionlink>7810to pop frames with obsolete method versions.7811<p/>7812This function does not cause any initialization except that which7813would occur under the customary JVM semantics.7814In other words, redefining a class does not cause its initializers to be7815run. The values of static fields will remain as they were7816prior to the call.7817<p/>7818Threads need not be suspended.7819<p/>7820All breakpoints in the class are cleared.7821<p/>7822All attributes are updated.7823<p/>7824Instances of the redefined class are not affected -- fields retain their7825previous values.7826<functionlink id="GetTag">Tags</functionlink> on the instances are7827also unaffected.7828<p/>7829In response to this call, the <jvmti/> event7830<eventlink id="ClassFileLoadHook">Class File Load Hook</eventlink>7831will be sent (if enabled), but no other <jvmti/> events will be sent.7832<p/>7833The redefinition may change method bodies, the constant pool and attributes7834(unless explicitly prohibited).7835The redefinition must not add, remove or rename fields or methods, change the7836signatures of methods, change modifiers, or change inheritance.7837The redefinition must not change the <code>NestHost</code>,7838<code>NestMembers</code>, <code>Record</code>, or <code>PermittedSubclasses</code>7839attributes.7840These restrictions may be lifted in future versions.7841See the error return description below for information on error codes7842returned if an unsupported redefinition is attempted.7843The class file bytes are not verified or installed until they have passed7844through the chain of <eventlink id="ClassFileLoadHook"/> events, thus the7845returned error code reflects the result of the transformations applied7846to the bytes passed into <paramlink id="class_definitions"/>.7847If any error code is returned other than <code>JVMTI_ERROR_NONE</code>,7848none of the classes to be redefined will have a new definition installed.7849When this function returns (with the error code of <code>JVMTI_ERROR_NONE</code>)7850all of the classes to be redefined will have their new definitions installed.7851</description>7852<origin>jvmdi</origin>7853<capabilities>7854<required id="can_redefine_classes"></required>7855<capability id="can_redefine_any_class"></capability>7856</capabilities>7857<parameters>7858<param id="class_count">7859<jint min="0"/>7860<description>7861The number of classes specified in <code>class_definitions</code>7862</description>7863</param>7864<param id="class_definitions">7865<inbuf incount="class_count"><struct>jvmtiClassDefinition</struct></inbuf>7866<description>7867The array of new class definitions7868</description>7869</param>7870</parameters>7871<errors>7872<error id="JVMTI_ERROR_NULL_POINTER">7873One of <code>class_bytes</code> is <code>NULL</code>.7874</error>7875<error id="JVMTI_ERROR_UNMODIFIABLE_CLASS">7876An element of <code>class_definitions</code> cannot be modified.7877See <functionlink id="IsModifiableClass"/>.7878</error>7879<error id="JVMTI_ERROR_INVALID_CLASS">7880An element of <code>class_definitions</code> is not a valid class.7881</error>7882<error id="JVMTI_ERROR_UNSUPPORTED_VERSION">7883A new class file has a version number not supported by this VM.7884</error>7885<error id="JVMTI_ERROR_INVALID_CLASS_FORMAT">7886A new class file is malformed (The VM would return a <code>ClassFormatError</code>).7887</error>7888<error id="JVMTI_ERROR_CIRCULAR_CLASS_DEFINITION">7889The new class file definitions would lead to a circular definition7890(the VM would return a <code>ClassCircularityError</code>).7891</error>7892<error id="JVMTI_ERROR_FAILS_VERIFICATION">7893The class bytes fail verification.7894</error>7895<error id="JVMTI_ERROR_NAMES_DONT_MATCH">7896The class name defined in a new class file is7897different from the name in the old class object.7898</error>7899<error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_ADDED">7900A new class file would require adding a method.7901</error>7902<error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED">7903A new class version changes a field.7904</error>7905<error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED">7906A direct superclass is different for a new class7907version, or the set of directly implemented7908interfaces is different.7909</error>7910<error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_DELETED">7911A new class version does not declare a method7912declared in the old class version.7913</error>7914<error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_ATTRIBUTE_CHANGED">7915A new class version has unsupported differences in class attributes.7916</error>7917<error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED">7918A new class version has different modifiers.7919</error>7920<error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED">7921A method in the new class version has different modifiers7922than its counterpart in the old class version.7923</error>7924<error id="JVMTI_ERROR_UNMODIFIABLE_MODULE">7925A module cannot be modified.7926See <functionlink id="IsModifiableModule"/>.7927</error>7928</errors>7929</function>79307931</category>79327933<category id="object" label="Object">79347935<function id="GetObjectSize" jkernel="yes" phase="start" num="154">7936<synopsis>Get Object Size</synopsis>7937<description>7938For the object indicated by <code>object</code>,7939return via <code>size_ptr</code> the size of the object.7940This size is an implementation-specific approximation of7941the amount of storage consumed by this object.7942It may include some or all of the object's overhead, and thus7943is useful for comparison within an implementation but not7944between implementations.7945The estimate may change during a single invocation of the JVM.7946</description>7947<origin>new</origin>7948<capabilities>7949</capabilities>7950<parameters>7951<param id="object">7952<jobject/>7953<description>7954The object to query.7955</description>7956</param>7957<param id="size_ptr">7958<outptr><jlong/></outptr>7959<description>7960On return, points to the object's size in bytes.7961</description>7962</param>7963</parameters>7964<errors>7965</errors>7966</function>79677968<function id="GetObjectHashCode" phase="start" num="58">7969<synopsis>Get Object Hash Code</synopsis>7970<description>7971For the object indicated by <code>object</code>,7972return via <code>hash_code_ptr</code> a hash code.7973This hash code could be used to maintain a hash table of object references,7974however, on some implementations this can cause significant performance7975impacts--in most cases7976<internallink id="Heap">tags</internallink>7977will be a more efficient means of associating information with objects.7978This function guarantees7979the same hash code value for a particular object throughout its life7980</description>7981<origin>jvmdi</origin>7982<capabilities>7983</capabilities>7984<parameters>7985<param id="object">7986<jobject/>7987<description>7988The object to query.7989</description>7990</param>7991<param id="hash_code_ptr">7992<outptr><jint/></outptr>7993<description>7994On return, points to the object's hash code.7995</description>7996</param>7997</parameters>7998<errors>7999</errors>8000</function>80018002<function id="GetObjectMonitorUsage" num="59">8003<synopsis>Get Object Monitor Usage</synopsis>8004<typedef id="jvmtiMonitorUsage" label="Object monitor usage information">8005<field id="owner">8006<jthread/>8007<description>8008The thread owning this monitor, or <code>NULL</code> if unused8009</description>8010</field>8011<field id="entry_count">8012<jint/>8013<description>8014The number of times the owning thread has entered the monitor8015</description>8016</field>8017<field id="waiter_count">8018<jint/>8019<description>8020The number of threads waiting to own this monitor8021</description>8022</field>8023<field id="waiters">8024<allocfieldbuf><jthread/></allocfieldbuf>8025<description>8026The <code>waiter_count</code> waiting threads8027</description>8028</field>8029<field id="notify_waiter_count">8030<jint/>8031<description>8032The number of threads waiting to be notified by this monitor8033</description>8034</field>8035<field id="notify_waiters">8036<allocfieldbuf><jthread/></allocfieldbuf>8037<description>8038The <code>notify_waiter_count</code> threads waiting to be notified8039</description>8040</field>8041</typedef>8042<description>8043Get information about the object's monitor.8044The fields of the <functionlink id="jvmtiMonitorUsage"></functionlink> structure8045are filled in with information about usage of the monitor.8046<todo>8047Decide and then clarify suspend requirements.8048</todo>8049</description>8050<origin>jvmdi</origin>8051<capabilities>8052<required id="can_get_monitor_info"></required>8053</capabilities>8054<parameters>8055<param id="object">8056<jobject/>8057<description>8058The object to query.8059</description>8060</param>8061<param id="info_ptr">8062<outptr><struct>jvmtiMonitorUsage</struct></outptr>8063<description>8064On return, filled with monitor information for the8065specified object.8066</description>8067</param>8068</parameters>8069<errors>8070</errors>8071</function>80728073<elide>8074<function id="GetObjectMonitors" num="116">8075<synopsis>Get Object Monitors</synopsis>8076<description>8077Return the list of object monitors.8078<p/>8079Note: details about each monitor can be examined with8080<functionlink id="GetObjectMonitorUsage"></functionlink>.8081</description>8082<origin>new</origin>8083<capabilities>8084<required id="can_get_monitor_info"></required>8085</capabilities>8086<parameters>8087<param id="monitorCnt">8088<outptr><jint/></outptr>8089<description>8090On return, pointer to the number8091of monitors returned in <code>monitors_ptr</code>.8092</description>8093</param>8094<param id="monitors_ptr">8095<allocbuf outcount="monitorCnt"><jobject/></allocbuf>8096<description>8097On return, pointer to the monitor list.8098</description>8099</param>8100</parameters>8101<errors>8102</errors>8103</function>8104</elide>81058106</category>81078108<category id="fieldCategory" label="Field">81098110<intro>8111</intro>81128113<function id="GetFieldName" phase="start" num="60">8114<synopsis>Get Field Name (and Signature)</synopsis>8115<description>8116For the field indicated by <paramlink id="klass"/> and <paramlink id="field"/>,8117return the field name via <paramlink id="name_ptr"/> and field signature via8118<paramlink id="signature_ptr"/>.8119<p/>8120Field signatures are defined in the8121<externallink id="jni/index.html">JNI Specification</externallink>8122and are referred to as <code>field descriptors</code> in8123<vmspec chapter="4.3.2"/>.8124</description>8125<origin>jvmdiClone</origin>8126<capabilities>8127</capabilities>8128<parameters>8129<param id="klass">8130<jclass field="field"/>8131<description>8132The class of the field to query.8133</description>8134</param>8135<param id="field">8136<jfieldID class="klass"/>8137<description>8138The field to query.8139</description>8140</param>8141<param id="name_ptr">8142<allocbuf>8143<char/>8144<nullok>the name is not returned</nullok>8145</allocbuf>8146<description>8147On return, points to the field name, encoded as a8148<internallink id="mUTF">modified UTF-8</internallink> string.8149</description>8150</param>8151<param id="signature_ptr">8152<allocbuf>8153<char/>8154<nullok>the signature is not returned</nullok>8155</allocbuf>8156<description>8157On return, points to the field signature, encoded as a8158<internallink id="mUTF">modified UTF-8</internallink> string.8159</description>8160</param>8161<param id="generic_ptr">8162<allocbuf>8163<char/>8164<nullok>the generic signature is not returned</nullok>8165</allocbuf>8166<description>8167On return, points to the generic signature of the field, encoded as a8168<internallink id="mUTF">modified UTF-8</internallink> string.8169If there is no generic signature attribute for the field, then,8170on return, points to <code>NULL</code>.8171</description>8172</param>8173</parameters>8174<errors>8175</errors>8176</function>81778178<function id="GetFieldDeclaringClass" phase="start" num="61">8179<synopsis>Get Field Declaring Class</synopsis>8180<description>8181For the field indicated by <code>klass</code> and <code>field</code>8182return the class that defined it via <code>declaring_class_ptr</code>.8183The declaring class will either be <code>klass</code>, a superclass, or8184an implemented interface.8185</description>8186<origin>jvmdi</origin>8187<capabilities>8188</capabilities>8189<parameters>8190<param id="klass">8191<jclass field="field"/>8192<description>8193The class to query.8194</description>8195</param>8196<param id="field">8197<jfieldID class="klass"/>8198<description>8199The field to query.8200</description>8201</param>8202<param id="declaring_class_ptr">8203<outptr><jclass/></outptr>8204<description>8205On return, points to the declaring class8206</description>8207</param>8208</parameters>8209<errors>8210</errors>8211</function>82128213<function id="GetFieldModifiers" phase="start" num="62">8214<synopsis>Get Field Modifiers</synopsis>8215<description>8216For the field indicated by <code>klass</code> and <code>field</code>8217return the access flags via <code>modifiers_ptr</code>.8218Access flags are defined in <vmspec chapter="4"/>.8219</description>8220<origin>jvmdi</origin>8221<capabilities>8222</capabilities>8223<parameters>8224<param id="klass">8225<jclass field="field"/>8226<description>8227The class to query.8228</description>8229</param>8230<param id="field">8231<jfieldID class="klass"/>8232<description>8233The field to query.8234</description>8235</param>8236<param id="modifiers_ptr">8237<outptr><jint/></outptr>8238<description>8239On return, points to the access flags.8240</description>8241</param>8242</parameters>8243<errors>8244</errors>8245</function>82468247<function id="IsFieldSynthetic" phase="start" num="63">8248<synopsis>Is Field Synthetic</synopsis>8249<description>8250For the field indicated by <code>klass</code> and <code>field</code>, return a8251value indicating whether the field is synthetic via <code>is_synthetic_ptr</code>.8252Synthetic fields are generated by the compiler but not present in the8253original source code.8254</description>8255<origin>jvmdi</origin>8256<capabilities>8257<required id="can_get_synthetic_attribute"></required>8258</capabilities>8259<parameters>8260<param id="klass">8261<jclass field="field"/>8262<description>8263The class of the field to query.8264</description>8265</param>8266<param id="field">8267<jfieldID class="klass"/>8268<description>8269The field to query.8270</description>8271</param>8272<param id="is_synthetic_ptr">8273<outptr><jboolean/></outptr>8274<description>8275On return, points to the boolean result of this function.8276</description>8277</param>8278</parameters>8279<errors>8280</errors>8281</function>82828283</category>82848285<category id="method" label="Method">82868287<intro>8288These functions provide information about a method (represented as a8289<typelink id="jmethodID"/>) and set how methods are processed.8290</intro>82918292<intro id="obsoleteMethods" label="Obsolete Methods">8293The functions <functionlink id="RetransformClasses"/> and8294<functionlink id="RedefineClasses"/> can cause new versions8295of methods to be installed.8296An original version of a method is considered equivalent8297to the new version if:8298<ul>8299<li>their bytecodes are the same except for indices into the8300constant pool and </li>8301<li>the referenced constants are equal.</li>8302</ul>8303An original method version which is not equivalent to the8304new method version is called obsolete and is assigned a new method ID;8305the original method ID now refers to the new method version.8306A method ID can be tested for obsolescence with8307<functionlink id="IsMethodObsolete"/>.8308</intro>83098310<function id="GetMethodName" phase="start" num="64">8311<synopsis>Get Method Name (and Signature)</synopsis>8312<description>8313For the method indicated by <code>method</code>,8314return the method name via <code>name_ptr</code> and method signature via8315<code>signature_ptr</code>.8316<p/>8317Method signatures are defined in the8318<externallink id="jni/index.html">JNI Specification</externallink>8319and are referred to as <code>method descriptors</code> in8320<vmspec chapter="4.3.3"/>.8321Note this is different8322than method signatures as defined in the <i>Java Language Specification</i>.8323</description>8324<origin>jvmdiClone</origin>8325<capabilities>8326</capabilities>8327<parameters>8328<param id="method">8329<jmethodID/>8330<description>8331The method to query.8332</description>8333</param>8334<param id="name_ptr">8335<allocbuf>8336<char/>8337<nullok>the name is not returned</nullok>8338</allocbuf>8339<description>8340On return, points to the method name, encoded as a8341<internallink id="mUTF">modified UTF-8</internallink> string.8342</description>8343</param>8344<param id="signature_ptr">8345<allocbuf>8346<char/>8347<nullok>the signature is not returned</nullok>8348</allocbuf>8349<description>8350On return, points to the method signature, encoded as a8351<internallink id="mUTF">modified UTF-8</internallink> string.8352</description>8353</param>8354<param id="generic_ptr">8355<allocbuf>8356<char/>8357<nullok>the generic signature is not returned</nullok>8358</allocbuf>8359<description>8360On return, points to the generic signature of the method, encoded as a8361<internallink id="mUTF">modified UTF-8</internallink> string.8362If there is no generic signature attribute for the method, then,8363on return, points to <code>NULL</code>.8364</description>8365</param>8366</parameters>8367<errors>8368</errors>8369</function>83708371<function id="GetMethodDeclaringClass" phase="start" num="65">8372<synopsis>Get Method Declaring Class</synopsis>8373<description>8374For the method indicated by <code>method</code>,8375return the class that defined it via <code>declaring_class_ptr</code>.8376</description>8377<origin>jvmdi</origin>8378<capabilities>8379</capabilities>8380<parameters>8381<param id="klass">8382<jclass method="method"/>8383<description>8384The class to query.8385</description>8386</param>8387<param id="method">8388<jmethodID class="klass"/>8389<description>8390The method to query.8391</description>8392</param>8393<param id="declaring_class_ptr">8394<outptr><jclass/></outptr>8395<description>8396On return, points to the declaring class8397</description>8398</param>8399</parameters>8400<errors>8401</errors>8402</function>84038404<function id="GetMethodModifiers" phase="start" num="66">8405<synopsis>Get Method Modifiers</synopsis>8406<description>8407For the method indicated by <code>method</code>,8408return the access flags via <code>modifiers_ptr</code>.8409Access flags are defined in <vmspec chapter="4"/>.8410</description>8411<origin>jvmdi</origin>8412<capabilities>8413</capabilities>8414<parameters>8415<param id="klass">8416<jclass method="method"/>8417<description>8418The class to query.8419</description>8420</param>8421<param id="method">8422<jmethodID class="klass"/>8423<description>8424The method to query.8425</description>8426</param>8427<param id="modifiers_ptr">8428<outptr><jint/></outptr>8429<description>8430On return, points to the access flags.8431</description>8432</param>8433</parameters>8434<errors>8435</errors>8436</function>84378438<function id="GetMaxLocals" phase="start" num="68">8439<synopsis>Get Max Locals</synopsis>8440<description>8441For the method indicated by <code>method</code>,8442return the number of local variable slots used by the method,8443including the local variables used to pass parameters to the8444method on its invocation.8445<p/>8446See <code>max_locals</code> in <vmspec chapter="4.7.3"/>.8447</description>8448<origin>jvmdi</origin>8449<capabilities>8450</capabilities>8451<parameters>8452<param id="klass">8453<jclass method="method"/>8454<description>8455The class to query.8456</description>8457</param>8458<param id="method">8459<jmethodID class="klass" native="error"/>8460<description>8461The method to query.8462</description>8463</param>8464<param id="max_ptr">8465<outptr><jint/></outptr>8466<description>8467On return, points to the maximum number of local slots8468</description>8469</param>8470</parameters>8471<errors>8472</errors>8473</function>84748475<function id="GetArgumentsSize" phase="start" num="69">8476<synopsis>Get Arguments Size</synopsis>8477<description>8478For the method indicated by <code>method</code>,8479return via <code>max_ptr</code> the number of local variable slots used8480by the method's arguments.8481Note that two-word arguments use two slots.8482</description>8483<origin>jvmdi</origin>8484<capabilities>8485</capabilities>8486<parameters>8487<param id="klass">8488<jclass method="method"/>8489<description>8490The class to query.8491</description>8492</param>8493<param id="method">8494<jmethodID class="klass" native="error"/>8495<description>8496The method to query.8497</description>8498</param>8499<param id="size_ptr">8500<outptr><jint/></outptr>8501<description>8502On return, points to the number of argument slots8503</description>8504</param>8505</parameters>8506<errors>8507</errors>8508</function>85098510<function id="GetLineNumberTable" phase="start" num="70">8511<synopsis>Get Line Number Table</synopsis>8512<typedef id="jvmtiLineNumberEntry" label="Line number table entry">8513<field id="start_location">8514<jlocation/>8515<description>8516the <datalink id="jlocation"></datalink> where the line begins8517</description>8518</field>8519<field id="line_number">8520<jint/>8521<description>8522the line number8523</description>8524</field>8525</typedef>8526<description>8527For the method indicated by <code>method</code>,8528return a table of source line number entries. The size of the table is8529returned via <code>entry_count_ptr</code> and the table itself is8530returned via <code>table_ptr</code>.8531</description>8532<origin>jvmdi</origin>8533<capabilities>8534<required id="can_get_line_numbers"></required>8535</capabilities>8536<parameters>8537<param id="klass">8538<jclass method="method"/>8539<description>8540The class to query.8541</description>8542</param>8543<param id="method">8544<jmethodID class="klass" native="error"/>8545<description>8546The method to query.8547</description>8548</param>8549<param id="entry_count_ptr">8550<outptr><jint/></outptr>8551<description>8552On return, points to the number of entries in the table8553</description>8554</param>8555<param id="table_ptr">8556<allocbuf outcount="entry_count_ptr"><struct>jvmtiLineNumberEntry</struct></allocbuf>8557<description>8558On return, points to the line number table pointer.8559</description>8560</param>8561</parameters>8562<errors>8563<error id="JVMTI_ERROR_ABSENT_INFORMATION">8564Class information does not include line numbers.8565</error>8566</errors>8567</function>85688569<function id="GetMethodLocation" phase="start" num="71">8570<synopsis>Get Method Location</synopsis>8571<description>8572For the method indicated by <code>method</code>,8573return the beginning and ending addresses through8574<code>start_location_ptr</code> and <code>end_location_ptr</code>. In a8575conventional bytecode indexing scheme,8576<code>start_location_ptr</code> will always point to zero8577and <code>end_location_ptr</code>8578will always point to the bytecode count minus one.8579</description>8580<origin>jvmdi</origin>8581<capabilities>8582</capabilities>8583<parameters>8584<param id="klass">8585<jclass method="method"/>8586<description>8587The class to query.8588</description>8589</param>8590<param id="method">8591<jmethodID class="klass" native="error"/>8592<description>8593The method to query.8594</description>8595</param>8596<param id="start_location_ptr">8597<outptr><jlocation/></outptr>8598<description>8599On return, points to the first location, or8600<code>-1</code> if location information is not available.8601If the information is available and8602<functionlink id="GetJLocationFormat"></functionlink>8603returns <datalink id="JVMTI_JLOCATION_JVMBCI"></datalink>8604then this will always be zero.8605</description>8606</param>8607<param id="end_location_ptr">8608<outptr><jlocation/></outptr>8609<description>8610On return, points to the last location,8611or <code>-1</code> if location information is not available.8612</description>8613</param>8614</parameters>8615<errors>8616<error id="JVMTI_ERROR_ABSENT_INFORMATION">8617Class information does not include method sizes.8618</error>8619</errors>8620</function>86218622<function id="GetLocalVariableTable" num="72">8623<synopsis>Get Local Variable Table</synopsis>8624<typedef id="jvmtiLocalVariableEntry" label="Local variable table entry">8625<field id="start_location">8626<jlocation/>8627<description>8628The code array index where the local variable is first valid8629(that is, where it must have a value).8630</description>8631</field>8632<field id="length">8633<jint/>8634<description>8635The length of the valid section for this local variable.8636The last code array index where the local variable is valid8637is <code>start_location + length</code>.8638</description>8639</field>8640<field id="name">8641<allocfieldbuf><char/></allocfieldbuf>8642<description>8643The local variable name, encoded as a8644<internallink id="mUTF">modified UTF-8</internallink> string.8645</description>8646</field>8647<field id="signature">8648<allocfieldbuf><char/></allocfieldbuf>8649<description>8650The local variable's type signature, encoded as a8651<internallink id="mUTF">modified UTF-8</internallink> string.8652The signature format is the same as that defined in8653<vmspec chapter="4.3.2"/>.8654</description>8655</field>8656<field id="generic_signature">8657<allocfieldbuf><char/></allocfieldbuf>8658<description>8659The local variable's generic signature, encoded as a8660<internallink id="mUTF">modified UTF-8</internallink> string.8661The value of this field will be <code>NULL</code> for any local8662variable which does not have a generic type.8663</description>8664</field>8665<field id="slot">8666<jint/>8667<description>8668The local variable's slot. See <internallink id="local">Local Variables</internallink>.8669</description>8670</field>8671</typedef>8672<description>8673Return local variable information.8674</description>8675<origin>jvmdiClone</origin>8676<capabilities>8677<required id="can_access_local_variables"></required>8678</capabilities>8679<parameters>8680<param id="method">8681<jmethodID native="error"/>8682<description>8683The method to query.8684</description>8685</param>8686<param id="entry_count_ptr">8687<outptr><jint/></outptr>8688<description>8689On return, points to the number of entries in the table8690</description>8691</param>8692<param id="table_ptr">8693<allocbuf outcount="entry_count_ptr"><struct>jvmtiLocalVariableEntry</struct></allocbuf>8694<description>8695On return, points to an array of local variable table entries.8696</description>8697</param>8698</parameters>8699<errors>8700<error id="JVMTI_ERROR_ABSENT_INFORMATION">8701Class information does not include local variable8702information.8703</error>8704</errors>8705</function>87068707<function id="GetBytecodes" phase="start" num="75">8708<synopsis>Get Bytecodes</synopsis>8709<description>8710For the method indicated by <code>method</code>,8711return the bytecodes that implement the method. The number of8712bytecodes is returned via <code>bytecode_count_ptr</code>. The bytecodes8713themselves are returned via <code>bytecodes_ptr</code>.8714</description>8715<origin>jvmdi</origin>8716<capabilities>8717<required id="can_get_bytecodes"></required>8718</capabilities>8719<parameters>8720<param id="klass">8721<jclass method="method"/>8722<description>8723The class to query.8724</description>8725</param>8726<param id="method">8727<jmethodID class="klass" native="error"/>8728<description>8729The method to query.8730</description>8731</param>8732<param id="bytecode_count_ptr">8733<outptr><jint/></outptr>8734<description>8735On return, points to the length of the bytecode array8736</description>8737</param>8738<param id="bytecodes_ptr">8739<allocbuf outcount="bytecode_count_ptr"><uchar/></allocbuf>8740<description>8741On return, points to the pointer to the bytecode array8742</description>8743</param>8744</parameters>8745<errors>8746</errors>8747</function>87488749<function id="IsMethodNative" phase="start" num="76">8750<synopsis>Is Method Native</synopsis>8751<description>8752For the method indicated by <code>method</code>, return a8753value indicating whether the method is native via <code>is_native_ptr</code>8754</description>8755<origin>jvmdi</origin>8756<capabilities>8757</capabilities>8758<parameters>8759<param id="klass">8760<jclass method="method"/>8761<description>8762The class to query.8763</description>8764</param>8765<param id="method">8766<jmethodID class="klass"/>8767<description>8768The method to query.8769</description>8770</param>8771<param id="is_native_ptr">8772<outptr><jboolean/></outptr>8773<description>8774On return, points to the boolean result of this function.8775</description>8776</param>8777</parameters>8778<errors>8779</errors>8780</function>87818782<function id="IsMethodSynthetic" phase="start" num="77">8783<synopsis>Is Method Synthetic</synopsis>8784<description>8785For the method indicated by <code>method</code>, return a8786value indicating whether the method is synthetic via <code>is_synthetic_ptr</code>.8787Synthetic methods are generated by the compiler but not present in the8788original source code.8789</description>8790<origin>jvmdi</origin>8791<capabilities>8792<required id="can_get_synthetic_attribute"></required>8793</capabilities>8794<parameters>8795<param id="klass">8796<jclass method="method"/>8797<description>8798The class to query.8799</description>8800</param>8801<param id="method">8802<jmethodID class="klass"/>8803<description>8804The method to query.8805</description>8806</param>8807<param id="is_synthetic_ptr">8808<outptr><jboolean/></outptr>8809<description>8810On return, points to the boolean result of this function.8811</description>8812</param>8813</parameters>8814<errors>8815</errors>8816</function>88178818<function id="IsMethodObsolete" phase="start" num="91">8819<synopsis>Is Method Obsolete</synopsis>8820<description>8821Determine if a method ID refers to an8822<internallink id="obsoleteMethods">obsolete</internallink>8823method version.8824</description>8825<origin>jvmdi</origin>8826<capabilities>8827</capabilities>8828<parameters>8829<param id="klass">8830<jclass method="method"/>8831<description>8832The class to query.8833</description>8834</param>8835<param id="method">8836<jmethodID class="klass"/>8837<description>8838The method ID to query.8839</description>8840</param>8841<param id="is_obsolete_ptr">8842<outptr><jboolean/></outptr>8843<description>8844On return, points to the boolean result of this function.8845</description>8846</param>8847</parameters>8848<errors>8849</errors>8850</function>88518852<function id="SetNativeMethodPrefix" jkernel="yes" phase="any" num="73" since="1.1">8853<synopsis>Set Native Method Prefix</synopsis>8854<description>8855This function modifies the failure handling of8856native method resolution by allowing retry8857with a prefix applied to the name.8858When used with the8859<eventlink id="ClassFileLoadHook">ClassFileLoadHook8860event</eventlink>, it enables native methods to be8861<internallink id="bci">instrumented</internallink>.8862<p/>8863Since native methods cannot be directly instrumented8864(they have no bytecodes), they must be wrapped with8865a non-native method which can be instrumented.8866For example, if we had:8867<example>8868native boolean foo(int x);</example>8869<p/>8870We could transform the class file (with the8871ClassFileLoadHook event) so that this becomes:8872<example>8873boolean foo(int x) {8874<i>... record entry to foo ...</i>8875return wrapped_foo(x);8876}88778878native boolean wrapped_foo(int x);</example>8879<p/>8880Where foo becomes a wrapper for the actual native method8881with the appended prefix "wrapped_". Note that8882"wrapped_" would be a poor choice of prefix since it8883might conceivably form the name of an existing method8884thus something like "$$$MyAgentWrapped$$$_" would be8885better but would make these examples less readable.8886<p/>8887The wrapper will allow data to be collected on the native8888method call, but now the problem becomes linking up the8889wrapped method with the native implementation.8890That is, the method <code>wrapped_foo</code> needs to be8891resolved to the native implementation of <code>foo</code>,8892which might be:8893<example>8894Java_somePackage_someClass_foo(JNIEnv* env, jint x)</example>8895<p/>8896This function allows the prefix to be specified and the8897proper resolution to occur.8898Specifically, when the standard resolution fails, the8899resolution is retried taking the prefix into consideration.8900There are two ways that resolution occurs, explicit8901resolution with the JNI function <code>RegisterNatives</code>8902and the normal automatic resolution. For8903<code>RegisterNatives</code>, the VM will attempt this8904association:8905<example>8906method(foo) -> nativeImplementation(foo)</example>8907<p/>8908When this fails, the resolution will be retried with8909the specified prefix prepended to the method name,8910yielding the correct resolution:8911<example>8912method(wrapped_foo) -> nativeImplementation(foo)</example>8913<p/>8914For automatic resolution, the VM will attempt:8915<example>8916method(wrapped_foo) -> nativeImplementation(wrapped_foo)</example>8917<p/>8918When this fails, the resolution will be retried with8919the specified prefix deleted from the implementation name,8920yielding the correct resolution:8921<example>8922method(wrapped_foo) -> nativeImplementation(foo)</example>8923<p/>8924Note that since the prefix is only used when standard8925resolution fails, native methods can be wrapped selectively.8926<p/>8927Since each <jvmti/> environment is independent and8928can do its own transformation of the bytecodes, more8929than one layer of wrappers may be applied. Thus each8930environment needs its own prefix. Since transformations8931are applied in order, the prefixes, if applied, will8932be applied in the same order.8933The order of transformation application is described in8934the <eventlink id="ClassFileLoadHook"/> event.8935Thus if three environments applied8936wrappers, <code>foo</code> might become8937<code>$env3_$env2_$env1_foo</code>. But if, say,8938the second environment did not apply a wrapper to8939<code>foo</code> it would be just8940<code>$env3_$env1_foo</code>. To be able to8941efficiently determine the sequence of prefixes,8942an intermediate prefix is only applied if its non-native8943wrapper exists. Thus, in the last example, even though8944<code>$env1_foo</code> is not a native method, the8945<code>$env1_</code> prefix is applied since8946<code>$env1_foo</code> exists.8947<p/>8948Since the prefixes are used at resolution time8949and since resolution may be arbitrarily delayed, a8950native method prefix must remain set as long as there8951are corresponding prefixed native methods.8952</description>8953<origin>new</origin>8954<capabilities>8955<required id="can_set_native_method_prefix"></required>8956</capabilities>8957<parameters>8958<param id="prefix">8959<inbuf>8960<char/>8961<nullok>8962any existing prefix in this environment is cancelled8963</nullok>8964</inbuf>8965<description>8966The prefix to apply, encoded as a8967<internallink id="mUTF">modified UTF-8</internallink> string.8968</description>8969</param>8970</parameters>8971<errors>8972</errors>8973</function>89748975<function id="SetNativeMethodPrefixes" jkernel="yes" phase="any" num="74" since="1.1">8976<synopsis>Set Native Method Prefixes</synopsis>8977<description>8978For a normal agent, <functionlink id="SetNativeMethodPrefix"/>8979will provide all needed native method prefixing.8980For a meta-agent that performs multiple independent class8981file transformations (for example as a proxy for another8982layer of agents) this function allows each transformation8983to have its own prefix.8984The prefixes are applied in the order supplied and are8985processed in the same manner as described for the8986application of prefixes from multiple <jvmti/> environments8987in <functionlink id="SetNativeMethodPrefix"/>.8988<p/>8989Any previous prefixes are replaced. Thus, calling this8990function with a <paramlink id="prefix_count"/> of <code>0</code>8991disables prefixing in this environment.8992<p/>8993<functionlink id="SetNativeMethodPrefix"/> and this function8994are the two ways to set the prefixes.8995Calling <code>SetNativeMethodPrefix</code> with8996a prefix is the same as calling this function with8997<paramlink id="prefix_count"/> of <code>1</code>.8998Calling <code>SetNativeMethodPrefix</code> with8999<code>NULL</code> is the same as calling this function with9000<paramlink id="prefix_count"/> of <code>0</code>.9001</description>9002<origin>new</origin>9003<capabilities>9004<required id="can_set_native_method_prefix"></required>9005</capabilities>9006<parameters>9007<param id="prefix_count">9008<jint min="0"/>9009<description>9010The number of prefixes to apply.9011</description>9012</param>9013<param id="prefixes">9014<agentbuf>9015<char/>9016</agentbuf>9017<description>9018The prefixes to apply for this environment, each encoded as a9019<internallink id="mUTF">modified UTF-8</internallink> string.9020</description>9021</param>9022</parameters>9023<errors>9024</errors>9025</function>90269027</category>90289029<category id="RawMonitors" label="Raw Monitor">90309031<function id="CreateRawMonitor" phase="onload" callbacksafe="safe" num="31">9032<synopsis>Create Raw Monitor</synopsis>9033<description>9034Create a raw monitor.9035</description>9036<origin>jvmdi</origin>9037<capabilities>9038</capabilities>9039<parameters>9040<param id="name">9041<inbuf><char/></inbuf>9042<description>9043A name to identify the monitor, encoded as a9044<internallink id="mUTF">modified UTF-8</internallink> string.9045</description>9046</param>9047<param id="monitor_ptr">9048<outptr><jrawMonitorID/></outptr>9049<description>9050On return, points to the created monitor.9051</description>9052</param>9053</parameters>9054<errors>9055</errors>9056</function>90579058<function id="DestroyRawMonitor" phase="onload" callbacksafe="safe" num="32">9059<synopsis>Destroy Raw Monitor</synopsis>9060<description>9061Destroy the raw monitor.9062If the monitor being destroyed has been entered by this thread, it will be9063exited before it is destroyed.9064If the monitor being destroyed has been entered by another thread,9065an error will be returned and the monitor will not be destroyed.9066</description>9067<origin>jvmdi</origin>9068<capabilities>9069</capabilities>9070<parameters>9071<param id="monitor">9072<jrawMonitorID/>9073<description>9074The monitor9075</description>9076</param>9077</parameters>9078<errors>9079<error id="JVMTI_ERROR_NOT_MONITOR_OWNER">9080Not monitor owner9081</error>9082</errors>9083</function>90849085<function id="RawMonitorEnter" phase="any" callbacksafe="safe" impl="innative notrace" num="33">9086<synopsis>Raw Monitor Enter</synopsis>9087<description>9088Gain exclusive ownership of a raw monitor.9089The same thread may enter a monitor more then once.9090The thread must9091<functionlink id="RawMonitorExit">exit</functionlink>9092the monitor the same number of times as it is entered.9093If a monitor is entered during <code>OnLoad</code> (before attached threads exist)9094and has not exited when attached threads come into existence, the enter9095is considered to have occurred on the main thread.9096</description>9097<origin>jvmdi</origin>9098<capabilities>9099</capabilities>9100<parameters>9101<param id="monitor">9102<jrawMonitorID/>9103<description>9104The monitor9105</description>9106</param>9107</parameters>9108<errors>9109</errors>9110</function>91119112<function id="RawMonitorExit" phase="any" callbacksafe="safe" impl="innative notrace" num="34">9113<synopsis>Raw Monitor Exit</synopsis>9114<description>9115Release exclusive ownership of a raw monitor.9116</description>9117<origin>jvmdi</origin>9118<capabilities>9119</capabilities>9120<parameters>9121<param id="monitor">9122<jrawMonitorID/>9123<description>9124The monitor9125</description>9126</param>9127</parameters>9128<errors>9129<error id="JVMTI_ERROR_NOT_MONITOR_OWNER">9130Not monitor owner9131</error>9132</errors>9133</function>91349135<function id="RawMonitorWait" phase="any" callbacksafe="safe" impl="innative notrace" num="35">9136<synopsis>Raw Monitor Wait</synopsis>9137<description>9138Wait for notification of the raw monitor.9139<p/>9140Causes the current thread to wait until either another thread calls9141<functionlink id="RawMonitorNotify"/> or9142<functionlink id="RawMonitorNotifyAll"/>9143for the specified raw monitor, or the specified9144<paramlink id="millis">timeout</paramlink>9145has elapsed.9146</description>9147<origin>jvmdi</origin>9148<capabilities>9149</capabilities>9150<parameters>9151<param id="monitor">9152<jrawMonitorID/>9153<description>9154The monitor9155</description>9156</param>9157<param id="millis">9158<jlong/>9159<description>9160The timeout, in milliseconds. If the timeout is9161zero, then real time is not taken into consideration9162and the thread simply waits until notified.9163</description>9164</param>9165</parameters>9166<errors>9167<error id="JVMTI_ERROR_NOT_MONITOR_OWNER">9168Not monitor owner9169</error>9170<error id="JVMTI_ERROR_INTERRUPT">9171Wait was interrupted, try again9172</error>9173</errors>9174</function>91759176<function id="RawMonitorNotify" phase="any" callbacksafe="safe" impl="notrace" num="36">9177<synopsis>Raw Monitor Notify</synopsis>9178<description>9179Notify a single thread waiting on the raw monitor.9180</description>9181<origin>jvmdi</origin>9182<capabilities>9183</capabilities>9184<parameters>9185<param id="monitor">9186<jrawMonitorID/>9187<description>9188The monitor9189</description>9190</param>9191</parameters>9192<errors>9193<error id="JVMTI_ERROR_NOT_MONITOR_OWNER">9194Not monitor owner9195</error>9196</errors>9197</function>91989199<function id="RawMonitorNotifyAll" phase="any" callbacksafe="safe" impl="notrace" num="37">9200<synopsis>Raw Monitor Notify All</synopsis>9201<description>9202Notify all threads waiting on the raw monitor.9203</description>9204<origin>jvmdi</origin>9205<capabilities>9206</capabilities>9207<parameters>9208<param id="monitor">9209<jrawMonitorID/>9210<description>9211The monitor9212</description>9213</param>9214</parameters>9215<errors>9216<error id="JVMTI_ERROR_NOT_MONITOR_OWNER">9217Not monitor owner9218</error>9219</errors>9220</function>92219222<elide>9223<function id="GetRawMonitorUse" num="118">9224<synopsis>Get Raw Monitor Use</synopsis>9225<description>9226The fields of the <functionlink id="jvmtiMonitorUsage"></functionlink> structure9227are filled in with information about usage of the raw monitor.9228</description>9229<origin>new</origin>9230<capabilities>9231<required id="can_get_raw_monitor_usage"></required>9232</capabilities>9233<parameters>9234<param id="monitor">9235<jrawMonitorID/>9236<description>9237the raw monitor to query.9238</description>9239</param>9240<param id="info_ptr">9241<outptr><struct>jvmtiMonitorUsage</struct></outptr>9242<description>9243On return, filled with monitor information for the9244specified raw monitor.9245</description>9246</param>9247</parameters>9248<errors>9249</errors>9250</function>92519252<function id="GetRawMonitors" num="119">9253<synopsis>Get Raw Monitors</synopsis>9254<description>9255Return the list of raw monitors.9256<p/>9257Note: details about each monitor can be examined with9258<functionlink id="GetRawMonitorUse"></functionlink>.9259</description>9260<origin>new</origin>9261<capabilities>9262<required id="can_get_raw_monitor_usage"></required>9263</capabilities>9264<parameters>9265<param id="monitorCnt">9266<outptr><jint/></outptr>9267<description>9268On return, pointer to the number9269of monitors returned in <code>monitors_ptr</code>.9270</description>9271</param>9272<param id="monitors_ptr">9273<allocbuf outcount="monitorCnt"><jrawMonitorID/></allocbuf>9274<description>9275On return, pointer to the monitor list.9276</description>9277</param>9278</parameters>9279<errors>9280</errors>9281</function>9282</elide>9283</category>92849285<category id="jniIntercept" label="JNI Function Interception">92869287<intro>9288Provides the ability to intercept and resend9289Java Native Interface (JNI) function calls9290by manipulating the JNI function table.9291See <externallink id="jni/functions.html">JNI9292Functions</externallink> in the <i>Java Native Interface Specification</i>.9293<p/>9294The following example illustrates intercepting the9295<code>NewGlobalRef</code> JNI call in order to count reference9296creation.9297<example>9298JNIEnv original_jni_Functions;9299JNIEnv redirected_jni_Functions;9300int my_global_ref_count = 0;93019302jobject9303MyNewGlobalRef(JNIEnv *jni_env, jobject lobj) {9304++my_global_ref_count;9305return originalJNIFunctions->NewGlobalRef(env, lobj);9306}93079308void9309myInit() {9310jvmtiError err;93119312err = (*jvmti_env)->GetJNIFunctionTable(jvmti_env, &original_jni_Functions);9313if (err != JVMTI_ERROR_NONE) {9314die();9315}9316err = (*jvmti_env)->GetJNIFunctionTable(jvmti_env, &redirected_jni_Functions);9317if (err != JVMTI_ERROR_NONE) {9318die();9319}9320redirectedJNIFunctions->NewGlobalRef = MyNewGlobalRef;9321err = (*jvmti_env)->SetJNIFunctionTable(jvmti_env, redirected_jni_Functions);9322if (err != JVMTI_ERROR_NONE) {9323die();9324}9325}9326</example>9327Sometime after <code>myInit</code> is called the user's JNI9328code is executed which makes the call to create a new global9329reference. Instead of going to the normal JNI implementation9330the call goes to <code>myNewGlobalRef</code>. Note that a9331copy of the original function table is kept so that the normal9332JNI function can be called after the data is collected.9333Note also that any JNI functions which are not overwritten9334will behave normally.9335<todo>9336check that the example compiles and executes.9337</todo>9338</intro>93399340<function id="SetJNIFunctionTable" phase="start" num="120">9341<synopsis>Set JNI Function Table</synopsis>9342<description>9343Set the JNI function table9344in all current and future JNI environments.9345As a result, all future JNI calls are directed to the specified functions.9346Use <functionlink id="GetJNIFunctionTable"></functionlink> to get the9347function table to pass to this function.9348For this function to take effect the the updated table entries must be9349used by the JNI clients.9350Since the table is defined <code>const</code> some compilers may optimize9351away the access to the table, thus preventing this function from taking9352effect.9353The table is copied--changes to the local copy of the9354table have no effect.9355This function affects only the function table, all other aspects of the environment are9356unaffected.9357See the examples <internallink id="jniIntercept">above</internallink>.9358</description>9359<origin>new</origin>9360<capabilities>9361</capabilities>9362<parameters>9363<param id="function_table">9364<inptr>9365<struct>jniNativeInterface</struct>9366</inptr>9367<description>9368Points to the new JNI function table.9369</description>9370</param>9371</parameters>9372<errors>9373</errors>9374</function>93759376<function id="GetJNIFunctionTable" phase="start" num="121">9377<synopsis>Get JNI Function Table</synopsis>9378<description>9379Get the JNI function table.9380The JNI function table is copied into allocated memory.9381If <functionlink id="SetJNIFunctionTable"></functionlink>9382has been called, the modified (not the original) function9383table is returned.9384Only the function table is copied, no other aspects of the environment9385are copied.9386See the examples <internallink id="jniIntercept">above</internallink>.9387</description>9388<origin>new</origin>9389<capabilities>9390</capabilities>9391<parameters>9392<param id="function_table">9393<allocbuf>9394<struct>jniNativeInterface</struct>9395</allocbuf>9396<description>9397On return, <code>*function_table</code>9398points a newly allocated copy of the JNI function table.9399</description>9400</param>9401</parameters>9402<errors>9403</errors>9404</function>94059406</category>94079408<category id="eventManagement" label="Event Management">94099410<function id="SetEventCallbacks" jkernel="yes" phase="onload" num="122">9411<synopsis>Set Event Callbacks</synopsis>9412<description>9413Set the functions to be called for each event.9414The callbacks are specified by supplying a replacement function table.9415The function table is copied--changes to the local copy of the9416table have no effect.9417This is an atomic action, all callbacks are set at once.9418No events are sent before this function is called.9419When an entry is <code>NULL</code> or when the event is beyond9420<paramlink id="size_of_callbacks"></paramlink> no event is sent.9421Details on events are9422described <internallink id="EventSection">later</internallink> in this document.9423An event must be enabled and have a callback in order to be9424sent--the order in which this function and9425<functionlink id="SetEventNotificationMode"></functionlink>9426are called does not affect the result.9427</description>9428<origin>new</origin>9429<capabilities>9430</capabilities>9431<parameters>9432<param id="callbacks">9433<inptr>9434<struct>jvmtiEventCallbacks</struct>9435<nullok>remove the existing callbacks</nullok>9436</inptr>9437<description>9438The new event callbacks.9439</description>9440</param>9441<param id="size_of_callbacks">9442<jint min="0"/>9443<description>9444<code>sizeof(jvmtiEventCallbacks)</code>--for version9445compatibility.9446</description>9447</param>9448</parameters>9449<errors>9450</errors>9451</function>94529453<function id="SetEventNotificationMode" jkernel="yes" phase="onload" num="2">9454<synopsis>Set Event Notification Mode</synopsis>9455<description>9456Control the generation of events.9457<constants id="jvmtiEventMode" label="Event Enable/Disable" kind="enum">9458<constant id="JVMTI_ENABLE" num="1">9459If <paramlink id="mode"></paramlink> is <code>JVMTI_ENABLE</code>,9460the event <paramlink id="event_type"></paramlink> will be enabled9461</constant>9462<constant id="JVMTI_DISABLE" num="0">9463If <paramlink id="mode"></paramlink> is <code>JVMTI_DISABLE</code>,9464the event <paramlink id="event_type"></paramlink> will be disabled9465</constant>9466</constants>9467If <code>event_thread</code> is <code>NULL</code>,9468the event is enabled or disabled globally; otherwise, it is9469enabled or disabled for a particular thread.9470An event is generated for9471a particular thread if it is enabled either at the thread or global9472levels.9473<p/>9474See <internallink id="EventIndex">below</internallink> for information on specific events.9475<p/>9476The following events cannot be controlled at the thread9477level through this function.9478<ul>9479<li><eventlink id="VMInit"></eventlink></li>9480<li><eventlink id="VMStart"></eventlink></li>9481<li><eventlink id="VMDeath"></eventlink></li>9482<li><eventlink id="ThreadStart"></eventlink></li>9483<li><eventlink id="CompiledMethodLoad"></eventlink></li>9484<li><eventlink id="CompiledMethodUnload"></eventlink></li>9485<li><eventlink id="DynamicCodeGenerated"></eventlink></li>9486<li><eventlink id="DataDumpRequest"></eventlink></li>9487</ul>9488<p/>9489Initially, no events are enabled at either the thread level9490or the global level.9491<p/>9492Any needed capabilities (see Event Enabling Capabilities below) must be possessed9493before calling this function.9494<p/>9495Details on events are9496described <internallink id="EventSection">below</internallink>.9497</description>9498<origin>jvmdiClone</origin>9499<eventcapabilities></eventcapabilities>9500<parameters>9501<param id="mode">9502<enum>jvmtiEventMode</enum>9503<description>9504<code>JVMTI_ENABLE</code> or <code>JVMTI_DISABLE</code>9505</description>9506</param>9507<param id="event_type">9508<enum>jvmtiEvent</enum>9509<description>9510the event to control9511</description>9512</param>9513<param id="event_thread">9514<ptrtype>9515<jthread impl="noconvert"/>9516<nullok>event is controlled at the global level</nullok>9517</ptrtype>9518<description>9519The thread to control9520</description>9521</param>9522<param id="...">9523<varargs/>9524<description>9525for future expansion9526</description>9527</param>9528</parameters>9529<errors>9530<error id="JVMTI_ERROR_INVALID_THREAD">9531<paramlink id="event_thread"/> is non-<code>NULL</code> and is not a valid thread.9532</error>9533<error id="JVMTI_ERROR_THREAD_NOT_ALIVE">9534<paramlink id="event_thread"/> is non-<code>NULL</code> and is not live (has not been started or is now dead).9535</error>9536<error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">9537thread level control was attempted on events which do not9538permit thread level control.9539</error>9540<error id="JVMTI_ERROR_MUST_POSSESS_CAPABILITY">9541The Required Event Enabling Capability is not possessed.9542</error>9543</errors>9544</function>95459546<function id="GenerateEvents" num="123">9547<synopsis>Generate Events</synopsis>9548<description>9549Generate events to represent the current state of the VM.9550For example, if <paramlink id="event_type"/> is9551<code>JVMTI_EVENT_COMPILED_METHOD_LOAD</code>,9552a <eventlink id="CompiledMethodLoad"></eventlink> event will be9553sent for each currently compiled method.9554Methods that were loaded and now have been unloaded are not sent.9555The history of what events have previously been sent does not9556effect what events are sent by this function--for example,9557all currently compiled methods9558will be sent each time this function is called.9559<p/>9560This function is useful when9561events may have been missed due to the agent attaching after program9562execution begins; this function generates the missed events.9563<p/>9564Attempts to execute Java programming language code or9565JNI functions may be paused until this function returns -9566so neither should be called from the thread sending the event.9567This function returns only after the missed events have been9568sent, processed and have returned.9569The event may be sent on a different thread than the thread9570on which the event occurred.9571The callback for the event must be set with9572<functionlink id="SetEventCallbacks"></functionlink>9573and the event must be enabled with9574<functionlink id="SetEventNotificationMode"></functionlink>9575or the events will not occur.9576If the VM no longer has the information to generate some or9577all of the requested events, the events are simply not sent -9578no error is returned.9579<p/>9580Only the following events are supported:9581<ul>9582<li><eventlink id="CompiledMethodLoad"></eventlink></li>9583<li><eventlink id="DynamicCodeGenerated"></eventlink></li>9584</ul>9585</description>9586<origin>new</origin>9587<capabilities>9588<capability id="can_generate_compiled_method_load_events"></capability>9589</capabilities>9590<parameters>9591<param id="event_type">9592<enum>jvmtiEvent</enum>9593<description>9594The type of event to generate. Must be one of these:9595<ul>9596<li><eventlink id="CompiledMethodLoad"><code>JVMTI_EVENT_COMPILED_METHOD_LOAD</code></eventlink></li>9597<li><eventlink id="DynamicCodeGenerated"><code>JVMTI_EVENT_DYNAMIC_CODE_GENERATED</code></eventlink></li>9598</ul>9599</description>9600</param>9601</parameters>9602<errors>9603<error id="JVMTI_ERROR_MUST_POSSESS_CAPABILITY">9604<paramlink id="event_type"/> is9605<eventlink id="CompiledMethodLoad"><code>JVMTI_EVENT_COMPILED_METHOD_LOAD</code></eventlink>9606and <fieldlink id="can_generate_compiled_method_load_events" struct="jvmtiCapabilities"></fieldlink>9607is <code>false</code>.9608</error>9609<error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">9610<paramlink id="event_type"/> is other than9611<eventlink id="CompiledMethodLoad"><code>JVMTI_EVENT_COMPILED_METHOD_LOAD</code></eventlink>9612or <eventlink id="DynamicCodeGenerated"><code>JVMTI_EVENT_DYNAMIC_CODE_GENERATED</code></eventlink>.9613</error>9614</errors>9615</function>96169617</category>96189619<category id="extension" label="Extension Mechanism">96209621<intro>9622These functions9623allow a <jvmti/> implementation to provide functions and events9624beyond those defined in this specification.9625<p/>9626Both extension functions and extension events have parameters9627each of which has a 'type' and 'kind' chosen from the following tables:96289629<constants id="jvmtiParamTypes" label="Extension Function/Event Parameter Types" kind="enum">9630<constant id="JVMTI_TYPE_JBYTE" num="101">9631Java programming language primitive type - <code>byte</code>.9632JNI type <code>jbyte</code>.9633</constant>9634<constant id="JVMTI_TYPE_JCHAR" num="102">9635Java programming language primitive type - <code>char</code>.9636JNI type <code>jchar</code>.9637</constant>9638<constant id="JVMTI_TYPE_JSHORT" num="103">9639Java programming language primitive type - <code>short</code>.9640JNI type <code>jshort</code>.9641</constant>9642<constant id="JVMTI_TYPE_JINT" num="104">9643Java programming language primitive type - <code>int</code>.9644JNI type <datalink id="jint"></datalink>.9645</constant>9646<constant id="JVMTI_TYPE_JLONG" num="105">9647Java programming language primitive type - <code>long</code>.9648JNI type <datalink id="jlong"></datalink>.9649</constant>9650<constant id="JVMTI_TYPE_JFLOAT" num="106">9651Java programming language primitive type - <code>float</code>.9652JNI type <datalink id="jfloat"></datalink>.9653</constant>9654<constant id="JVMTI_TYPE_JDOUBLE" num="107">9655Java programming language primitive type - <code>double</code>.9656JNI type <datalink id="jdouble"></datalink>.9657</constant>9658<constant id="JVMTI_TYPE_JBOOLEAN" num="108">9659Java programming language primitive type - <code>boolean</code>.9660JNI type <datalink id="jboolean"></datalink>.9661</constant>9662<constant id="JVMTI_TYPE_JOBJECT" num="109">9663Java programming language object type - <code>java.lang.Object</code>.9664JNI type <datalink id="jobject"></datalink>.9665Returned values are JNI local references and must be managed.9666</constant>9667<constant id="JVMTI_TYPE_JTHREAD" num="110">9668Java programming language object type - <code>java.lang.Thread</code>.9669<jvmti/> type <datalink id="jthread"></datalink>.9670Returned values are JNI local references and must be managed.9671</constant>9672<constant id="JVMTI_TYPE_JCLASS" num="111">9673Java programming language object type - <code>java.lang.Class</code>.9674JNI type <datalink id="jclass"></datalink>.9675Returned values are JNI local references and must be managed.9676</constant>9677<constant id="JVMTI_TYPE_JVALUE" num="112">9678Union of all Java programming language primitive and object types -9679JNI type <datalink id="jvalue"></datalink>.9680Returned values which represent object types are JNI local references and must be managed.9681</constant>9682<constant id="JVMTI_TYPE_JFIELDID" num="113">9683Java programming language field identifier -9684JNI type <datalink id="jfieldID"></datalink>.9685</constant>9686<constant id="JVMTI_TYPE_JMETHODID" num="114">9687Java programming language method identifier -9688JNI type <datalink id="jmethodID"></datalink>.9689</constant>9690<constant id="JVMTI_TYPE_CCHAR" num="115">9691C programming language type - <code>char</code>.9692</constant>9693<constant id="JVMTI_TYPE_CVOID" num="116">9694C programming language type - <code>void</code>.9695</constant>9696<constant id="JVMTI_TYPE_JNIENV" num="117">9697JNI environment - <code>JNIEnv</code>.9698Should be used with the correct <datalink id="jvmtiParamKind"/> to make it a pointer type.9699</constant>9700</constants>97019702<constants id="jvmtiParamKind" label="Extension Function/Event Parameter Kinds" kind="enum">9703<constant id="JVMTI_KIND_IN" num="91">9704Ingoing argument - <code>foo</code>.9705</constant>9706<constant id="JVMTI_KIND_IN_PTR" num="92">9707Ingoing pointer argument - <code>const foo*</code>.9708</constant>9709<constant id="JVMTI_KIND_IN_BUF" num="93">9710Ingoing array argument - <code>const foo*</code>.9711</constant>9712<constant id="JVMTI_KIND_ALLOC_BUF" num="94">9713Outgoing allocated array argument - <code>foo**</code>.9714Free with <code>Deallocate</code>.9715</constant>9716<constant id="JVMTI_KIND_ALLOC_ALLOC_BUF" num="95">9717Outgoing allocated array of allocated arrays argument - <code>foo***</code>.9718Free with <code>Deallocate</code>.9719</constant>9720<constant id="JVMTI_KIND_OUT" num="96">9721Outgoing argument - <code>foo*</code>.9722</constant>9723<constant id="JVMTI_KIND_OUT_BUF" num="97">9724Outgoing array argument (pre-allocated by agent) - <code>foo*</code>.9725Do not <code>Deallocate</code>.9726</constant>9727</constants>97289729</intro>97309731<typedef id="jvmtiParamInfo" label="Extension Function/Event Parameter Info">9732<field id="name">9733<allocfieldbuf><char/></allocfieldbuf>9734<description>9735The parameter name, encoded as a9736<internallink id="mUTF">modified UTF-8</internallink> string9737</description>9738</field>9739<field id="kind">9740<enum>jvmtiParamKind</enum>9741<description>9742The kind of the parameter - type modifiers9743</description>9744</field>9745<field id="base_type">9746<enum>jvmtiParamTypes</enum>9747<description>9748The base type of the parameter - modified by <code>kind</code>9749</description>9750</field>9751<field id="null_ok">9752<jboolean/>9753<description>9754Is a <code>NULL</code> argument permitted? Applies only to pointer and object types.9755</description>9756</field>9757</typedef>97589759<callback id="jvmtiExtensionFunction">9760<enum>jvmtiError</enum>9761<synopsis>Extension Function</synopsis>9762<description>9763This is the implementation-specific extension function.9764</description>9765<parameters>9766<param id="jvmti_env">9767<outptr>9768<struct>jvmtiEnv</struct>9769</outptr>9770<description>9771The <jvmti/> environment is the only fixed parameter for extension functions.9772</description>9773</param>9774<param id="...">9775<varargs/>9776<description>9777The extension function-specific parameters9778</description>9779</param>9780</parameters>9781</callback>97829783<function id="GetExtensionFunctions" phase="onload" num="124">9784<synopsis>Get Extension Functions</synopsis>97859786<typedef id="jvmtiExtensionFunctionInfo" label="Extension Function Info">9787<field id="func">9788<ptrtype>9789<struct>jvmtiExtensionFunction</struct>9790</ptrtype>9791<description>9792The actual function to call9793</description>9794</field>9795<field id="id">9796<allocfieldbuf><char/></allocfieldbuf>9797<description>9798The identifier for the extension function, encoded as a9799<internallink id="mUTF">modified UTF-8</internallink> string.9800Uses package name conventions.9801For example, <code>com.sun.hotspot.bar</code>9802</description>9803</field>9804<field id="short_description">9805<allocfieldbuf><char/></allocfieldbuf>9806<description>9807A one sentence description of the function, encoded as a9808<internallink id="mUTF">modified UTF-8</internallink> string.9809</description>9810</field>9811<field id="param_count">9812<jint/>9813<description>9814The number of parameters excluding <code>jvmtiEnv *jvmti_env</code>9815</description>9816</field>9817<field id="params">9818<allocfieldbuf outcount="param_count">9819<struct>jvmtiParamInfo</struct>9820</allocfieldbuf>9821<description>9822Array of9823<fieldlink id="param_count" struct="jvmtiExtensionFunctionInfo"></fieldlink>9824parameters (<code>jvmtiEnv *jvmti_env</code> excluded)9825</description>9826</field>9827<field id="error_count">9828<jint/>9829<description>9830The number of possible error returns (excluding universal errors)9831</description>9832</field>9833<field id="errors">9834<allocfieldbuf outcount="error_count">9835<enum>jvmtiError</enum>9836</allocfieldbuf>9837<description>9838Array of <fieldlink id="error_count" struct="jvmtiExtensionFunctionInfo"></fieldlink>9839possible errors9840</description>9841</field>9842</typedef>98439844<description>9845Returns the set of extension functions.9846</description>9847<origin>new</origin>9848<capabilities>9849</capabilities>9850<parameters>9851<param id="extension_count_ptr">9852<outptr><jint/></outptr>9853<description>9854On return, points to the number of extension functions9855</description>9856</param>9857<param id="extensions">9858<allocbuf outcount="extension_count_ptr"><struct>jvmtiExtensionFunctionInfo</struct></allocbuf>9859<description>9860Returns an array of extension function info, one per function9861</description>9862</param>9863</parameters>9864<errors>9865</errors>9866</function>98679868<function id="GetExtensionEvents" phase="onload" num="125">9869<synopsis>Get Extension Events</synopsis>98709871<typedef id="jvmtiExtensionEventInfo" label="Extension Event Info">9872<field id="extension_event_index">9873<jint/>9874<description>9875The identifying index of the event9876</description>9877</field>9878<field id="id">9879<allocfieldbuf><char/></allocfieldbuf>9880<description>9881The identifier for the extension event, encoded as a9882<internallink id="mUTF">modified UTF-8</internallink> string.9883Uses package name conventions.9884For example, <code>com.sun.hotspot.bar</code>9885</description>9886</field>9887<field id="short_description">9888<allocfieldbuf><char/></allocfieldbuf>9889<description>9890A one sentence description of the event, encoded as a9891<internallink id="mUTF">modified UTF-8</internallink> string.9892</description>9893</field>9894<field id="param_count">9895<jint/>9896<description>9897The number of parameters excluding <code>jvmtiEnv *jvmti_env</code>9898</description>9899</field>9900<field id="params">9901<allocfieldbuf outcount="param_count">9902<struct>jvmtiParamInfo</struct>9903</allocfieldbuf>9904<description>9905Array of9906<fieldlink id="param_count" struct="jvmtiExtensionEventInfo"></fieldlink>9907parameters (<code>jvmtiEnv *jvmti_env</code> excluded)9908</description>9909</field>9910</typedef>99119912<description>9913Returns the set of extension events.9914</description>9915<origin>new</origin>9916<capabilities>9917</capabilities>9918<parameters>9919<param id="extension_count_ptr">9920<outptr><jint/></outptr>9921<description>9922On return, points to the number of extension events9923</description>9924</param>9925<param id="extensions">9926<allocbuf outcount="extension_count_ptr"><struct>jvmtiExtensionEventInfo</struct></allocbuf>9927<description>9928Returns an array of extension event info, one per event9929</description>9930</param>9931</parameters>9932<errors>9933</errors>9934</function>99359936<callback id="jvmtiExtensionEvent">9937<void/>9938<synopsis>Extension Event</synopsis>9939<description>9940This is the implementation-specific event.9941The event handler is set with9942<functionlink id="SetExtensionEventCallback"/>.9943<p/>9944Event handlers for extension events must be declared varargs to match this definition.9945Failure to do so could result in calling convention mismatch and undefined behavior9946on some platforms.9947<p/>9948For example, if the <code>jvmtiParamInfo</code>9949returned by <functionlink id="GetExtensionEvents"/> indicates that9950there is a <code>jint</code> parameter, the event handler should be9951declared:9952<example>9953void JNICALL myHandler(jvmtiEnv* jvmti_env, ...)9954</example>9955Note the terminal "<code>...</code>" which indicates varargs.9956The <code>jint</code> argument inside <code>myHandler</code> needs to be extracted using9957the <code>va_*</code> syntax of the C programming language.9958</description>9959<parameters>9960<param id="jvmti_env">9961<outptr>9962<struct>jvmtiEnv</struct>9963</outptr>9964<description>9965The <jvmti/> environment is the only fixed parameter for extension events.9966</description>9967</param>9968<param id="...">9969<varargs/>9970<description>9971The extension event-specific parameters9972</description>9973</param>9974</parameters>9975</callback>99769977<function id="SetExtensionEventCallback" phase="onload" num="126">9978<synopsis>Set Extension Event Callback</synopsis>99799980<description>9981Sets the callback function for an extension event and9982enables the event. Or, if the callback is <code>NULL</code>, disables9983the event. Note that unlike standard events, setting9984the callback and enabling the event are a single operation.9985</description>9986<origin>new</origin>9987<capabilities>9988</capabilities>9989<parameters>9990<param id="extension_event_index">9991<jint/>9992<description>9993Identifies which callback to set.9994This index is the9995<fieldlink id="extension_event_index" struct="jvmtiExtensionEventInfo"></fieldlink>9996field of9997<datalink id="jvmtiExtensionEventInfo"/>.9998</description>9999</param>10000<param id="callback">10001<ptrtype>10002<struct>jvmtiExtensionEvent</struct>10003<nullok>disable the event</nullok>10004</ptrtype>10005<description>10006If <code>callback</code> is non-<code>NULL</code>,10007set <code>callback</code> to be the event callback function10008and enable the event.10009</description>10010</param>10011</parameters>10012<errors>10013<error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">10014<paramlink id="extension_event_index"/> is not an10015<fieldlink id="extension_event_index"10016struct="jvmtiExtensionEventInfo"/>10017returned by10018<functionlink id="GetExtensionEvents"/>10019</error>10020</errors>10021</function>1002210023</category>1002410025<category id="capability" label="Capability">1002610027<intro>10028The capabilities functions allow you to change the10029functionality available to <jvmti/>--that is,10030which <jvmti/>10031functions can be called, what events can be generated,10032and what functionality these events and functions can10033provide.10034<p/>10035The "Capabilities" section of each function and event describe which10036capabilities, if any, they are associated with. "Required Functionality"10037means it is available for use and no capabilities must be added to use it.10038"Optional Functionality" means the agent must possess the capability10039before it can be used.10040To possess a capability, the agent must10041<functionlink id="AddCapabilities">add the capability</functionlink>.10042"Optional Features" describe capabilities which,10043if added, extend the feature set.10044<p/>10045The potentially available capabilities of each <jvmti/> implementation are different.10046Depending on the implementation, a capability:10047<ul>10048<li>may never be added</li>10049<li>may be added in either the <code>OnLoad</code> or live phase in any environment</li>10050<li>may be added only during the <code>OnLoad</code> phase</li>10051<li>may be possessed by only one environment at a time</li>10052<li>may be possessed by only one environment at a time,10053and only during the <code>OnLoad</code> phase</li>10054<li>and so on ...</li>10055</ul>10056Frequently, the addition of a capability may incur a cost in execution speed, start up10057time, and/or memory footprint. Note that the overhead of using a capability10058is completely different than the overhead of possessing a capability.10059Take single stepping as an example. When single stepping is on (that10060is, when the event is enabled and thus actively sending events)10061the overhead of sending and processing an event10062on each instruction is huge in any implementation.10063However, the overhead of possessing the capability may be small or large,10064depending on the implementation. Also, when and if a capability is potentially10065available depends on the implementation. Some examples:10066<ul>10067<li>One VM might perform all execution by compiling bytecodes into10068native code and be unable to generate single step instructions.10069In this implementation the capability can not be added.</li>10070<li>Another VM may be able to switch execution to a single stepping10071interpreter at any time. In this implementation, having the capability has no10072overhead and could be added at any time.</li>10073<li>Yet another VM might be able to choose a bytecode compiling or single stepping capable interpreted10074execution engine at start up, but be unable to switch between them.10075In this implementation the capability would need to be added10076during the <code>OnLoad</code> phase (before bytecode10077execution begins) and would have a large impact on execution speed10078even if single stepping was never used.</li>10079<li>Still another VM might be able to add an "is single stepping on" check10080into compiled bytecodes or a generated interpreter. Again in this implementation10081the capability would need to be added during the <code>OnLoad</code> phase but the overhead (a test10082and branch on each instruction) would be considerably less.</li>10083</ul>10084<p/>10085Each <jvmti/> <internallink id="environments">environment</internallink>10086has its own set of capabilities.10087Initially, that set is empty.10088Any desired capability must be added.10089If possible, capabilities should be added during the <code>OnLoad</code> phase. For most10090virtual machines certain capabilities require special set up for10091the virtual machine and this set up must happen10092during the <code>OnLoad</code> phase, before the virtual machine begins execution.10093Once a capability is added, it can10094only be removed if explicitly relinquished by the environment.10095<p/>10096The agent can,10097<functionlink id="GetPotentialCapabilities">determine what10098capabilities this VM can potentially provide</functionlink>,10099<functionlink id="AddCapabilities">add the capabilities10100to be used</functionlink>,10101<functionlink id="RelinquishCapabilities">release capabilities10102which are no longer needed</functionlink>, and10103<functionlink id="GetCapabilities">examine the currently available10104capabilities</functionlink>.10105</intro>1010610107<intro id="capabilityExamples" label="Capability Examples">10108For example, a freshly started agent (in the <code>OnLoad</code> function)10109wants to enable all possible capabilities.10110Note that, in general, this is not advisable as the agent may suffer10111a performance penalty for functionality it is not using.10112The code might look like this in C:10113<example>10114jvmtiCapabilities capa;10115jvmtiError err;1011610117err = (*jvmti)->GetPotentialCapabilities(jvmti, &capa);10118if (err == JVMTI_ERROR_NONE) {10119err = (*jvmti)->AddCapabilities(jvmti, &capa);10120</example>10121For example, if an agent wants to check if it can get10122the bytecodes of a method (that is, it wants to check10123if it previously added this capability and has not10124relinquished it), the code might10125look like this in C:10126<example>10127jvmtiCapabilities capa;10128jvmtiError err;1012910130err = (*jvmti)->GetCapabilities(jvmti, &capa);10131if (err == JVMTI_ERROR_NONE) {10132if (capa.can_get_bytecodes) { ... } }10133</example>10134</intro>1013510136<capabilitiestypedef id="jvmtiCapabilities" label="The Capabilities Structure">10137<description>10138The functions in this category use this capabilities structure10139which contains boolean flags corresponding to each capability:10140</description>10141<capabilityfield id="can_tag_objects">10142<description>10143Can set and get tags, as described in the10144<internallink id="Heap">Heap category</internallink>.10145</description>10146</capabilityfield>10147<capabilityfield id="can_generate_field_modification_events">10148<description>10149Can set watchpoints on field modification -10150<functionlink id="SetFieldModificationWatch"></functionlink>10151</description>10152</capabilityfield>10153<capabilityfield id="can_generate_field_access_events">10154<description>10155Can set watchpoints on field access -10156<functionlink id="SetFieldAccessWatch"></functionlink>10157</description>10158</capabilityfield>10159<capabilityfield id="can_get_bytecodes">10160<description>10161Can get bytecodes of a method <functionlink id="GetBytecodes"></functionlink>10162</description>10163</capabilityfield>10164<capabilityfield id="can_get_synthetic_attribute">10165<description>10166Can test if a field or method is synthetic -10167<functionlink id="IsFieldSynthetic"></functionlink> and10168<functionlink id="IsMethodSynthetic"></functionlink>10169</description>10170</capabilityfield>10171<capabilityfield id="can_get_owned_monitor_info">10172<description>10173Can get information about ownership of monitors -10174<functionlink id="GetOwnedMonitorInfo"></functionlink>10175</description>10176</capabilityfield>10177<capabilityfield id="can_get_current_contended_monitor">10178<description>10179Can <functionlink id="GetCurrentContendedMonitor"></functionlink>10180</description>10181</capabilityfield>10182<capabilityfield id="can_get_monitor_info">10183<description>10184Can <functionlink id="GetObjectMonitorUsage"></functionlink>10185</description>10186</capabilityfield>10187<capabilityfield id="can_pop_frame">10188<description>10189Can pop frames off the stack - <functionlink id="PopFrame"></functionlink>10190</description>10191</capabilityfield>10192<capabilityfield id="can_redefine_classes">10193<description>10194Can redefine classes with <functionlink id="RedefineClasses"/>.10195</description>10196</capabilityfield>10197<capabilityfield id="can_signal_thread">10198<description>10199Can send stop or interrupt to threads10200</description>10201</capabilityfield>10202<capabilityfield id="can_get_source_file_name">10203<description>10204Can get the source file name of a class10205</description>10206</capabilityfield>10207<capabilityfield id="can_get_line_numbers">10208<description>10209Can get the line number table of a method10210</description>10211</capabilityfield>10212<capabilityfield id="can_get_source_debug_extension">10213<description>10214Can get the source debug extension of a class10215</description>10216</capabilityfield>10217<capabilityfield id="can_access_local_variables">10218<description>10219Can set and get local variables10220</description>10221</capabilityfield>10222<capabilityfield id="can_maintain_original_method_order">10223<description>10224Can return methods in the order they occur in the class file10225</description>10226</capabilityfield>10227<capabilityfield id="can_generate_single_step_events">10228<description>10229Can get <eventlink id="SingleStep">single step</eventlink> events10230</description>10231</capabilityfield>10232<capabilityfield id="can_generate_exception_events">10233<description>10234Can get <eventlink id="Exception">exception thrown</eventlink> and10235<eventlink id="ExceptionCatch">exception catch</eventlink> events10236</description>10237</capabilityfield>10238<capabilityfield id="can_generate_frame_pop_events">10239<description>10240Can <functionlink id="NotifyFramePop">set</functionlink> and thus get10241<eventlink id="FramePop"></eventlink> events10242</description>10243</capabilityfield>10244<capabilityfield id="can_generate_breakpoint_events">10245<description>10246Can <functionlink id="SetBreakpoint">set</functionlink> and thus get10247<eventlink id="Breakpoint"></eventlink> events10248</description>10249</capabilityfield>10250<capabilityfield id="can_suspend">10251<description>10252Can suspend and resume threads10253</description>10254</capabilityfield>10255<capabilityfield id="can_redefine_any_class">10256<description>10257<functionlink id="RedefineClasses"/> can be called on any modifiable class.10258See <functionlink id="IsModifiableClass"/>.10259(<fieldlink id="can_redefine_classes" struct="jvmtiCapabilities"/>10260must also be set)10261</description>10262</capabilityfield>10263<capabilityfield id="can_get_current_thread_cpu_time">10264<description>10265Can <functionlink id="GetCurrentThreadCpuTime">get</functionlink>10266current thread CPU time10267</description>10268</capabilityfield>10269<capabilityfield id="can_get_thread_cpu_time">10270<description>10271Can <functionlink id="GetThreadCpuTime">get</functionlink>10272thread CPU time10273</description>10274</capabilityfield>10275<capabilityfield id="can_generate_method_entry_events"10276disp1="can_generate" disp2="_method_entry_events"10277>10278<description>10279Can generate method entry events on entering a method10280</description>10281</capabilityfield>10282<capabilityfield id="can_generate_method_exit_events"10283disp1="can_generate" disp2="_method_exit_events"10284>10285<description>10286Can generate method exit events on leaving a method10287</description>10288</capabilityfield>10289<capabilityfield id="can_generate_all_class_hook_events"10290disp1="can_generate" disp2="_all_class_hook_events"10291>10292<description>10293Can generate ClassFileLoadHook events for every loaded class.10294</description>10295</capabilityfield>10296<capabilityfield id="can_generate_compiled_method_load_events"10297disp1="can_generate" disp2="_compiled_method_load_events"10298>10299<description>10300Can generate events when a method is compiled or unloaded10301</description>10302</capabilityfield>10303<capabilityfield id="can_generate_monitor_events"10304disp1="can_generate" disp2="_monitor_events"10305>10306<description>10307Can generate events on monitor activity10308</description>10309</capabilityfield>10310<capabilityfield id="can_generate_vm_object_alloc_events"10311disp1="can_generate" disp2="_vm_object_alloc_events"10312>10313<description>10314Can generate events on VM allocation of an object10315</description>10316</capabilityfield>10317<capabilityfield id="can_generate_native_method_bind_events"10318disp1="can_generate" disp2="_native_method_bind_events"10319>10320<description>10321Can generate events when a native method is bound to its10322implementation10323</description>10324</capabilityfield>10325<capabilityfield id="can_generate_garbage_collection_events"10326disp1="can_generate" disp2="_garbage_collection_events"10327>10328<description>10329Can generate events when garbage collection begins or ends10330</description>10331</capabilityfield>10332<capabilityfield id="can_generate_object_free_events"10333disp1="can_generate" disp2="_object_free_events"10334>10335<description>10336Can generate events when the garbage collector frees an object10337</description>10338</capabilityfield>10339<capabilityfield id="can_force_early_return" since="1.1">10340<description>10341Can return early from a method, as described in the10342<internallink id="ForceEarlyReturn">Force Early Return category</internallink>.10343</description>10344</capabilityfield>10345<capabilityfield id="can_get_owned_monitor_stack_depth_info" since="1.1">10346<description>10347Can get information about owned monitors with stack depth -10348<functionlink id="GetOwnedMonitorStackDepthInfo"></functionlink>10349</description>10350</capabilityfield>10351<capabilityfield id="can_get_constant_pool" since="1.1">10352<description>10353Can get the constant pool of a class -10354<functionlink id="GetConstantPool"></functionlink>10355</description>10356</capabilityfield>10357<capabilityfield id="can_set_native_method_prefix" since="1.1">10358<description>10359Can set prefix to be applied when native method cannot be resolved -10360<functionlink id="SetNativeMethodPrefix"/> and10361<functionlink id="SetNativeMethodPrefixes"/>10362</description>10363</capabilityfield>10364<capabilityfield id="can_retransform_classes" since="1.1">10365<description>10366Can retransform classes with <functionlink id="RetransformClasses"/>.10367In addition to the restrictions imposed by the specific10368implementation on this capability (see the10369<internallink id="capability">Capability</internallink> section),10370this capability must be set before the10371<eventlink id="ClassFileLoadHook"/> event is enabled for the10372first time in this environment.10373An environment that possesses this capability at the time that10374<code>ClassFileLoadHook</code> is enabled for the first time is10375said to be <i>retransformation capable</i>.10376An environment that does not possess this capability at the time that10377<code>ClassFileLoadHook</code> is enabled for the first time is10378said to be <i>retransformation incapable</i>.10379</description>10380</capabilityfield>10381<capabilityfield id="can_retransform_any_class" since="1.1">10382<description>10383<functionlink id="RetransformClasses"/> can be called on any modifiable class.10384See <functionlink id="IsModifiableClass"/>.10385(<fieldlink id="can_retransform_classes" struct="jvmtiCapabilities"/>10386must also be set)10387</description>10388</capabilityfield>10389<capabilityfield id="can_generate_resource_exhaustion_heap_events" since="1.1">10390<description>10391Can generate events when the VM is unable to allocate memory from10392the <tm>Java</tm> platform heap.10393See <eventlink id="ResourceExhausted"/>.10394</description>10395</capabilityfield>10396<capabilityfield id="can_generate_resource_exhaustion_threads_events" since="1.1">10397<description>10398Can generate events when the VM is unable to create a thread.10399See <eventlink id="ResourceExhausted"/>.10400</description>10401</capabilityfield>10402<capabilityfield id="can_generate_early_vmstart" since="9">10403<description>10404Can generate the <code>VMStart</code> event early.10405See <eventlink id="VMStart"/>.10406</description>10407</capabilityfield>10408<capabilityfield id="can_generate_early_class_hook_events" since="9">10409<description>10410Can generate the <eventlink id="ClassFileLoadHook"/> events10411in the primordial phase. If this capability and10412<internallink id="jvmtiCapabilities.can_generate_all_class_hook_events">10413<code>can_generate_all_class_hook_events</code></internallink>10414are enabled then the <eventlink id="ClassFileLoadHook"/> events10415can be posted for classes loaded in the primordial phase.10416See <eventlink id="ClassFileLoadHook"/>.10417</description>10418</capabilityfield>10419<capabilityfield id="can_generate_sampled_object_alloc_events" since="11">10420<description>10421Can generate sampled allocation events.10422If this capability is enabled then the heap sampling method10423<functionlink id="SetHeapSamplingInterval"></functionlink> can be10424called and <eventlink id="SampledObjectAlloc"></eventlink> events can be generated.10425</description>10426</capabilityfield>10427</capabilitiestypedef>1042810429<function id="GetPotentialCapabilities" jkernel="yes" phase="onload" num="140">10430<synopsis>Get Potential Capabilities</synopsis>10431<description>10432Returns via <paramlink id="capabilities_ptr"></paramlink> the <jvmti/>10433features that can potentially be possessed by this environment10434at this time.10435The returned capabilities differ from the complete set of capabilities10436implemented by the VM in two cases: another environment possesses10437capabilities that can only be possessed by one environment, or the10438current <functionlink id="GetPhase">phase</functionlink> is live,10439and certain capabilities can only be added during the <code>OnLoad</code> phase.10440The <functionlink id="AddCapabilities"></functionlink> function10441may be used to set any or all or these capabilities.10442Currently possessed capabilities are included.10443<p/>10444Typically this function is used in the <code>OnLoad</code> function.10445Some virtual machines may allow a limited set of capabilities to be10446added in the live phase.10447In this case, the set of potentially available capabilities10448will likely differ from the <code>OnLoad</code> phase set.10449<p/>10450See the10451<internallink id="capabilityExamples">Capability Examples</internallink>.10452</description>10453<origin>new</origin>10454<capabilities>10455</capabilities>10456<parameters>10457<param id="capabilities_ptr">10458<outptr><struct>jvmtiCapabilities</struct></outptr>10459<description>10460On return, points to the <jvmti/> capabilities that may be added.10461</description>10462</param>10463</parameters>10464<errors>10465</errors>10466</function>1046710468<elide>10469<function id="EstimateCostOfCapabilities" phase="onload" num="141">10470<synopsis>Estimate Cost Of Capabilities</synopsis>10471<description>10472<issue>There is strong opposition to this function. The concern is10473that it would be difficult or impossible to provide meaningful10474numbers, as the amount of impact is conditional on many factors10475that a single number could not represent. There is doubt that10476conditional implementations would be used or are even a good idea.10477The thought is that release documentation for the implementation10478would be the best means of exposing this information.10479Unless new arguments are presented, I intend to remove this10480function in the next revision.10481</issue>10482<p/>10483Return via the <paramlink id="time_impact_ptr"></paramlink> and10484<paramlink id="space_impact_ptr"></paramlink> an estimate of the impact10485of adding the capabilities pointed to by10486<paramlink id="capabilities_ptr"></paramlink>.10487The returned estimates are in percentage of additional overhead, thus10488a time impact of 100 mean the application might run10489at half the speed.10490The estimates are very rough approximations and are not guaranteed.10491Note also, that the estimates are of the impact of having the10492capability available--when and if it is used the impact may be10493much greater.10494Estimates can be for a single capability or for a set of10495capabilities. Note that the costs are not necessarily additive,10496adding support for one capability might make another available10497for free or conversely having two capabilities at once may10498have multiplicative impact.10499Estimates are relative to the current set of capabilities -10500that is, how much more impact given the currently possessed capabilities.10501<p/>10502Typically this function is used in the OnLoad function,10503some virtual machines may allow a limited set of capabilities to be10504added in the live phase.10505In this case, the set of potentially available capabilities10506will likely differ from the OnLoad phase set.10507<p/>10508See the10509<internallink id="capabilityExamples">Capability Examples</internallink>.10510</description>10511<origin>new</origin>10512<capabilities>10513</capabilities>10514<parameters>10515<param id="capabilities_ptr">10516<inptr><struct>jvmtiCapabilities</struct></inptr>10517<description>10518points to the <jvmti/> capabilities to evaluate.10519</description>10520</param>10521<param id="time_impact_ptr">10522<outptr><jint/></outptr>10523<description>10524On return, points to the estimated percentage increase in10525run time if this capability was added.10526</description>10527</param>10528<param id="space_impact_ptr">10529<outptr><jint/></outptr>10530<description>10531On return, points to the estimated percentage increase in10532memory space used if this capability was added.10533</description>10534</param>10535</parameters>10536<errors>10537<error id="JVMTI_ERROR_NOT_AVAILABLE">10538The desired capabilities are not even potentially available.10539</error>10540</errors>10541</function>10542</elide>1054310544<function id="AddCapabilities" jkernel="yes" phase="onload" num="142">10545<synopsis>Add Capabilities</synopsis>10546<description>10547Set new capabilities by adding the capabilities10548whose values are set to one (<code>1</code>) in10549<code>*</code><paramlink id="capabilities_ptr"></paramlink>.10550All previous capabilities are retained.10551Typically this function is used in the <code>OnLoad</code> function.10552Some virtual machines may allow a limited set of capabilities to be10553added in the live phase.10554<p/>10555See the10556<internallink id="capabilityExamples">Capability Examples</internallink>.10557</description>10558<origin>new</origin>10559<capabilities>10560</capabilities>10561<parameters>10562<param id="capabilities_ptr">10563<inptr><struct>jvmtiCapabilities</struct></inptr>10564<description>10565Points to the <jvmti/> capabilities to add.10566</description>10567</param>10568</parameters>10569<errors>10570<error id="JVMTI_ERROR_NOT_AVAILABLE">10571The desired capabilities are not even potentially available.10572</error>10573</errors>10574</function>105751057610577<function id="RelinquishCapabilities" phase="onload" num="143">10578<synopsis>Relinquish Capabilities</synopsis>10579<description>10580Relinquish the capabilities10581whose values are set to one (<code>1</code>) in10582<code>*</code><paramlink id="capabilities_ptr"></paramlink>.10583Some implementations may allow only one environment to have a capability10584(see the <internallink id="capability">capability introduction</internallink>).10585This function releases capabilities10586so that they may be used by other agents.10587All other capabilities are retained.10588The capability will no longer be present in <functionlink id="GetCapabilities"></functionlink>.10589Attempting to relinquish a capability that the agent does not possess is not an error.10590<issue>10591It is possible for the agent to be actively using capabilities10592which are being relinquished. For example, a thread is currently10593suspended and can_suspend is being relinquished or an event is currently10594enabled and can_generate_whatever is being relinquished.10595There are three possible ways we could spec this:10596<ul>10597<li>relinquish automatically releases them</li>10598<li>relinquish checks and returns some error code if held</li>10599<li>it is the agent's responsibility and it is not checked</li>10600</ul>10601One of these should be chosen.10602</issue>10603</description>10604<origin>new</origin>10605<capabilities>10606</capabilities>10607<parameters>10608<param id="capabilities_ptr">10609<inptr><struct>jvmtiCapabilities</struct></inptr>10610<description>10611Points to the <jvmti/> capabilities to relinquish.10612</description>10613</param>10614</parameters>10615<errors>10616</errors>10617</function>10618106191062010621<function id="GetCapabilities" jkernel="yes" phase="any" num="89">10622<synopsis>Get Capabilities</synopsis>10623<description>10624Returns via <paramlink id="capabilities_ptr"></paramlink> the optional <jvmti/>10625features which this environment currently possesses.10626Each possessed capability is indicated by a one (<code>1</code>) in the10627corresponding field of the <internallink id="jvmtiCapabilities">capabilities10628structure</internallink>.10629An environment does not possess a capability unless it has been successfully added with10630<functionlink id="AddCapabilities"/>.10631An environment only loses possession of a capability if it has been relinquished with10632<functionlink id="RelinquishCapabilities"/>. Thus, this function returns the net result10633of the <code>AddCapabilities</code> and <code>RelinquishCapabilities</code> calls which10634have been made.10635<p/>10636See the10637<internallink id="capabilityExamples">Capability Examples</internallink>.10638</description>10639<origin>jvmdiClone</origin>10640<capabilities>10641</capabilities>10642<parameters>10643<param id="capabilities_ptr">10644<outptr><struct>jvmtiCapabilities</struct></outptr>10645<description>10646On return, points to the <jvmti/> capabilities.10647</description>10648</param>10649</parameters>10650<errors>10651</errors>10652</function>1065310654</category>106551065610657<category id="timers" label="Timers">1065810659<intro>10660These functions provide timing information.10661The resolution at which the time is updated is not specified.10662They provides nanosecond precision, but not necessarily nanosecond accuracy.10663Details about the timers, such as their maximum values, can be accessed with10664the timer information functions.10665</intro>1066610667<typedef id="jvmtiTimerInfo" label="Timer Info">10668<description>10669The information function for each timer returns this data structure.10670</description>10671<field id="max_value">10672<jlong/>10673<description>10674The maximum value the timer can reach.10675After this value is reached the timer wraps back to zero.10676This is an unsigned value. If tested or printed as a jlong (signed value)10677it may appear to be a negative number.10678</description>10679</field>10680<field id="may_skip_forward">10681<jboolean/>10682<description>10683If true, the timer can be externally adjusted and as a result skip forward.10684If false, the timer value will never increase faster than real time.10685</description>10686</field>10687<field id="may_skip_backward">10688<jboolean/>10689<description>10690If true, the timer can be externally adjusted and as a result skip backward.10691If false, the timer value will be monotonically increasing.10692</description>10693</field>10694<field id="kind">10695<enum>jvmtiTimerKind</enum>10696<description>10697The kind of timer.10698On a platform that does not distinguish between user and system time, <datalink10699id="JVMTI_TIMER_TOTAL_CPU"><code>JVMTI_TIMER_TOTAL_CPU</code></datalink>10700is returned.10701</description>10702</field>10703<field id="reserved1">10704<jlong/>10705<description>10706Reserved for future use.10707</description>10708</field>10709<field id="reserved2">10710<jlong/>10711<description>10712Reserved for future use.10713</description>10714</field>10715</typedef>1071610717<intro>10718Where the timer kind is --1071910720<constants id="jvmtiTimerKind" label="Timer Kinds" kind="enum">10721<constant id="JVMTI_TIMER_USER_CPU" num="30">10722CPU time that a thread is in user mode.10723</constant>10724<constant id="JVMTI_TIMER_TOTAL_CPU" num="31">10725CPU time that a thread is in user or system mode.10726</constant>10727<constant id="JVMTI_TIMER_ELAPSED" num="32">10728Elapsed time.10729</constant>10730</constants>10731</intro>1073210733<function id="GetCurrentThreadCpuTimerInfo" callbacksafe="safe" impl="innative notrace" phase="start" num="134">10734<synopsis>Get Current Thread CPU Timer Information</synopsis>10735<description>10736Get information about the10737<functionlink id="GetCurrentThreadCpuTime"/> timer.10738The fields of the <datalink id="jvmtiTimerInfo"/> structure10739are filled in with details about the timer.10740This information is specific to the platform and the implementation of10741<functionlink id="GetCurrentThreadCpuTime"/> and thus10742does not vary by thread nor does it vary10743during a particular invocation of the VM.10744<p/>10745Note that the implementations of <functionlink id="GetCurrentThreadCpuTime"/>10746and <functionlink id="GetThreadCpuTime"/> may differ, and thus the values10747returned by <code>GetCurrentThreadCpuTimerInfo</code>10748and <functionlink id="GetThreadCpuTimerInfo"/>10749may differ -- see <functionlink id="GetCurrentThreadCpuTime"/> for more information.10750</description>10751<origin>new</origin>10752<capabilities>10753<required id="can_get_current_thread_cpu_time">10754Can get current thread CPU time.10755</required>10756</capabilities>10757<parameters>10758<param id="info_ptr">10759<outptr><struct>jvmtiTimerInfo</struct></outptr>10760<description>10761On return, filled with information describing the time10762returned by <functionlink id="GetCurrentThreadCpuTime"/>.10763</description>10764</param>10765</parameters>10766<errors>10767</errors>10768</function>1076910770<function id="GetCurrentThreadCpuTime" callbacksafe="safe" impl="innative notrace" phase="start" num="135">10771<synopsis>Get Current Thread CPU Time</synopsis>10772<description>10773Return the CPU time utilized by the current thread.10774<p/>10775Note that the <functionlink id="GetThreadCpuTime"/>10776function provides CPU time for any thread, including10777the current thread. <code>GetCurrentThreadCpuTime</code>10778exists to support platforms which cannot10779supply CPU time for threads other than the current10780thread or which have more accurate information for10781the current thread (see10782<functionlink id="GetCurrentThreadCpuTimerInfo"/> vs10783<functionlink id="GetThreadCpuTimerInfo"/>).10784On many platforms this call will be equivalent to:10785<example>10786GetThreadCpuTime(env, NULL, nanos_ptr)10787</example>10788</description>10789<origin>new</origin>10790<capabilities>10791<required id="can_get_current_thread_cpu_time">10792Can get current thread CPU time.10793<p/>10794If this capability is enabled after threads have started,10795the implementation may choose any time up10796to and including the time that the capability is enabled10797as the point where CPU time collection starts.10798<p/>10799This capability must be potentially available on any10800platform where10801<internallink id="jvmtiCapabilities.can_get_thread_cpu_time"><code>can_get_thread_cpu_time</code></internallink>10802is potentially available.10803</required>10804</capabilities>10805<parameters>10806<param id="nanos_ptr">10807<outptr><jlong/></outptr>10808<description>10809On return, points to the CPU time used by this thread10810in nanoseconds.10811This is an unsigned value. If tested or printed as a jlong (signed value)10812it may appear to be a negative number.10813</description>10814</param>10815</parameters>10816<errors>10817</errors>10818</function>1081910820<function id="GetThreadCpuTimerInfo" num="136">10821<synopsis>Get Thread CPU Timer Information</synopsis>10822<description>10823Get information about the10824<functionlink id="GetThreadCpuTime"/> timer.10825The fields of the <datalink id="jvmtiTimerInfo"/> structure10826are filled in with details about the timer.10827This information is specific to the platform and the implementation of10828<functionlink id="GetThreadCpuTime"/> and thus10829does not vary by thread nor does it vary10830during a particular invocation of the VM.10831<p/>10832Note that the implementations of <functionlink id="GetCurrentThreadCpuTime"/>10833and <functionlink id="GetThreadCpuTime"/> may differ, and thus the values10834returned by <functionlink id="GetCurrentThreadCpuTimerInfo"/>10835and <code>GetThreadCpuTimerInfo</code>10836may differ -- see <functionlink id="GetCurrentThreadCpuTime"/> for more information.10837</description>10838<origin>new</origin>10839<capabilities>10840<required id="can_get_thread_cpu_time">10841Can get thread CPU time.10842</required>10843</capabilities>10844<parameters>10845<param id="info_ptr">10846<outptr><struct>jvmtiTimerInfo</struct></outptr>10847<description>10848On return, filled with information describing the time10849returned by <functionlink id="GetThreadCpuTime"/>.10850</description>10851</param>10852</parameters>10853<errors>10854</errors>10855</function>1085610857<function id="GetThreadCpuTime" num="137">10858<synopsis>Get Thread CPU Time</synopsis>10859<description>10860Return the CPU time utilized by the specified thread.10861<p/>10862Get information about this timer with10863<functionlink id="GetThreadCpuTimerInfo"/>.10864</description>10865<origin>new</origin>10866<capabilities>10867<required id="can_get_thread_cpu_time">10868Can get thread CPU time.10869<p/>10870If this capability is enabled after threads have started,10871the implementation may choose any time up10872to and including the time that the capability is enabled10873as the point where CPU time collection starts.10874</required>10875</capabilities>10876<parameters>10877<param id="thread">10878<jthread null="current"/>10879<description>10880The thread to query.10881</description>10882</param>10883<param id="nanos_ptr">10884<outptr><jlong/></outptr>10885<description>10886On return, points to the CPU time used by the specified thread10887in nanoseconds.10888This is an unsigned value. If tested or printed as a jlong (signed value)10889it may appear to be a negative number.10890</description>10891</param>10892</parameters>10893<errors>10894</errors>10895</function>1089610897<function id="GetTimerInfo" phase="any" callbacksafe="safe" num="138">10898<synopsis>Get Timer Information</synopsis>10899<description>10900Get information about the10901<functionlink id="GetTime"/> timer.10902The fields of the <datalink id="jvmtiTimerInfo"/> structure10903are filled in with details about the timer.10904This information will not change during a particular invocation of the VM.10905</description>10906<origin>new</origin>10907<capabilities>10908</capabilities>10909<parameters>10910<param id="info_ptr">10911<outptr><struct>jvmtiTimerInfo</struct></outptr>10912<description>10913On return, filled with information describing the time10914returned by <functionlink id="GetTime"/>.10915</description>10916</param>10917</parameters>10918<errors>10919</errors>10920</function>1092110922<function id="GetTime" phase="any" callbacksafe="safe" num="139">10923<synopsis>Get Time</synopsis>10924<description>10925Return the current value of the system timer, in nanoseconds.10926<p/>10927The value returned represents nanoseconds since some fixed but10928arbitrary time (perhaps in the future, so values may be10929negative). This function provides nanosecond precision, but not10930necessarily nanosecond accuracy. No guarantees are made about10931how frequently values change.10932<p/>10933Get information about this timer with10934<functionlink id="GetTimerInfo"/>.10935</description>10936<origin>new</origin>10937<capabilities>10938</capabilities>10939<parameters>10940<param id="nanos_ptr">10941<outptr><jlong/></outptr>10942<description>10943On return, points to the time in nanoseconds.10944This is an unsigned value. If tested or printed as a jlong (signed value)10945it may appear to be a negative number.10946</description>10947</param>10948</parameters>10949<errors>10950</errors>10951</function>1095210953<function id="GetAvailableProcessors" phase="any" num="144">10954<synopsis>Get Available Processors</synopsis>10955<description>10956Returns the number of processors available to the Java virtual machine.10957<p/>10958This value may change during a particular invocation of the virtual machine.10959Applications that are sensitive to the number of available processors should10960therefore occasionally poll this property.10961</description>10962<origin>new</origin>10963<capabilities>10964</capabilities>10965<parameters>10966<param id="processor_count_ptr">10967<outptr><jint/></outptr>10968<description>10969On return, points to the maximum number of processors available to the10970virtual machine; never smaller than one.10971</description>10972</param>10973</parameters>10974<errors>10975</errors>10976</function>1097710978</category>109791098010981<category id="classLoaderSearch" label="Class Loader Search">1098210983<intro>10984These functions allow the agent to add to the locations that a class loader searches for a class.10985This is useful for installing instrumentation under the correct class loader.10986</intro>1098710988<function id="AddToBootstrapClassLoaderSearch" jkernel="yes" phase="onload" num="149">10989<synopsis>Add To Bootstrap Class Loader Search</synopsis>10990<description>10991This function can be used to cause instrumentation classes to be defined by the10992bootstrap class loader. See <vmspec chapter="5.3.1"/>.10993After the bootstrap10994class loader unsuccessfully searches for a class, the specified platform-dependent10995search path <paramlink id="segment"/> will be searched as well. Only one segment may be specified in10996the <paramlink id="segment"/>. This function may be called multiple times to add multiple segments,10997the segments will be searched in the order that this function was called.10998<p/>10999In the <code>OnLoad</code> phase the function may be used to specify any platform-dependent11000search path segment to be searched after the bootstrap class loader unsuccessfully searches11001for a class. The segment is typically a directory or JAR file.11002<p/>11003In the live phase the <paramlink id="segment"/> may be used to specify any platform-dependent11004path to a <externallink id="jar/jar.html">11005JAR file</externallink>. The agent should take care that the JAR file does not11006contain any classes or resources other than those to be defined by the bootstrap11007class loader for the purposes of instrumentation.11008<p/>11009<vmspec/> specifies that a subsequent attempt to resolve a symbolic11010reference that the Java virtual machine has previously unsuccessfully attempted11011to resolve always fails with the same error that was thrown as a result of the11012initial resolution attempt. Consequently, if the JAR file contains an entry11013that corresponds to a class for which the Java virtual machine has11014unsuccessfully attempted to resolve a reference, then subsequent attempts to11015resolve that reference will fail with the same error as the initial attempt.11016</description>11017<origin>new</origin>11018<capabilities>11019</capabilities>11020<parameters>11021<param id="segment">11022<inbuf><char/></inbuf>11023<description>11024The platform-dependent search path segment, encoded as a11025<internallink id="mUTF">modified UTF-8</internallink> string.11026</description>11027</param>11028</parameters>11029<errors>11030<error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">11031<paramlink id="segment"/> is an invalid path. In the live phase, anything other than an11032existing JAR file is an invalid path.11033</error>11034</errors>11035</function>1103611037<function id="AddToSystemClassLoaderSearch" jkernel="yes" phase="onload" num="151" since="1.1">11038<synopsis>Add To System Class Loader Search</synopsis>11039<description>11040This function can be used to cause instrumentation classes to be11041defined by the system class loader. See <vmspec chapter="5.3.2"/>.11042After the class loader unsuccessfully searches for a class, the specified platform-dependent search11043path <paramlink id="segment"/> will be searched as well. Only one segment may be specified in the11044<paramlink id="segment"/>. This function may be called multiple times to add multiple segments, the11045segments will be searched in the order that this function was called.11046<p/>11047In the <code>OnLoad</code> phase the function may be used to specify any platform-dependent11048search path segment to be searched after the system class loader unsuccessfully searches11049for a class. The segment is typically a directory or JAR file.11050<p/>11051In the live phase the <paramlink id="segment"/> is a platform-dependent path to a11052<externallink id="jar/jar.html">JAR file</externallink> to be11053searched after the system class loader unsuccessfully searches for a class. The agent should11054take care that the JAR file does not contain any classes or resources other than those to be11055defined by the system class loader for the purposes of instrumentation.11056<p/>11057In the live phase the system class loader supports adding a JAR file to be searched if11058the system class loader implements a method name <code>appendToClassPathForInstrumentation</code>11059which takes a single parameter of type <code>java.lang.String</code>. The method is not required11060to have <code>public</code> access.11061<p/>11062<vmspec/> specifies that a subsequent attempt to resolve a symbolic11063reference that the Java virtual machine has previously unsuccessfully attempted11064to resolve always fails with the same error that was thrown as a result of the11065initial resolution attempt. Consequently, if the JAR file contains an entry11066that corresponds to a class for which the Java virtual machine has11067unsuccessfully attempted to resolve a reference, then subsequent attempts to11068resolve that reference will fail with the same error as the initial attempt.11069</description>11070<origin>new</origin>11071<capabilities>11072</capabilities>11073<parameters>11074<param id="segment">11075<inbuf><char/></inbuf>11076<description>11077The platform-dependent search path segment, encoded as a11078<internallink id="mUTF">modified UTF-8</internallink> string.11079</description>11080</param>11081</parameters>11082<errors>11083<error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">11084<paramlink id="segment"/> is an invalid path. In the live phase, anything other than an11085existing JAR file is an invalid path.11086</error>11087<error id="JVMTI_ERROR_CLASS_LOADER_UNSUPPORTED">11088Operation not supported by the system class loader.11089</error>11090</errors>11091</function>1109211093</category>110941109511096<category id="props" label="System Properties">1109711098<intro>11099These functions get and set system properties.11100</intro>1110111102<function id="GetSystemProperties" phase="onload" num="130">11103<synopsis>Get System Properties</synopsis>11104<description>11105The list of VM system property keys which may be used with11106<functionlink id="GetSystemProperty"/> is returned.11107It is strongly recommended that virtual machines provide the11108following property keys:11109<ul>11110<li><code>java.vm.vendor</code></li>11111<li><code>java.vm.version</code></li>11112<li><code>java.vm.name</code></li>11113<li><code>java.vm.info</code></li>11114<li><code>java.library.path</code></li>11115<li><code>java.class.path</code></li>11116</ul>11117Provides access to system properties defined by and used11118by the VM.11119Properties set on the command-line are included.11120This allows getting and setting of these properties11121before the VM even begins executing bytecodes.11122Since this is a VM view of system properties, the set of available11123properties will usually be different than that11124in <code>java.lang.System.getProperties</code>.11125JNI method invocation may be used to access11126<code>java.lang.System.getProperties</code>.11127<p/>11128The set of properties may grow during execution.11129</description>11130<origin>new</origin>11131<capabilities>11132</capabilities>11133<parameters>11134<param id="count_ptr">11135<outptr><jint/></outptr>11136<description>11137On return, points to the number of property keys returned.11138</description>11139</param>11140<param id="property_ptr">11141<allocallocbuf outcount="count_ptr"><char/></allocallocbuf>11142<description>11143On return, points to an array of property keys, encoded as11144<internallink id="mUTF">modified UTF-8</internallink> strings.11145</description>11146</param>11147</parameters>11148<errors>11149</errors>11150</function>1115111152<function id="GetSystemProperty" phase="onload" num="131">11153<synopsis>Get System Property</synopsis>11154<description>11155Return a VM system property value given the property key.11156<p/>11157The function <functionlink id="GetSystemProperties"/>11158returns the set of property keys which may be used.11159The properties which can be retrieved may grow during11160execution.11161<p/>11162Since this is a VM view of system properties, the values11163of properties may differ from that returned by11164<code>java.lang.System.getProperty(String)</code>.11165A typical VM might copy the values of the VM system11166properties into the <code>Properties</code> held by11167<code>java.lang.System</code> during the initialization11168of that class. Thereafter any changes to the VM system11169properties (with <functionlink id="SetSystemProperty"/>)11170or the <code>java.lang.System</code> system properties11171(with <code>java.lang.System.setProperty(String,String)</code>)11172would cause the values to diverge.11173JNI method invocation may be used to access11174<code>java.lang.System.getProperty(String)</code>.11175</description>11176<origin>new</origin>11177<capabilities>11178</capabilities>11179<parameters>11180<param id="property">11181<inbuf><char/></inbuf>11182<description>11183The key of the property to retrieve, encoded as a11184<internallink id="mUTF">modified UTF-8</internallink> string.11185</description>11186</param>11187<param id="value_ptr">11188<allocbuf><char/></allocbuf>11189<description>11190On return, points to the property value, encoded as a11191<internallink id="mUTF">modified UTF-8</internallink> string.11192</description>11193</param>11194</parameters>11195<errors>11196<error id="JVMTI_ERROR_NOT_AVAILABLE">11197This property is not available.11198Use <functionlink id="GetSystemProperties"/> to find available properties.11199</error>11200</errors>11201</function>1120211203<function id="SetSystemProperty" phase="onloadOnly" num="132">11204<synopsis>Set System Property</synopsis>11205<description>11206Set a VM system property value.11207<p/>11208The function <functionlink id="GetSystemProperties"/>11209returns the set of property keys, some of these may be settable.11210See <functionlink id="GetSystemProperty"/>.11211</description>11212<origin>new</origin>11213<capabilities>11214</capabilities>11215<parameters>11216<param id="property">11217<inbuf><char/></inbuf>11218<description>11219The key of the property, encoded as a11220<internallink id="mUTF">modified UTF-8</internallink> string.11221</description>11222</param>11223<param id="value_ptr">11224<inbuf>11225<char/>11226<nullok>11227do not set the value, but return <errorlink id="JVMTI_ERROR_NOT_AVAILABLE"/>11228if the property is not writeable11229</nullok>11230</inbuf>11231<description>11232The property value to set, encoded as a11233<internallink id="mUTF">modified UTF-8</internallink> string.11234</description>11235</param>11236</parameters>11237<errors>11238<error id="JVMTI_ERROR_NOT_AVAILABLE">11239This property is not available or is not writeable.11240</error>11241</errors>11242</function>1124311244</category>1124511246<category id="general" label="General">1124711248<intro>11249</intro>1125011251<function id="GetPhase" jkernel="yes" phase="any" num="133">11252<synopsis>Get Phase</synopsis>11253<description>11254Return the current phase of VM execution.11255The phases proceed in sequence:11256<constants id="jvmtiPhase" label="Phases of execution" kind="enum">11257<constant id="JVMTI_PHASE_ONLOAD" num="1">11258<code>OnLoad</code> phase: while in the11259<internallink id="onload"><code>Agent_OnLoad</code></internallink>11260or, for statically linked agents, the <internallink id="onload">11261<code>Agent_OnLoad_<agent-lib-name>11262</code></internallink> function.11263</constant>11264<constant id="JVMTI_PHASE_PRIMORDIAL" num="2">11265Primordial phase: between return from <code>Agent_OnLoad</code>11266or <code>Agent_OnLoad_<agent-lib-name></code> and the11267<code>VMStart</code> event.11268</constant>11269<constant id="JVMTI_PHASE_START" num="6">11270Start phase: when the <eventlink id="VMStart"><code>VMStart</code></eventlink> event11271is sent and until the <code>VMInit</code> event is sent.11272</constant>11273<constant id="JVMTI_PHASE_LIVE" num="4">11274Live phase: when the <eventlink id="VMInit"><code>VMInit</code></eventlink> event is sent11275and until the <eventlink id="VMDeath"></eventlink> event returns.11276</constant>11277<constant id="JVMTI_PHASE_DEAD" num="8">11278Dead phase: after the <eventlink id="VMDeath"></eventlink> event returns or after11279start-up failure.11280</constant>11281</constants>11282In the case of start-up failure the VM will proceed directly to the dead11283phase skipping intermediate phases and neither a <code>VMInit</code> nor11284<code>VMDeath</code> event will be sent.11285<p/>11286Most <jvmti/> functions operate only in the live phase.11287The following functions operate in either the <code>OnLoad</code> or live phases:11288<functionphaselist phase="onload"/>11289The following functions operate in only the <code>OnLoad</code> phase:11290<functionphaselist phase="onloadOnly"/>11291The following functions operate in the start or live phases:11292<functionphaselist phase="start"/>11293The following functions operate in any phase:11294<functionphaselist phase="any"/>11295JNI functions (except the Invocation API) must only be used in the start or live phases.11296<p/>11297Most <jvmti/> events are sent only in the live phase.11298The following events operate in others phases:11299<eventphaselist phase="start"/>11300<eventphaselist phase="any"/>11301</description>11302<origin>new</origin>11303<capabilities>11304</capabilities>11305<parameters>11306<param id="phase_ptr">11307<outptr><enum>jvmtiPhase</enum></outptr>11308<description>11309On return, points to the phase.11310</description>11311</param>11312</parameters>11313<errors>11314</errors>11315</function>1131611317<function id="DisposeEnvironment" jkernel="yes" phase="any" num="127">11318<synopsis>Dispose Environment</synopsis>11319<description>11320Shutdown a <jvmti/> connection created with JNI <code>GetEnv</code>11321(see <internallink id="environments"><jvmti/> Environments</internallink>).11322Dispose of any resources held by the environment.11323<issue>11324What resources are reclaimed? What is undone?11325Breakpoints,watchpoints removed?11326</issue>11327Threads suspended by this environment are not resumed by this call,11328this must be done explicitly by the agent.11329Memory allocated by this environment via calls to <jvmti/> functions11330is not released, this can be done explicitly by the agent11331by calling <functionlink id="Deallocate"/>.11332Raw monitors created by this environment are not destroyed,11333this can be done explicitly by the agent11334by calling <functionlink id="DestroyRawMonitor"/>.11335The state of threads waiting on raw monitors created by this environment11336are not affected.11337<p/>11338Any <functionlink id="SetNativeMethodPrefix">native method11339prefixes</functionlink> for this environment will be unset;11340the agent must remove any prefixed native methods before11341dispose is called.11342<p/>11343Any <internallink id="capability">capabilities</internallink>11344held by this environment are relinquished.11345<p/>11346Events enabled by this environment will no longer be sent, however11347event handlers currently running will continue to run. Caution must11348be exercised in the design of event handlers whose environment may11349be disposed and thus become invalid during their execution.11350<p/>11351This environment may not be used after this call.11352This call returns to the caller.11353</description>11354<origin>new</origin>11355<capabilities>11356</capabilities>11357<parameters>11358</parameters>11359<errors>11360</errors>11361</function>1136211363<function id="SetEnvironmentLocalStorage" jkernel="yes" phase="any" callbacksafe="safe" impl="innative notrace" num="148">11364<synopsis>Set Environment Local Storage</synopsis>11365<description>11366The VM stores a pointer value associated with each environment.11367This pointer value is called <i>environment-local storage</i>.11368This value is <code>NULL</code> unless set with this function.11369Agents can allocate memory in which they store environment specific11370information. By setting environment-local storage it can then be11371accessed with11372<functionlink id="GetEnvironmentLocalStorage"></functionlink>.11373<p/>11374Called by the agent to set the value of the <jvmti/>11375environment-local storage. <jvmti/> supplies to the agent a pointer-size11376environment-local storage that can be used to record per-environment11377information.11378</description>11379<origin>new</origin>11380<capabilities>11381</capabilities>11382<parameters>11383<param id="data">11384<inbuf>11385<void/>11386<nullok>value is set to <code>NULL</code></nullok>11387</inbuf>11388<description>11389The value to be entered into the environment-local storage.11390</description>11391</param>11392</parameters>11393<errors>11394</errors>11395</function>1139611397<function id="GetEnvironmentLocalStorage" jkernel="yes" phase="any" callbacksafe="safe" impl="innative notrace" num="147">11398<synopsis>Get Environment Local Storage</synopsis>11399<description>11400Called by the agent to get the value of the <jvmti/> environment-local11401storage.11402</description>11403<origin>new</origin>11404<capabilities>11405</capabilities>11406<parameters>11407<param id="data_ptr">11408<agentbuf><void/></agentbuf>11409<description>11410Pointer through which the value of the environment local11411storage is returned.11412If environment-local storage has not been set with11413<functionlink id="SetEnvironmentLocalStorage"></functionlink> returned11414pointer is <code>NULL</code>.11415</description>11416</param>11417</parameters>11418<errors>11419</errors>11420</function>1142111422<function id="GetVersionNumber" jkernel="yes" phase="any" num="88">11423<synopsis>Get Version Number</synopsis>11424<description>11425Return the <jvmti/> version via <code>version_ptr</code>.11426The return value is the version identifier.11427The version identifier includes major, minor and micro11428version as well as the interface type.11429<constants id="jvmtiVersionInterfaceTypes" label="Version Interface Types" kind="bits">11430<constant id="JVMTI_VERSION_INTERFACE_JNI" num="0x00000000">11431Value of <code>JVMTI_VERSION_MASK_INTERFACE_TYPE</code> for JNI.11432</constant>11433<constant id="JVMTI_VERSION_INTERFACE_JVMTI" num="0x30000000">11434Value of <code>JVMTI_VERSION_MASK_INTERFACE_TYPE</code> for <jvmti/>.11435</constant>11436</constants>11437<constants id="jvmtiVersionMasks" label="Version Masks" kind="bits">11438<constant id="JVMTI_VERSION_MASK_INTERFACE_TYPE" num="0x70000000">11439Mask to extract interface type.11440The value of the version returned by this function masked with11441<code>JVMTI_VERSION_MASK_INTERFACE_TYPE</code> is always11442<code>JVMTI_VERSION_INTERFACE_JVMTI</code>11443since this is a <jvmti/> function.11444</constant>11445<constant id="JVMTI_VERSION_MASK_MAJOR" num="0x0FFF0000">11446Mask to extract major version number.11447</constant>11448<constant id="JVMTI_VERSION_MASK_MINOR" num="0x0000FF00">11449Mask to extract minor version number.11450</constant>11451<constant id="JVMTI_VERSION_MASK_MICRO" num="0x000000FF">11452Mask to extract micro version number.11453</constant>11454</constants>11455<constants id="jvmtiVersionShifts" label="Version Shifts" kind="bits">11456<constant id="JVMTI_VERSION_SHIFT_MAJOR" num="16">11457Shift to extract major version number.11458</constant>11459<constant id="JVMTI_VERSION_SHIFT_MINOR" num="8">11460Shift to extract minor version number.11461</constant>11462<constant id="JVMTI_VERSION_SHIFT_MICRO" num="0">11463Shift to extract micro version number.11464</constant>11465</constants>11466</description>11467<origin>jvmdi</origin>11468<capabilities>11469</capabilities>11470<parameters>11471<param id="version_ptr">11472<outptr><jint/></outptr>11473<description>11474On return, points to the <jvmti/> version.11475</description>11476</param>11477</parameters>11478<errors>11479</errors>11480</function>114811148211483<function id="GetErrorName" phase="any" num="128">11484<synopsis>Get Error Name</synopsis>11485<description>11486Return the symbolic name for an11487<internallink id="ErrorSection">error code</internallink>.11488<p/>11489For example11490<code>GetErrorName(env, JVMTI_ERROR_NONE, &err_name)</code>11491would return in <code>err_name</code> the string11492<code>"JVMTI_ERROR_NONE"</code>.11493</description>11494<origin>new</origin>11495<capabilities>11496</capabilities>11497<parameters>11498<param id="error">11499<enum>jvmtiError</enum>11500<description>11501The error code.11502</description>11503</param>11504<param id="name_ptr">11505<allocbuf><char/></allocbuf>11506<description>11507On return, points to the error name.11508The name is encoded as a11509<internallink id="mUTF">modified UTF-8</internallink> string,11510but is restricted to the ASCII subset.11511</description>11512</param>11513</parameters>11514<errors>11515</errors>11516</function>1151711518<function id="SetVerboseFlag" phase="any" num="150">11519<synopsis>Set Verbose Flag</synopsis>11520<description>11521<constants id="jvmtiVerboseFlag" label="Verbose Flag Enumeration" kind="enum">11522<constant id="JVMTI_VERBOSE_OTHER" num="0">11523Verbose output other than the below.11524</constant>11525<constant id="JVMTI_VERBOSE_GC" num="1">11526Verbose garbage collector output, like that specified with <code>-verbose:gc</code>.11527</constant>11528<constant id="JVMTI_VERBOSE_CLASS" num="2">11529Verbose class loading output, like that specified with <code>-verbose:class</code>.11530</constant>11531<constant id="JVMTI_VERBOSE_JNI" num="4">11532Verbose JNI output, like that specified with <code>-verbose:jni</code>.11533</constant>11534</constants>11535Control verbose output.11536This is the output which typically is sent to <code>stderr</code>.11537</description>11538<origin>new</origin>11539<capabilities>11540</capabilities>11541<parameters>11542<param id="flag">11543<enum>jvmtiVerboseFlag</enum>11544<description>11545Which verbose flag to set.11546</description>11547</param>11548<param id="value">11549<jboolean/>11550<description>11551New value of the flag.11552</description>11553</param>11554</parameters>11555<errors>11556</errors>11557</function>115581155911560<function id="GetJLocationFormat" phase="any" num="129">11561<synopsis>Get JLocation Format</synopsis>11562<description>11563Although the greatest functionality is achieved with location information11564referencing the virtual machine bytecode index, the definition of11565<code>jlocation</code> has intentionally been left unconstrained to allow VM11566implementations that do not have this information.11567<p/>11568This function describes the representation of <code>jlocation</code> used in this VM.11569If the returned format is <datalink id="JVMTI_JLOCATION_JVMBCI"></datalink>,11570<code>jlocation</code>s can11571be used as in indices into the array returned by11572<functionlink id="GetBytecodes"></functionlink>.11573<constants id="jvmtiJlocationFormat" label="JLocation Format Enumeration" kind="enum">11574<constant id="JVMTI_JLOCATION_JVMBCI" num="1">11575<code>jlocation</code> values represent virtual machine11576bytecode indices--that is, offsets into the11577virtual machine code for a method.11578</constant>11579<constant id="JVMTI_JLOCATION_MACHINEPC" num="2">11580<code>jlocation</code> values represent native machine11581program counter values.11582</constant>11583<constant id="JVMTI_JLOCATION_OTHER" num="0">11584<code>jlocation</code> values have some other representation.11585</constant>11586</constants>11587</description>11588<origin>new</origin>11589<capabilities>11590</capabilities>11591<parameters>11592<param id="format_ptr">11593<outptr><enum>jvmtiJlocationFormat</enum></outptr>11594<description>11595On return, points to the format identifier for <code>jlocation</code> values.11596</description>11597</param>11598</parameters>11599<errors>11600</errors>11601</function>1160211603</category>1160411605<category id="heap_monitoring" label="Heap Monitoring">11606<function id="SetHeapSamplingInterval" phase="onload" num="156" since="11">11607<synopsis>Set Heap Sampling Interval</synopsis>11608<description>11609Generate a <eventlink id="SampledObjectAlloc"/> event when objects are allocated.11610Each thread keeps a counter of bytes allocated. The event will only be generated11611when that counter exceeds an average of <paramlink id="sampling_interval"></paramlink>11612since the last sample.11613<p/>11614Setting <paramlink id="sampling_interval"></paramlink> to 0 will cause an event to be11615generated by each allocation supported by the system once the new interval is taken into account.11616<p/>11617Note that updating the new sampling interval might take various number of allocations11618to provoke internal data structure updates. Therefore it is important to11619consider the sampling interval as an average. This includes the interval 0, where events11620might not be generated straight away for each allocation.11621</description>11622<origin>new</origin>11623<capabilities>11624<required id="can_generate_sampled_object_alloc_events"></required>11625</capabilities>11626<parameters>11627<param id="sampling_interval">11628<jint/>11629<description>11630The sampling interval in bytes. The sampler uses a statistical approach to11631generate an event, on average, once for every <paramlink id="sampling_interval"/> bytes of11632memory allocated by a given thread.11633<p/>11634Once the new sampling interval is taken into account, 0 as a sampling interval will generate11635a sample for every allocation.11636<p/>11637Note: The overhead of this feature is directly correlated with the sampling interval.11638A high sampling interval, such as 1024 bytes, will incur a high overhead.11639A lower interval, such as 1024KB, will have a much lower overhead. Sampling should only11640be used with an understanding that it may impact performance.11641</description>11642</param>11643</parameters>11644<errors>11645<error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">11646<paramlink id="sampling_interval"></paramlink> is less than zero.11647</error>11648</errors>11649</function>11650</category>1165111652</functionsection>1165311654<errorsection label="Error Reference">11655<intro>11656Every <jvmti/> function returns a <b><code>jvmtiError</code></b> error code.11657<p/>11658It is the responsibility of the agent to call <jvmti/> functions with11659valid parameters and in the proper context (calling thread is attached,11660phase is correct, etc.).11661Detecting some error conditions may be difficult, inefficient, or11662impossible for an implementation.11663The errors listed in11664<internallink id="reqerrors">Function Specific Required Errors</internallink>11665must be detected by the implementation.11666All other errors represent the recommended response to the error11667condition.11668</intro>1166911670<errorcategory id="universal-error" label="Universal Errors">11671<intro>11672The following errors may be returned by any function11673</intro>1167411675<errorid id="JVMTI_ERROR_NONE" num="0">11676No error has occurred. This is the error code that is returned11677on successful completion of the function.11678</errorid>11679<errorid id="JVMTI_ERROR_NULL_POINTER" num="100">11680Pointer is unexpectedly <code>NULL</code>.11681</errorid>11682<errorid id="JVMTI_ERROR_OUT_OF_MEMORY" num="110">11683The function attempted to allocate memory and no more memory was11684available for allocation.11685</errorid>11686<errorid id="JVMTI_ERROR_ACCESS_DENIED" num="111">11687The desired functionality has not been enabled in this virtual machine.11688</errorid>11689<errorid id="JVMTI_ERROR_UNATTACHED_THREAD" num="115">11690The thread being used to call this function is not attached11691to the virtual machine. Calls must be made from attached threads.11692See <code>AttachCurrentThread</code> in the JNI invocation API.11693</errorid>11694<errorid id="JVMTI_ERROR_INVALID_ENVIRONMENT" num="116">11695The <jvmti/> environment provided is no longer connected or is11696not an environment.11697</errorid>11698<errorid id="JVMTI_ERROR_WRONG_PHASE" num="112">11699The desired functionality is not available in the current11700<functionlink id="GetPhase">phase</functionlink>.11701Always returned if the virtual machine has completed running.11702</errorid>11703<errorid id="JVMTI_ERROR_INTERNAL" num="113">11704An unexpected internal error has occurred.11705</errorid>11706</errorcategory>1170711708<errorcategory id="reqerrors" label="Function Specific Required Errors">11709<intro>11710The following errors are returned by some <jvmti/> functions and must11711be returned by the implementation when the condition occurs.11712</intro>1171311714<errorid id="JVMTI_ERROR_INVALID_PRIORITY" num="12">11715Invalid priority.11716</errorid>11717<errorid id="JVMTI_ERROR_THREAD_NOT_SUSPENDED" num="13">11718Thread was not suspended.11719</errorid>11720<errorid id="JVMTI_ERROR_THREAD_SUSPENDED" num="14">11721Thread already suspended.11722</errorid>11723<errorid id="JVMTI_ERROR_THREAD_NOT_ALIVE" num="15">11724This operation requires the thread to be alive--that is,11725it must be started and not yet have died.11726</errorid>11727<errorid id="JVMTI_ERROR_CLASS_NOT_PREPARED" num="22">11728The class has been loaded but not yet prepared.11729</errorid>11730<errorid id="JVMTI_ERROR_NO_MORE_FRAMES" num="31">11731There are no Java programming language or JNI stack frames at the specified depth.11732</errorid>11733<errorid id="JVMTI_ERROR_OPAQUE_FRAME" num="32">11734Information about the frame is not available (e.g. for native frames).11735</errorid>11736<errorid id="JVMTI_ERROR_DUPLICATE" num="40">11737Item already set.11738</errorid>11739<errorid id="JVMTI_ERROR_NOT_FOUND" num="41">11740Desired element (e.g. field or breakpoint) not found11741</errorid>11742<errorid id="JVMTI_ERROR_NOT_MONITOR_OWNER" num="51">11743This thread doesn't own the raw monitor.11744</errorid>11745<errorid id="JVMTI_ERROR_INTERRUPT" num="52">11746The call has been interrupted before completion.11747</errorid>11748<errorid id="JVMTI_ERROR_UNMODIFIABLE_CLASS" num="79">11749The class cannot be modified.11750</errorid>11751<errorid id="JVMTI_ERROR_UNMODIFIABLE_MODULE" num="80">11752The module cannot be modified.11753</errorid>11754<errorid id="JVMTI_ERROR_NOT_AVAILABLE" num="98">11755The functionality is not available in this virtual machine.11756</errorid>11757<errorid id="JVMTI_ERROR_ABSENT_INFORMATION" num="101">11758The requested information is not available.11759</errorid>11760<errorid id="JVMTI_ERROR_INVALID_EVENT_TYPE" num="102">11761The specified event type ID is not recognized.11762</errorid>11763<errorid id="JVMTI_ERROR_NATIVE_METHOD" num="104">11764The requested information is not available for native method.11765</errorid>11766<errorid id="JVMTI_ERROR_CLASS_LOADER_UNSUPPORTED" num="106">11767The class loader does not support this operation.11768</errorid>11769</errorcategory>1177011771<errorcategory id="function-specific-errors" label="Function Specific Agent Errors">11772<intro>11773The following errors are returned by some <jvmti/> functions.11774They are returned in the event of invalid parameters passed by the11775agent or usage in an invalid context.11776An implementation is not required to detect these errors.11777</intro>1177811779<errorid id="JVMTI_ERROR_INVALID_THREAD" num="10">11780The passed thread is not a valid thread.11781</errorid>11782<errorid id="JVMTI_ERROR_INVALID_FIELDID" num="25">11783Invalid field.11784</errorid>11785<errorid id="JVMTI_ERROR_INVALID_MODULE" num="26">11786Invalid module.11787</errorid>11788<errorid id="JVMTI_ERROR_INVALID_METHODID" num="23">11789Invalid method.11790</errorid>11791<errorid id="JVMTI_ERROR_INVALID_LOCATION" num="24">11792Invalid location.11793</errorid>11794<errorid id="JVMTI_ERROR_INVALID_OBJECT" num="20">11795Invalid object.11796</errorid>11797<errorid id="JVMTI_ERROR_INVALID_CLASS" num="21">11798Invalid class.11799</errorid>11800<errorid id="JVMTI_ERROR_TYPE_MISMATCH" num="34">11801The variable is not an appropriate type for the function used.11802</errorid>11803<errorid id="JVMTI_ERROR_INVALID_SLOT" num="35">11804Invalid slot.11805</errorid>11806<errorid id="JVMTI_ERROR_MUST_POSSESS_CAPABILITY" num="99">11807The capability being used is false in this environment.11808</errorid>11809<errorid id="JVMTI_ERROR_INVALID_THREAD_GROUP" num="11">11810Thread group invalid.11811</errorid>11812<errorid id="JVMTI_ERROR_INVALID_MONITOR" num="50">11813Invalid raw monitor.11814</errorid>11815<errorid id="JVMTI_ERROR_ILLEGAL_ARGUMENT" num="103">11816Illegal argument.11817</errorid>11818<errorid id="JVMTI_ERROR_INVALID_TYPESTATE" num="65">11819The state of the thread has been modified, and is now inconsistent.11820</errorid>11821<errorid id="JVMTI_ERROR_UNSUPPORTED_VERSION" num="68">11822A new class file has a version number not supported by this VM.11823</errorid>11824<errorid id="JVMTI_ERROR_INVALID_CLASS_FORMAT" num="60">11825A new class file is malformed (the VM would return a <code>ClassFormatError</code>).11826</errorid>11827<errorid id="JVMTI_ERROR_CIRCULAR_CLASS_DEFINITION" num="61">11828The new class file definitions would lead to a circular11829definition (the VM would return a <code>ClassCircularityError</code>).11830</errorid>11831<errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_ADDED" num="63">11832A new class file would require adding a method.11833</errorid>11834<errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED" num="64">11835A new class version changes a field.11836</errorid>11837<errorid id="JVMTI_ERROR_FAILS_VERIFICATION" num="62">11838The class bytes fail verification.11839</errorid>11840<errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED" num="66">11841A direct superclass is different for the new class11842version, or the set of directly implemented11843interfaces is different.11844</errorid>11845<errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_DELETED" num="67">11846A new class version does not declare a method11847declared in the old class version.11848</errorid>11849<errorid id="JVMTI_ERROR_NAMES_DONT_MATCH" num="69">11850The class name defined in the new class file is11851different from the name in the old class object.11852</errorid>11853<errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED" num="70">11854A new class version has different modifiers.11855</errorid>11856<errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED" num="71">11857A method in the new class version has different modifiers11858than its counterpart in the old class version.11859</errorid>11860<errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_ATTRIBUTE_CHANGED" num="72">11861A new class version has unsupported differences in class attributes.11862</errorid>11863</errorcategory>11864</errorsection>1186511866<eventsection label="Events">11867<intro label="Handling Events" id="eventIntro">11868Agents can be informed of many events that occur in application11869programs.11870<p/>11871To handle events, designate a set of callback functions with11872<functionlink id="SetEventCallbacks"></functionlink>.11873For each event the corresponding callback function will be11874called.11875Arguments to the callback function provide additional11876information about the event.11877<p/>11878The callback function is usually called from within an application11879thread. The <jvmti/> implementation does not11880queue events in any way. This means11881that event callback functions must be written11882carefully. Here are some general guidelines. See11883the individual event descriptions for further11884suggestions.11885<p/>11886<ul>11887<li>Any exception thrown during the execution of an event callback can11888overwrite any current pending exception in the current application thread.11889Care must be taken to preserve a pending exception11890when an event callback makes a JNI call that might generate an exception.11891</li>11892<li>Event callback functions must be re-entrant. The <jvmti/> implementation does11893not queue events. If an agent needs to process events one at a time, it11894can use a raw monitor inside the11895event callback functions to serialize event processing.11896</li>11897<li>Event callback functions that execute JNI's FindClass function to load11898classes need to note that FindClass locates the class loader associated11899with the current native method. For the purposes of class loading, an11900event callback that includes a JNI environment as a parameter to the11901callback will treated as if it is a native call, where the native method11902is in the class of the event thread's current frame.11903</li>11904</ul>11905<p/>11906Some <jvmti/> events identify objects with JNI references.11907All references11908in <jvmti/> events are JNI local references and will become invalid11909after the event callback returns.11910Unless stated otherwise, memory referenced by pointers sent in event11911callbacks may not be referenced after the event callback returns.11912<p/>11913Except where stated otherwise, events are delivered on the thread11914that caused the event.11915Events are sent at the time they occur.11916The specification for each event includes the set of11917<functionlink id="GetPhase">phases</functionlink> in which it can be sent;11918if an event triggering activity occurs during another phase, no event11919is sent.11920<p/>11921A thread that generates an event does not change its execution status11922(for example, the event does not cause the thread to be suspended).11923If an agent wishes the event to result in suspension, then the agent11924is responsible for explicitly suspending the thread with11925<functionlink id="SuspendThread"></functionlink>.11926<p/>11927If an event is enabled in multiple environments, the event will be sent11928to each agent in the order that the environments were created.11929</intro>1193011931<intro label="Enabling Events" id="enablingevents">11932All events are initially disabled. In order to receive any11933event:11934<ul>11935<li>11936If the event requires a capability, that capability must11937be added with11938<functionlink id="AddCapabilities"></functionlink>.11939</li>11940<li>11941A callback for the event must be set with11942<functionlink id="SetEventCallbacks"></functionlink>.11943</li>11944<li>11945The event must be enabled with11946<functionlink id="SetEventNotificationMode"></functionlink>.11947</li>11948</ul>11949</intro>1195011951<intro label="Multiple Co-located Events" id="eventorder">11952In many situations it is possible for multiple events to occur11953at the same location in one thread. When this happens, all the events11954are reported through the event callbacks in the order specified in this section.11955<p/>11956If the current location is at the entry point of a method, the11957<eventlink id="MethodEntry"></eventlink> event is reported before11958any other event at the current location in the same thread.11959<p/>11960If an exception catch has been detected at the current location,11961either because it is the beginning of a catch clause or a native method11962that cleared a pending exception has returned, the11963<code>exceptionCatch</code> event is reported before11964any other event at the current location in the same thread.11965<p/>11966If a <code>singleStep</code> event or11967<code>breakpoint</code> event is triggered at the11968current location, the event is defined to occur11969immediately before the code at the current location is executed.11970These events are reported before any events which are triggered11971by the execution of code at the current location in the same11972thread (specifically:11973<code>exception</code>,11974<code>fieldAccess</code>, and11975<code>fieldModification</code>).11976If both a step and breakpoint event are triggered for the same thread and11977location, the step event is reported before the breakpoint event.11978<p/>11979If the current location is the exit point of a method (that is, the last11980location before returning to the caller), the11981<eventlink id="MethodExit"></eventlink> event and11982the <eventlink id="FramePop"></eventlink> event (if requested)11983are reported after all other events at the current location in the same11984thread. There is no specified ordering of these two events11985with respect to each other.11986<p/>11987Co-located events can be triggered during the processing of some other11988event by the agent at the same location in the same thread.11989If such an event, of type <i>y</i>, is triggered during the processing of11990an event of type <i>x</i>, and if <i>x</i>11991precedes <i>y</i> in the ordering specified above, the co-located event11992<i>y</i> is reported for the current thread and location. If <i>x</i> does not precede11993<i>y</i>, <i>y</i> is not reported for the current thread and location.11994For example, if a breakpoint is set at the current location11995during the processing of <eventlink id="SingleStep"></eventlink>,11996that breakpoint will be reported before the thread moves off the current11997location.11998<p/>The following events are never considered to be co-located with11999other events.12000<ul>12001<li><eventlink id="VMStart"></eventlink></li>12002<li><eventlink id="VMInit"></eventlink></li>12003<li><eventlink id="VMDeath"></eventlink></li>12004<li><eventlink id="ThreadStart"></eventlink></li>12005<li><eventlink id="ThreadEnd"></eventlink></li>12006<li><eventlink id="ClassLoad"></eventlink></li>12007<li><eventlink id="ClassPrepare"></eventlink></li>12008</ul>12009</intro>1201012011<intro label="Event Callbacks" id="jvmtiEventCallbacks">12012The event callback structure below is used to specify the handler function12013for events. It is set with the12014<functionlink id="SetEventCallbacks"></functionlink> function.12015</intro>1201612017<event label="Single Step"12018id="SingleStep" const="JVMTI_EVENT_SINGLE_STEP" filtered="thread" num="60">12019<description>12020Single step events allow the agent to trace thread execution12021at the finest granularity allowed by the VM. A single step event is12022generated whenever a thread reaches a new location.12023Typically, single step events represent the completion of one VM12024instruction as defined in <vmspec/>. However, some implementations12025may define locations differently. In any case the12026<code>method</code> and <code>location</code>12027parameters uniquely identify the current location and allow12028the mapping to source file and line number when that information is12029available.12030<p/>12031No single step events are generated from within native methods.12032</description>12033<origin>jvmdi</origin>12034<capabilities>12035<required id="can_generate_single_step_events"></required>12036</capabilities>12037<parameters>12038<param id="jni_env">12039<outptr>12040<struct>JNIEnv</struct>12041</outptr>12042<description>12043The JNI environment of the event (current) thread12044</description>12045</param>12046<param id="thread">12047<jthread/>12048<description>12049Thread about to execution a new instruction12050</description>12051</param>12052<param id="klass">12053<jclass method="method"/>12054<description>12055Class of the method about to execute a new instruction12056</description>12057</param>12058<param id="method">12059<jmethodID class="klass"/>12060<description>12061Method about to execute a new instruction12062</description>12063</param>12064<param id="location">12065<jlocation/>12066<description>12067Location of the new instruction12068</description>12069</param>12070</parameters>12071</event>1207212073<event label="Breakpoint"12074id="Breakpoint" const="JVMTI_EVENT_BREAKPOINT" filtered="thread" num="62">12075<description>12076Breakpoint events are generated whenever a thread reaches a location12077designated as a breakpoint with <functionlink id="SetBreakpoint"></functionlink>.12078The <code>method</code> and <code>location</code>12079parameters uniquely identify the current location and allow12080the mapping to source file and line number when that information is12081available.12082</description>12083<origin>jvmdi</origin>12084<capabilities>12085<required id="can_generate_breakpoint_events"></required>12086</capabilities>12087<parameters>12088<param id="jni_env">12089<outptr>12090<struct>JNIEnv</struct>12091</outptr>12092<description>12093The JNI environment of the event (current) thread.12094</description>12095</param>12096<param id="thread">12097<jthread/>12098<description>12099Thread that hit the breakpoint12100</description>12101</param>12102<param id="klass">12103<jclass method="method"/>12104<description>12105Class of the method that hit the breakpoint12106</description>12107</param>12108<param id="method">12109<jmethodID class="klass"/>12110<description>12111Method that hit the breakpoint12112</description>12113</param>12114<param id="location">12115<jlocation/>12116<description>12117location of the breakpoint12118</description>12119</param>12120</parameters>12121</event>1212212123<event label="Field Access"12124id="FieldAccess" const="JVMTI_EVENT_FIELD_ACCESS" filtered="thread" num="63">12125<description>12126Field access events are generated whenever a thread accesses12127a field that was designated as a watchpoint12128with <functionlink id="SetFieldAccessWatch"></functionlink>.12129The <code>method</code> and <code>location</code>12130parameters uniquely identify the current location and allow12131the mapping to source file and line number when that information is12132available.12133</description>12134<origin>jvmdi</origin>12135<capabilities>12136<required id="can_generate_field_access_events"></required>12137</capabilities>12138<parameters>12139<param id="jni_env">12140<outptr>12141<struct>JNIEnv</struct>12142</outptr>12143<description>12144The JNI environment of the event (current) thread12145</description>12146</param>12147<param id="thread">12148<jthread/>12149<description>12150Thread accessing the field12151</description>12152</param>12153<param id="klass">12154<jclass method="method"/>12155<description>12156Class of the method where the access is occurring12157</description>12158</param>12159<param id="method">12160<jmethodID class="klass"/>12161<description>12162Method where the access is occurring12163</description>12164</param>12165<param id="location">12166<jlocation/>12167<description>12168Location where the access is occurring12169</description>12170</param>12171<param id="field_klass">12172<jclass field="field"/>12173<description>12174Class of the field being accessed12175</description>12176</param>12177<param id="object">12178<jobject/>12179<description>12180Object with the field being accessed if the field is an12181instance field; <code>NULL</code> otherwise12182</description>12183</param>12184<param id="field">12185<jfieldID class="field_klass"/>12186<description>12187Field being accessed12188</description>12189</param>12190</parameters>12191</event>1219212193<event label="Field Modification"12194id="FieldModification" const="JVMTI_EVENT_FIELD_MODIFICATION" filtered="thread" num="64">12195<description>12196Field modification events are generated whenever a thread modifies12197a field that was designated as a watchpoint12198with <functionlink id="SetFieldModificationWatch"></functionlink>.12199The <code>method</code> and <code>location</code>12200parameters uniquely identify the current location and allow12201the mapping to source file and line number when that information is12202available.12203</description>12204<origin>jvmdi</origin>12205<capabilities>12206<required id="can_generate_field_modification_events"></required>12207</capabilities>12208<parameters>12209<param id="jni_env">12210<outptr>12211<struct>JNIEnv</struct>12212</outptr>12213<description>12214The JNI environment of the event (current) thread12215</description>12216</param>12217<param id="thread">12218<jthread/>12219<description>12220Thread modifying the field12221</description>12222</param>12223<param id="klass">12224<jclass method="method"/>12225<description>12226Class of the method where the modification is occurring12227</description>12228</param>12229<param id="method">12230<jmethodID class="klass"/>12231<description>12232Method where the modification is occurring12233</description>12234</param>12235<param id="location">12236<jlocation/>12237<description>12238Location where the modification is occurring12239</description>12240</param>12241<param id="field_klass">12242<jclass field="field"/>12243<description>12244Class of the field being modified12245</description>12246</param>12247<param id="object">12248<jobject/>12249<description>12250Object with the field being modified if the field is an12251instance field; <code>NULL</code> otherwise12252</description>12253</param>12254<param id="field">12255<jfieldID class="field_klass"/>12256<description>12257Field being modified12258</description>12259</param>12260<param id="signature_type">12261<char/>12262<description>12263Signature type of the new value12264</description>12265</param>12266<param id="new_value">12267<jvalue/>12268<description>12269The new value12270</description>12271</param>12272</parameters>12273</event>1227412275<event label="Frame Pop"12276id="FramePop" const="JVMTI_EVENT_FRAME_POP" filtered="thread" num="61">12277<description>12278Frame pop events are generated upon exit from a single method12279in a single frame as specified12280in a call to <functionlink id="NotifyFramePop"></functionlink>.12281This is true whether termination is caused by12282executing its return instruction12283or by throwing an exception to its caller12284(see <paramlink id="was_popped_by_exception"></paramlink>).12285However, frame pops caused by the <functionlink id="PopFrame"/>12286function are not reported.12287<p/>12288The location reported by <functionlink id="GetFrameLocation"></functionlink>12289for the depth 0 identifies the executable location in the returning method,12290immediately prior to the return.12291</description>12292<origin>jvmdi</origin>12293<capabilities>12294<required id="can_generate_frame_pop_events"></required>12295</capabilities>12296<parameters>12297<param id="jni_env">12298<outptr>12299<struct>JNIEnv</struct>12300</outptr>12301<description>12302The JNI environment of the event (current) thread12303</description>12304</param>12305<param id="thread">12306<jthread/>12307<description>12308Thread that is popping the frame12309</description>12310</param>12311<param id="klass">12312<jclass method="method"/>12313<description>12314Class of the method being popped12315</description>12316</param>12317<param id="method">12318<jmethodID class="klass"/>12319<description>12320Method being popped12321</description>12322</param>12323<param id="was_popped_by_exception">12324<jboolean/>12325<description>12326True if frame was popped by a thrown exception.12327False if method exited through its return instruction.12328</description>12329</param>12330</parameters>12331</event>1233212333<event label="Method Entry"12334id="MethodEntry" const="JVMTI_EVENT_METHOD_ENTRY" filtered="thread" num="65">12335<description>12336Method entry events are generated upon entry of Java12337programming language methods (including native methods).12338<p/>12339The location reported by <functionlink id="GetFrameLocation"></functionlink>12340for the depth 0 identifies the initial executable location in the method.12341<p/>12342Enabling method12343entry or exit events will significantly degrade performance on many platforms and is thus12344not advised for performance critical usage (such as profiling).12345<internallink id="bci">Bytecode instrumentation</internallink> should be12346used in these cases.12347</description>12348<origin>jvmdi</origin>12349<capabilities>12350<required id="can_generate_method_entry_events"></required>12351</capabilities>12352<parameters>12353<param id="jni_env">12354<outptr>12355<struct>JNIEnv</struct>12356</outptr>12357<description>12358The JNI environment of the event (current) thread12359</description>12360</param>12361<param id="thread">12362<jthread/>12363<description>12364Thread entering the method12365</description>12366</param>12367<param id="klass">12368<jclass method="method"/>12369<description>12370Class of the method being entered12371</description>12372</param>12373<param id="method">12374<jmethodID class="klass"/>12375<description>12376Method being entered12377</description>12378</param>12379</parameters>12380</event>1238112382<event label="Method Exit"12383id="MethodExit" const="JVMTI_EVENT_METHOD_EXIT" filtered="thread" num="66">12384<description>12385Method exit events are generated upon exit from Java12386programming language methods (including native methods).12387This is true whether termination is caused by12388executing its return instruction12389or by throwing an exception to its caller12390(see <paramlink id="was_popped_by_exception"></paramlink>).12391<p/>12392The location reported by <functionlink id="GetFrameLocation"></functionlink>12393for the depth 0 identifies the executable location in the returning method12394immediately prior to the return.12395<p/>12396Enabling method12397entry or exit events will significantly degrade performance on many platforms and is thus12398not advised for performance critical usage (such as profiling).12399<internallink id="bci">Bytecode instrumentation</internallink> should be12400used in these cases.12401</description>12402<origin>jvmdi</origin>12403<capabilities>12404<required id="can_generate_method_exit_events"></required>12405</capabilities>12406<parameters>12407<param id="jni_env">12408<outptr>12409<struct>JNIEnv</struct>12410</outptr>12411<description>12412The JNI environment of the event (current) thread12413</description>12414</param>12415<param id="thread">12416<jthread/>12417<description>12418Thread exiting the method12419</description>12420</param>12421<param id="klass">12422<jclass method="method"/>12423<description>12424Class of the method being exited12425</description>12426</param>12427<param id="method">12428<jmethodID class="klass"/>12429<description>12430Method being exited12431</description>12432</param>12433<param id="was_popped_by_exception">12434<jboolean/>12435<description>12436True if frame was popped by a thrown exception.12437False if method exited through its return instruction.12438</description>12439</param>12440<param id="return_value">12441<jvalue/>12442<description>12443The return value of the method being exited.12444Undefined and should not be used if12445<paramlink id="was_popped_by_exception"></paramlink>12446is true.12447</description>12448</param>12449</parameters>12450</event>1245112452<event label="Native Method Bind" phase="any"12453id="NativeMethodBind" const="JVMTI_EVENT_NATIVE_METHOD_BIND" num="67">12454<description>12455A Native Method Bind event is sent when a VM binds a12456Java programming language native method12457to the address of a function that implements the native method.12458This will occur when the native method is called for the first time12459and also occurs when the JNI function <code>RegisterNatives</code> is called.12460This event allows the bind to be redirected to an agent-specified12461proxy function.12462This event is not sent when the native method is unbound.12463Typically, this proxy function will need to be specific to a12464particular method or, to handle the general case, automatically12465generated assembly code, since after instrumentation code is12466executed the function at the original binding12467address will usually be invoked.12468The original binding can be restored or the redirection changed12469by use of the JNI function <code>RegisterNatives</code>.12470Some events may be sent during the primordial phase, JNI and12471most of <jvmti/> cannot be used at this time but the method and12472address can be saved for use later.12473</description>12474<origin>new</origin>12475<capabilities>12476<required id="can_generate_native_method_bind_events"></required>12477</capabilities>12478<parameters>12479<param id="jni_env">12480<outptr>12481<struct>JNIEnv</struct>12482</outptr>12483<description>12484The JNI environment of the event (current) thread12485Will be <code>NULL</code> if sent during the primordial12486<functionlink id="GetPhase">phase</functionlink>.12487</description>12488</param>12489<param id="thread">12490<jthread/>12491<description>12492Thread requesting the bind12493</description>12494</param>12495<param id="klass">12496<jclass method="method"/>12497<description>12498Class of the method being bound12499</description>12500</param>12501<param id="method">12502<jmethodID class="klass"/>12503<description>12504Native method being bound12505</description>12506</param>12507<param id="address">12508<outptr><void/></outptr>12509<description>12510The address the VM is about to bind to--that is, the12511address of the implementation of the native method12512</description>12513</param>12514<param id="new_address_ptr">12515<agentbuf><void/></agentbuf>12516<description>12517if the referenced address is changed (that is, if12518<code>*new_address_ptr</code> is set), the binding12519will instead be made to the supplied address.12520</description>12521</param>12522</parameters>12523</event>1252412525<event label="Exception"12526id="Exception" const="JVMTI_EVENT_EXCEPTION" filtered="thread" num="58">12527<description>12528Exception events are generated whenever an exception is first detected12529in a Java programming language method.12530Where "exception" means any <code>java.lang.Throwable</code>.12531The exception may have been thrown by a Java programming language or native12532method, but in the case of native methods, the event is not generated12533until the exception is first seen by a Java programming language method. If an exception is12534set and cleared in a native method (and thus is never visible to Java programming language code),12535no exception event is generated.12536<p/>12537The <code>method</code> and <code>location</code>12538parameters uniquely identify the current location12539(where the exception was detected) and allow12540the mapping to source file and line number when that information is12541available. The <code>exception</code> field identifies the thrown12542exception object. The <code>catch_method</code>12543and <code>catch_location</code> identify the location of the catch clause,12544if any, that handles the thrown exception. If there is no such catch clause,12545each field is set to 0. There is no guarantee that the thread will ever12546reach this catch clause. If there are native methods on the call stack12547between the throw location and the catch clause, the exception may12548be reset by one of those native methods.12549Similarly, exceptions that are reported as uncaught (<code>catch_klass</code>12550et al. set to 0) may in fact be caught by native code.12551Agents can check for these occurrences by monitoring12552<eventlink id="ExceptionCatch"></eventlink> events.12553Note that finally clauses are implemented as catch and re-throw. Therefore they12554will be reported in the catch location.12555</description>12556<origin>jvmdi</origin>12557<capabilities>12558<required id="can_generate_exception_events"></required>12559</capabilities>12560<parameters>12561<param id="jni_env">12562<outptr>12563<struct>JNIEnv</struct>12564</outptr>12565<description>12566The JNI environment of the event (current) thread12567</description>12568</param>12569<param id="thread">12570<jthread/>12571<description>12572Thread generating the exception12573</description>12574</param>12575<param id="klass">12576<jclass method="method"/>12577<description>12578Class generating the exception12579</description>12580</param>12581<param id="method">12582<jmethodID class="klass"/>12583<description>12584Method generating the exception12585</description>12586</param>12587<param id="location">12588<jlocation/>12589<description>12590Location where exception occurred12591</description>12592</param>12593<param id="exception">12594<jobject/>12595<description>12596The exception being thrown12597</description>12598</param>12599<param id="catch_klass">12600<jclass method="catch_method"/>12601<description>12602Class that will catch the exception, or <code>NULL</code> if no known catch12603</description>12604</param>12605<param id="catch_method">12606<jmethodID class="catch_klass"/>12607<description>12608Method that will catch the exception, or <code>NULL</code> if no known catch12609</description>12610</param>12611<param id="catch_location">12612<jlocation/>12613<description>12614location which will catch the exception or zero if no known catch12615</description>12616</param>12617</parameters>12618</event>1261912620<event label="Exception Catch"12621id="ExceptionCatch" const="JVMTI_EVENT_EXCEPTION_CATCH" filtered="thread" num="59">12622<description>12623Exception catch events are generated whenever a thrown exception is caught.12624Where "exception" means any <code>java.lang.Throwable</code>.12625If the exception is caught in a Java programming language method, the event is generated12626when the catch clause is reached. If the exception is caught in a native12627method, the event is generated as soon as control is returned to a Java programming language12628method. Exception catch events are generated for any exception for which12629a throw was detected in a Java programming language method.12630Note that finally clauses are implemented as catch and re-throw. Therefore they12631will generate exception catch events.12632<p/>12633The <code>method</code> and <code>location</code>12634parameters uniquely identify the current location12635and allow the mapping to source file and line number when that information is12636available. For exceptions caught in a Java programming language method, the12637<code>exception</code> object identifies the exception object. Exceptions12638caught in native methods are not necessarily available by the time the12639exception catch is reported, so the <code>exception</code> field is set12640to <code>NULL</code>.12641</description>12642<origin>jvmdi</origin>12643<capabilities>12644<required id="can_generate_exception_events"></required>12645</capabilities>12646<parameters>12647<param id="jni_env">12648<outptr>12649<struct>JNIEnv</struct>12650</outptr>12651<description>12652The JNI environment of the event (current) thread12653</description>12654</param>12655<param id="thread">12656<jthread/>12657<description>12658Thread catching the exception12659</description>12660</param>12661<param id="klass">12662<jclass method="method"/>12663<description>12664Class catching the exception12665</description>12666</param>12667<param id="method">12668<jmethodID class="klass"/>12669<description>12670Method catching the exception12671</description>12672</param>12673<param id="location">12674<jlocation/>12675<description>12676Location where exception is being caught12677</description>12678</param>12679<param id="exception">12680<jobject/>12681<description>12682Exception being caught12683</description>12684</param>12685</parameters>12686</event>1268712688<event label="Thread Start"12689id="ThreadStart" const="JVMTI_EVENT_THREAD_START" num="52" phase="start">12690<description>12691Thread start events are generated by a new thread before its initial12692method executes.12693<p/>12694A thread may be listed in the array returned by12695<functionlink id="GetAllThreads"></functionlink>12696before its thread start event is generated.12697It is possible for other events to be generated12698on a thread before its thread start event.12699<p/>12700The event is sent on the newly started <paramlink id="thread"></paramlink>.12701</description>12702<origin>jvmdi</origin>12703<capabilities>12704</capabilities>12705<parameters>12706<param id="jni_env">12707<outptr>12708<struct>JNIEnv</struct>12709</outptr>12710<description>12711The JNI environment of the event (current) thread.12712</description>12713</param>12714<param id="thread">12715<jthread/>12716<description>12717Thread starting12718</description>12719</param>12720</parameters>12721</event>1272212723<event label="Thread End"12724id="ThreadEnd" const="JVMTI_EVENT_THREAD_END" filtered="thread" num="53" phase="start">12725<description>12726Thread end events are generated by a terminating thread12727after its initial method has finished execution.12728<p/>12729A thread may be listed in the array returned by12730<functionlink id="GetAllThreads"></functionlink>12731after its thread end event is generated.12732No events are generated on a thread12733after its thread end event.12734<p/>12735The event is sent on the dying <paramlink id="thread"></paramlink>.12736</description>12737<origin>jvmdi</origin>12738<capabilities>12739</capabilities>12740<parameters>12741<param id="jni_env">12742<outptr>12743<struct>JNIEnv</struct>12744</outptr>12745<description>12746The JNI environment of the event (current) thread.12747</description>12748</param>12749<param id="thread">12750<jthread/>12751<description>12752Thread ending12753</description>12754</param>12755</parameters>12756</event>1275712758<event label="Class Load"12759id="ClassLoad" const="JVMTI_EVENT_CLASS_LOAD" filtered="thread" phase="start" num="55">12760<description>12761A class load event is generated12762<functionlink id="GetLoadedClasses">when a class or interface is created.</functionlink>.12763<p/>12764Array class creation does not generate a class load event.12765The creation of a primitive class (for example, java.lang.Integer.TYPE)12766does not generate a class load event.12767<p/>12768The order of class load events generated by a particular thread is guaranteed12769to match the order of class loading within that thread.12770<p/>12771This event is sent at an early stage in loading the class. As12772a result the class should be used carefully. Note, for example,12773that methods and fields are not yet loaded, so queries for methods,12774fields, subclasses, and so on will not give correct results.12775See "Loading of Classes and Interfaces" in the <i>Java Language12776Specification</i>. For most12777purposes the <eventlink id="ClassPrepare"></eventlink> event will12778be more useful.12779</description>12780<origin>jvmdi</origin>12781<capabilities>12782</capabilities>12783<parameters>12784<param id="jni_env">12785<outptr>12786<struct>JNIEnv</struct>12787</outptr>12788<description>12789The JNI environment of the event (current) thread12790</description>12791</param>12792<param id="thread">12793<jthread/>12794<description>12795Thread loading the class12796</description>12797</param>12798<param id="klass">12799<jclass/>12800<description>12801Class being loaded12802</description>12803</param>12804</parameters>12805</event>1280612807<elide>12808<event label="Class Unload"12809id="ClassUnload" const="JVMTI_EVENT_CLASS_UNLOAD" num="57">12810<description>12811A class unload event is generated when the class is about to be unloaded.12812Class unload events take place during garbage collection and must be12813handled extremely carefully. The garbage collector holds many locks12814and has suspended all other threads, so the event handler cannot depend12815on the ability to acquire any locks. The class unload event handler should12816do as little as possible, perhaps by queuing information to be processed12817later. In particular, the <code>jclass</code> should be used only in12818the JNI function <code>isSameObject</code> or in the following <jvmti/> functions:12819<ul>12820<li><functionlink id="GetClassSignature"></functionlink></li>12821<li><functionlink id="GetSourceFileName"></functionlink></li>12822<li><functionlink id="IsInterface"></functionlink></li>12823<li><functionlink id="IsArrayClass"></functionlink></li>12824</ul>12825</description>12826<origin>jvmdi</origin>12827<capabilities>12828</capabilities>12829<parameters>12830<param id="jni_env">12831<outptr>12832<struct>JNIEnv</struct>12833</outptr>12834<description>12835The JNI environment of the event (current) thread12836</description>12837</param>12838<param id="thread">12839<jthread/>12840<description>12841Thread generating the class unload12842</description>12843</param>12844<param id="klass">12845<jclass/>12846<description>12847Class being unloaded12848</description>12849</param>12850</parameters>12851</event>12852</elide>1285312854<event label="Class Prepare"12855id="ClassPrepare" const="JVMTI_EVENT_CLASS_PREPARE" filtered="thread" phase="start" num="56">12856<description>12857A class prepare event is generated when class preparation is complete.12858At this point, class fields, methods, and implemented interfaces are12859available, and no code from the class has been executed. Since array12860classes never have fields or methods, class prepare events are not12861generated for them. Class prepare events are not generated for12862primitive classes (for example, <code>java.lang.Integer.TYPE</code>).12863</description>12864<origin>jvmdi</origin>12865<capabilities>12866</capabilities>12867<parameters>12868<param id="jni_env">12869<outptr>12870<struct>JNIEnv</struct>12871</outptr>12872<description>12873The JNI environment of the event (current) thread12874</description>12875</param>12876<param id="thread">12877<jthread/>12878<description>12879Thread generating the class prepare12880</description>12881</param>12882<param id="klass">12883<jclass/>12884<description>12885Class being prepared12886</description>12887</param>12888</parameters>12889</event>1289012891<event label="Class File Load Hook" phase="any"12892id="ClassFileLoadHook" const="JVMTI_EVENT_CLASS_FILE_LOAD_HOOK" num="54">12893<description>12894This event is sent when the VM obtains class file data,12895but before it constructs12896the in-memory representation for that class.12897This event is also sent when the class is being modified by the12898<functionlink id="RetransformClasses"/> function or12899the <functionlink id="RedefineClasses"/> function,12900called in any <jvmti/> environment.12901The agent can instrument12902the existing class file data sent by the VM to include profiling/debugging hooks.12903See the description of12904<internallink id="bci">bytecode instrumentation</internallink>12905for usage information.12906<p/>12907When the capabilities12908<internallink id="jvmtiCapabilities.can_generate_early_class_hook_events">12909<code>can_generate_early_class_hook_events</code></internallink> and12910<internallink id="jvmtiCapabilities.can_generate_all_class_hook_events">12911<code>can_generate_all_class_hook_events</code></internallink>12912are enabled then this event may be sent in the primordial phase.12913Otherwise, this event may be sent before the VM is initialized (the start12914<functionlink id="GetPhase">phase</functionlink>).12915Some classes might not be compatible12916with the function (eg. ROMized classes or implementation defined classes) and this event will12917not be generated for these classes.12918<p/>12919The agent must allocate the space for the modified12920class file data buffer12921using the memory allocation function12922<functionlink id="Allocate"></functionlink> because the12923VM is responsible for freeing the new class file data buffer12924using <functionlink id="Deallocate"></functionlink>.12925<p/>12926If the agent wishes to modify the class file, it must set12927<code>new_class_data</code> to point12928to the newly instrumented class file data buffer and set12929<code>new_class_data_len</code> to the length of that12930buffer before returning12931from this call. If no modification is desired, the agent simply12932does not set <code>new_class_data</code>. If multiple agents12933have enabled this event the results are chained. That is, if12934<code>new_class_data</code> has been set, it becomes the12935<code>class_data</code> for the next agent.12936<p/>12937When handling a class load in the live phase, then the12938<functionlink id="GetNamedModule"></functionlink>12939function can be used to map class loader and a package name to a module.12940When a class is being redefined or retransformed then12941<code>class_being_redefined</code> is non <code>NULL</code> and so12942the JNI <code>GetModule</code> function can also be used12943to obtain the Module.12944<p/>12945The order that this event is sent to each environment differs12946from other events.12947This event is sent to environments in the following order:12948<ul>12949<li><fieldlink id="can_retransform_classes"12950struct="jvmtiCapabilities">retransformation12951incapable</fieldlink>12952environments, in the12953order in which they were created12954</li>12955<li><fieldlink id="can_retransform_classes"12956struct="jvmtiCapabilities">retransformation12957capable</fieldlink>12958environments, in the12959order in which they were created12960</li>12961</ul>12962When triggered by <functionlink id="RetransformClasses"/>,12963this event is sent only to <fieldlink id="can_retransform_classes"12964struct="jvmtiCapabilities">retransformation12965capable</fieldlink>12966environments.12967</description>12968<origin>jvmpi</origin>12969<capabilities>12970<capability id="can_generate_all_class_hook_events"></capability>12971<capability id="can_generate_early_class_hook_events"></capability>12972</capabilities>12973<parameters>12974<param id="jni_env">12975<outptr>12976<struct>JNIEnv</struct>12977</outptr>12978<description>12979The JNI environment of the event (current) thread.12980</description>12981</param>12982<param id="class_being_redefined">12983<jclass/>12984<description>12985The class being12986<functionlink id="RedefineClasses">redefined</functionlink> or12987<functionlink id="RetransformClasses">retransformed</functionlink>.12988<code>NULL</code> if sent by class load.12989</description>12990</param>12991<param id="loader">12992<jobject/>12993<description>12994The class loader loading the class.12995<code>NULL</code> if the bootstrap class loader.12996</description>12997</param>12998<param id="name">12999<vmbuf><char/></vmbuf>13000<description>13001Name of class being loaded as a VM internal qualified name13002(for example, "java/util/List"), encoded as a13003<internallink id="mUTF">modified UTF-8</internallink> string.13004Note: if the class is defined with a <code>NULL</code> name or13005without a name specified, <code>name</code> will be <code>NULL</code>.13006</description>13007</param>13008<param id="protection_domain">13009<jobject/>13010<description>13011The <code>ProtectionDomain</code> of the class.13012</description>13013</param>13014<param id="class_data_len">13015<jint/>13016<description>13017Length of current class file data buffer.13018</description>13019</param>13020<param id="class_data">13021<vmbuf><uchar/></vmbuf>13022<description>13023Pointer to the current class file data buffer.13024</description>13025</param>13026<param id="new_class_data_len">13027<outptr><jint/></outptr>13028<description>13029Pointer to the length of the new class file data buffer.13030</description>13031</param>13032<param id="new_class_data">13033<agentbuf incount="new_class_data_len"><uchar/></agentbuf>13034<description>13035Pointer to the pointer to the instrumented class file data buffer.13036</description>13037</param>13038</parameters>13039</event>1304013041<event label="VM Start Event"13042id="VMStart" const="JVMTI_EVENT_VM_START" num="57" phase="start">13043<description>13044The VM start event signals the start of the VM.13045At this time JNI is live but the VM is not yet fully initialized.13046Once this event is generated, the agent is free to call any JNI function.13047This event signals the beginning of the start phase,13048<jvmti/> functions permitted in the start phase may be called.13049<p/>13050The timing of this event may depend on whether the agent has added the13051<internallink id="jvmtiCapabilities.can_generate_early_vmstart">13052<code>can_generate_early_vmstart</code></internallink> capability or not.13053If the capability has been added then the VM posts the event as early13054as possible. The VM is capable of executing bytecode but it may not have13055initialized to the point where it can load classes in modules other than13056<code>java.base</code>, or even arbitrary classes in <code>java.base</code>.13057Agents that do load-time instrumentation in this13058phase must take great care when instrumenting code that potentially13059executes in this phase. Extreme care should also be taken with JNI13060<code>FindClass</code> as it may not be possible to load classes and attempts13061to do so may result in unpredictable behavior, maybe even stability issues13062on some VM implementations.13063If the capability has not been added then the VM delays posting this13064event until it is capable of loading classes in modules other than13065<code>java.base</code> or the VM has completed its initialization.13066Agents that create more than one JVM TI environment, where the13067capability is added to some but not all environments, may observe the13068start phase beginning earlier in the JVM TI environments that possess13069the capability.13070<p/>13071In the case of VM start-up failure, this event will not be sent.13072</description>13073<origin>jvmdi</origin>13074<capabilities>13075</capabilities>13076<parameters>13077<param id="jni_env">13078<outptr>13079<struct>JNIEnv</struct>13080</outptr>13081<description>13082The JNI environment of the event (current) thread.13083</description>13084</param>13085</parameters>13086</event>1308713088<event label="VM Initialization Event"13089id="VMInit" const="JVMTI_EVENT_VM_INIT" num="50">13090<description>13091The VM initialization event signals the completion of VM initialization. Once13092this event is generated, the agent is free to call any JNI or <jvmti/>13093function. The VM initialization event can be preceded by or can be concurrent13094with other events, but13095the preceding events should be handled carefully, if at all, because the13096VM has not completed its initialization. The thread start event for the13097main application thread is guaranteed not to occur until after the13098handler for the VM initialization event returns.13099<p/>13100In the case of VM start-up failure, this event will not be sent.13101</description>13102<origin>jvmdi</origin>13103<capabilities>13104</capabilities>13105<parameters>13106<param id="jni_env">13107<outptr>13108<struct>JNIEnv</struct>13109</outptr>13110<description>13111The JNI environment of the event (current) thread.13112</description>13113</param>13114<param id="thread">13115<jthread/>13116<description>13117The initial thread13118</description>13119</param>13120</parameters>13121</event>1312213123<event label="VM Death Event"13124id="VMDeath" const="JVMTI_EVENT_VM_DEATH" num="51">13125<description>13126The VM death event notifies the agent of the termination of the VM.13127No events will occur after the VMDeath event.13128<p/>13129In the case of VM start-up failure, this event will not be sent.13130Note that <internallink id="onunload">Agent_OnUnload</internallink>13131will still be called in these cases.13132</description>13133<origin>jvmdi</origin>13134<capabilities>13135</capabilities>13136<parameters>13137<param id="jni_env">13138<outptr>13139<struct>JNIEnv</struct>13140</outptr>13141<description>13142The JNI environment of the event (current) thread13143</description>13144</param>13145</parameters>13146</event>1314713148<event label="Compiled Method Load" phase="start"13149id="CompiledMethodLoad" const="JVMTI_EVENT_COMPILED_METHOD_LOAD" num="68">13150<description>13151Sent when a method is compiled and loaded into memory by the VM.13152If it is unloaded, the <eventlink id="CompiledMethodUnload"/> event is sent.13153If it is moved, the <eventlink id="CompiledMethodUnload"/> event is sent,13154followed by a new <code>CompiledMethodLoad</code> event.13155Note that a single method may have multiple compiled forms, and that13156this event will be sent for each form.13157Note also that several methods may be inlined into a single13158address range, and that this event will be sent for each method.13159<p/>13160These events can be sent after their initial occurrence with13161<functionlink id="GenerateEvents"></functionlink>.13162</description>13163<origin>jvmpi</origin>13164<typedef id="jvmtiAddrLocationMap" label="Native address to location entry">13165<field id="start_address">13166<vmbuf><void/></vmbuf>13167<description>13168Starting native address of code corresponding to a location13169</description>13170</field>13171<field id="location">13172<jlocation/>13173<description>13174Corresponding location. See13175<functionlink id="GetJLocationFormat"></functionlink>13176for the meaning of location.13177</description>13178</field>13179</typedef>13180<capabilities>13181<required id="can_generate_compiled_method_load_events"></required>13182</capabilities>13183<parameters>13184<param id="klass">13185<jclass method="method"/>13186<description>13187Class of the method being compiled and loaded13188</description>13189</param>13190<param id="method">13191<jmethodID class="klass"/>13192<description>13193Method being compiled and loaded13194</description>13195</param>13196<param id="code_size">13197<jint/>13198<description>13199Size of compiled code13200</description>13201</param>13202<param id="code_addr">13203<vmbuf><void/></vmbuf>13204<description>13205Address where compiled method code is loaded13206</description>13207</param>13208<param id="map_length">13209<jint/>13210<description>13211Number of <typelink id="jvmtiAddrLocationMap"></typelink>13212entries in the address map.13213Zero if mapping information cannot be supplied.13214</description>13215</param>13216<param id="map">13217<vmbuf><struct>jvmtiAddrLocationMap</struct></vmbuf>13218<description>13219Map from native addresses to location.13220The native address range of each entry is from13221<fieldlink id="start_address" struct="jvmtiAddrLocationMap"></fieldlink>13222to <code>start_address-1</code> of the next entry.13223<code>NULL</code> if mapping information cannot be supplied.13224</description>13225</param>13226<param id="compile_info">13227<vmbuf><void/></vmbuf>13228<description>13229VM-specific compilation information.13230The referenced compile information is managed by the VM13231and must not depend on the agent for collection.13232A VM implementation defines the content and lifetime13233of the information.13234</description>13235</param>13236</parameters>13237</event>1323813239<event label="Compiled Method Unload" phase="start"13240id="CompiledMethodUnload" const="JVMTI_EVENT_COMPILED_METHOD_UNLOAD" num="69">13241<description>13242Sent when a compiled method is unloaded from memory.13243This event might not be sent on the thread which performed the unload.13244This event may be sent sometime after the unload occurs, but13245will be sent before the memory is reused13246by a newly generated compiled method. This event may be sent after13247the class is unloaded.13248</description>13249<origin>jvmpi</origin>13250<capabilities>13251<required id="can_generate_compiled_method_load_events"></required>13252</capabilities>13253<parameters>13254<param id="klass">13255<jclass method="method"/>13256<description>13257Class of the compiled method being unloaded.13258</description>13259</param>13260<param id="method">13261<jmethodID class="klass"/>13262<description>13263Compiled method being unloaded.13264For identification of the compiled method only -- the class13265may be unloaded and therefore the method should not be used13266as an argument to further JNI or <jvmti/> functions.13267</description>13268</param>13269<param id="code_addr">13270<vmbuf><void/></vmbuf>13271<description>13272Address where compiled method code was loaded.13273For identification of the compiled method only --13274the space may have been reclaimed.13275</description>13276</param>13277</parameters>13278</event>1327913280<event label="Dynamic Code Generated" phase="any"13281id="DynamicCodeGenerated" const="JVMTI_EVENT_DYNAMIC_CODE_GENERATED" num="70">13282<description>13283Sent when a component of the virtual machine is generated dynamically.13284This does not correspond to Java programming language code that is13285compiled--see <eventlink id="CompiledMethodLoad"></eventlink>.13286This is for native code--for example, an interpreter that is generated13287differently depending on command-line options.13288<p/>13289Note that this event has no controlling capability.13290If a VM cannot generate these events, it simply does not send any.13291<p/>13292These events can be sent after their initial occurrence with13293<functionlink id="GenerateEvents"></functionlink>.13294</description>13295<origin>jvmpi</origin>13296<capabilities>13297</capabilities>13298<parameters>13299<param id="name">13300<vmbuf><char/></vmbuf>13301<description>13302Name of the code, encoded as a13303<internallink id="mUTF">modified UTF-8</internallink> string.13304Intended for display to an end-user.13305The name might not be unique.13306</description>13307</param>13308<param id="address">13309<vmbuf><void/></vmbuf>13310<description>13311Native address of the code13312</description>13313</param>13314<param id="length">13315<jint/>13316<description>13317Length in bytes of the code13318</description>13319</param>13320</parameters>13321</event>1332213323<event label="Data Dump Request"13324id="DataDumpRequest" const="JVMTI_EVENT_DATA_DUMP_REQUEST" num="71">13325<description>13326Sent by the VM to request the agent to dump its data. This13327is just a hint and the agent need not react to this event.13328This is useful for processing command-line signals from users. For13329example, in the Java 2 SDK a CTRL-Break on Win32 and a CTRL-\ on Linux13330causes the VM to send this event to the agent.13331</description>13332<origin>jvmpi</origin>13333<capabilities>13334</capabilities>13335<parameters>13336</parameters>13337</event>1333813339<event label="Monitor Contended Enter"13340id="MonitorContendedEnter" const="JVMTI_EVENT_MONITOR_CONTENDED_ENTER" filtered="thread" num="75">13341<description>13342Sent when a thread is attempting to enter a Java programming language13343monitor already acquired by another thread.13344</description>13345<origin>jvmpi</origin>13346<capabilities>13347<required id="can_generate_monitor_events"></required>13348</capabilities>13349<parameters>13350<param id="jni_env">13351<outptr>13352<struct>JNIEnv</struct>13353</outptr>13354<description>13355The JNI environment of the event (current) thread13356</description>13357</param>13358<param id="thread">13359<jthread/>13360<description>13361JNI local reference to the thread13362attempting to enter the monitor13363</description>13364</param>13365<param id="object">13366<jobject/>13367<description>13368JNI local reference to the monitor13369</description>13370</param>13371</parameters>13372</event>1337313374<event label="Monitor Contended Entered"13375id="MonitorContendedEntered" const="JVMTI_EVENT_MONITOR_CONTENDED_ENTERED" filtered="thread" num="76">13376<description>13377Sent when a thread enters a Java programming language13378monitor after waiting for it to be released by another thread.13379</description>13380<origin>jvmpi</origin>13381<capabilities>13382<required id="can_generate_monitor_events"></required>13383</capabilities>13384<parameters>13385<param id="jni_env">13386<outptr>13387<struct>JNIEnv</struct>13388</outptr>13389<description>13390The JNI environment of the event (current) thread13391</description>13392</param>13393<param id="thread">13394<jthread/>13395<description>13396JNI local reference to the thread entering13397the monitor13398</description>13399</param>13400<param id="object">13401<jobject/>13402<description>13403JNI local reference to the monitor13404</description>13405</param>13406</parameters>13407</event>1340813409<event label="Monitor Wait"13410id="MonitorWait" const="JVMTI_EVENT_MONITOR_WAIT" filtered="thread" num="73">13411<description>13412Sent when a thread is about to wait on an object.13413</description>13414<origin>jvmpi</origin>13415<capabilities>13416<required id="can_generate_monitor_events"></required>13417</capabilities>13418<parameters>13419<param id="jni_env">13420<outptr>13421<struct>JNIEnv</struct>13422</outptr>13423<description>13424The JNI environment of the event (current) thread13425</description>13426</param>13427<param id="thread">13428<jthread/>13429<description>13430JNI local reference to the thread about to wait13431</description>13432</param>13433<param id="object">13434<jobject/>13435<description>13436JNI local reference to the monitor13437</description>13438</param>13439<param id="timeout">13440<jlong/>13441<description>13442The number of milliseconds the thread will wait13443</description>13444</param>13445</parameters>13446</event>1344713448<event label="Monitor Waited"13449id="MonitorWaited" const="JVMTI_EVENT_MONITOR_WAITED" filtered="thread" num="74">13450<description>13451Sent when a thread finishes waiting on an object.13452</description>13453<origin>jvmpi</origin>13454<capabilities>13455<required id="can_generate_monitor_events"></required>13456</capabilities>13457<parameters>13458<param id="jni_env">13459<outptr>13460<struct>JNIEnv</struct>13461</outptr>13462<description>13463The JNI environment of the event (current) thread13464</description>13465</param>13466<param id="thread">13467<jthread/>13468<description>13469JNI local reference to the thread that was finished waiting13470</description>13471</param>13472<param id="object">13473<jobject/>13474<description>13475JNI local reference to the monitor.13476</description>13477</param>13478<param id="timed_out">13479<jboolean/>13480<description>13481True if the monitor timed out13482</description>13483</param>13484</parameters>13485</event>1348613487<event label="Resource Exhausted"13488id="ResourceExhausted" const="JVMTI_EVENT_RESOURCE_EXHAUSTED" num="80"13489since="1.1">13490<description>13491Sent when a VM resource needed by a running application has been exhausted.13492Except as required by the optional capabilities, the set of resources13493which report exhaustion is implementation dependent.13494<p/>13495The following bit flags define the properties of the resource exhaustion:13496<constants id="jvmtiResourceExhaustionFlags"13497label="Resource Exhaustion Flags"13498kind="bits"13499since="1.1">13500<constant id="JVMTI_RESOURCE_EXHAUSTED_OOM_ERROR" num="0x0001">13501After this event returns, the VM will throw a13502<code>java.lang.OutOfMemoryError</code>.13503</constant>13504<constant id="JVMTI_RESOURCE_EXHAUSTED_JAVA_HEAP" num="0x0002">13505The VM was unable to allocate memory from the <tm>Java</tm>13506platform <i>heap</i>.13507The <i>heap</i> is the runtime13508data area from which memory for all class instances and13509arrays are allocated.13510</constant>13511<constant id="JVMTI_RESOURCE_EXHAUSTED_THREADS" num="0x0004">13512The VM was unable to create a thread.13513</constant>13514</constants>13515</description>13516<origin>new</origin>13517<capabilities>13518<capability id="can_generate_resource_exhaustion_heap_events">13519Can generate events when the VM is unable to allocate memory from the13520<internallink id="JVMTI_RESOURCE_EXHAUSTED_JAVA_HEAP">heap</internallink>.13521</capability>13522<capability id="can_generate_resource_exhaustion_threads_events">13523Can generate events when the VM is unable to13524<internallink id="JVMTI_RESOURCE_EXHAUSTED_THREADS">create13525a thread</internallink>.13526</capability>13527</capabilities>13528<parameters>13529<param id="jni_env">13530<outptr>13531<struct>JNIEnv</struct>13532</outptr>13533<description>13534The JNI environment of the event (current) thread13535</description>13536</param>13537<param id="flags">13538<jint/>13539<description>13540Flags defining the properties of the of resource exhaustion13541as specified by the13542<internallink id="jvmtiResourceExhaustionFlags">Resource13543Exhaustion Flags</internallink>.13544</description>13545</param>13546<param id="reserved">13547<vmbuf><void/></vmbuf>13548<description>13549Reserved.13550</description>13551</param>13552<param id="description">13553<vmbuf><char/></vmbuf>13554<description>13555Description of the resource exhaustion, encoded as a13556<internallink id="mUTF">modified UTF-8</internallink> string.13557</description>13558</param>13559</parameters>13560</event>1356113562<event label="VM Object Allocation"13563id="VMObjectAlloc" const="JVMTI_EVENT_VM_OBJECT_ALLOC" num="84">13564<description>13565Sent when a method causes the virtual machine to directly allocate an13566Object visible to Java programming language code.13567Generally object allocation should be detected by instrumenting13568the bytecodes of allocating methods.13569Object allocation generated in native code by JNI function13570calls should be detected using13571<internallink id="jniIntercept">JNI function interception</internallink>.13572Some methods might not have associated bytecodes and are not13573native methods, they instead are executed directly by the13574VM. These methods should send this event.13575Virtual machines which are incapable of bytecode instrumentation13576for some or all of their methods can send this event.1357713578Note that the <internallink13579id="SampledObjectAlloc">SampledObjectAlloc</internallink>13580event is triggered on all Java object allocations, including those13581caused by bytecode method execution, JNI method execution, and13582directly by VM methods.13583<p/>13584Typical examples where this event might be sent:13585<ul>13586<li>Reflection -- for example, <code>java.lang.Class.newInstance()</code></li>13587<li>Methods not represented by bytecodes -- for example, VM intrinsics and13588J2ME preloaded classes</li>13589</ul>13590Cases where this event would not be generated:13591<ul>13592<li>Allocation due to bytecodes -- for example, the <code>new</code>13593and <code>newarray</code> VM instructions</li>13594<li>Allocation due to JNI function calls -- for example,13595<code>AllocObject</code></li>13596<li>Allocations during VM initialization</li>13597<li>VM internal objects</li>13598</ul>13599</description>13600<origin>new</origin>13601<capabilities>13602<required id="can_generate_vm_object_alloc_events"></required>13603</capabilities>13604<parameters>13605<param id="jni_env">13606<outptr>13607<struct>JNIEnv</struct>13608</outptr>13609<description>13610The JNI environment of the event (current) thread13611</description>13612</param>13613<param id="thread">13614<jthread/>13615<description>13616Thread allocating the object.13617</description>13618</param>13619<param id="object">13620<jobject/>13621<description>13622JNI local reference to the object that was allocated.13623</description>13624</param>13625<param id="object_klass">13626<jclass/>13627<description>13628JNI local reference to the class of the object.13629</description>13630</param>13631<param id="size">13632<jlong/>13633<description>13634Size of the object (in bytes). See <functionlink id="GetObjectSize"/>.13635</description>13636</param>13637</parameters>13638</event>1363913640<event label="Sampled Object Allocation"13641id="SampledObjectAlloc" const="JVMTI_EVENT_SAMPLED_OBJECT_ALLOC" filtered="thread" num="86" since="11">13642<description>13643Sent when an allocated object is sampled.13644By default, the sampling interval is set to 512KB. The sampling is semi-random to avoid13645pattern-based bias and provides an approximate overall average interval over long periods of13646sampling.13647<p/>13648Each thread tracks how many bytes it has allocated since it sent the last event.13649When the number of bytes exceeds the sampling interval, it will send another event.13650This implies that, on average, one object will be sampled every time a thread has13651allocated 512KB bytes since the last sample.13652<p/>13653Note that the sampler is pseudo-random: it will not sample every 512KB precisely.13654The goal of this is to ensure high quality sampling even if allocation is13655happening in a fixed pattern (i.e., the same set of objects are being allocated13656every 512KB).13657<p/>13658If another sampling interval is required, the user can call13659<functionlink id="SetHeapSamplingInterval"></functionlink> with a strictly positive integer value,13660representing the new sampling interval.13661<p/>13662This event is sent once the sampled allocation has been performed. It provides the object, stack trace13663of the allocation, the thread allocating, the size of allocation, and the object's class.13664<p/>13665A typical use case of this system is to determine where heap allocations originate.13666In conjunction with weak references and the function13667<functionlink id="GetStackTrace"></functionlink>, a user can track which objects were allocated from which13668stack trace, and which are still live during the execution of the program.13669</description>13670<origin>new</origin>13671<capabilities>13672<required id="can_generate_sampled_object_alloc_events"></required>13673</capabilities>13674<parameters>13675<param id="jni_env">13676<outptr>13677<struct>JNIEnv</struct>13678</outptr>13679<description>13680The JNI environment of the event (current) thread.13681</description>13682</param>13683<param id="thread">13684<jthread/>13685<description>13686Thread allocating the object.13687</description>13688</param>13689<param id="object">13690<jobject/>13691<description>13692JNI local reference to the object that was allocated.13693</description>13694</param>13695<param id="object_klass">13696<jclass/>13697<description>13698JNI local reference to the class of the object13699</description>13700</param>13701<param id="size">13702<jlong/>13703<description>13704Size of the object (in bytes). See <functionlink id="GetObjectSize"/>.13705</description>13706</param>13707</parameters>13708</event>1370913710<event label="Object Free"13711id="ObjectFree" const="JVMTI_EVENT_OBJECT_FREE" num="83">13712<description>13713An Object Free event is sent when the garbage collector frees an object.13714Events are only sent for tagged objects--see13715<internallink id="Heap">heap functions</internallink>.13716<p/>13717The event handler must not use JNI functions and13718must not use <jvmti/> functions except those which13719specifically allow such use (see the raw monitor, memory management,13720and environment local storage functions).13721</description>13722<origin>new</origin>13723<capabilities>13724<required id="can_generate_object_free_events"></required>13725</capabilities>13726<parameters>13727<param id="tag">13728<jlong/>13729<description>13730The freed object's tag13731</description>13732</param>13733</parameters>13734</event>1373513736<event label="Garbage Collection Start"13737id="GarbageCollectionStart" const="JVMTI_EVENT_GARBAGE_COLLECTION_START" num="81">13738<description>13739A Garbage Collection Start event is sent when a13740garbage collection pause begins.13741Only stop-the-world collections are reported--that is, collections during13742which all threads cease to modify the state of the Java virtual machine.13743This means that some collectors will never generate these events.13744This event is sent while the VM is still stopped, thus13745the event handler must not use JNI functions and13746must not use <jvmti/> functions except those which13747specifically allow such use (see the raw monitor, memory management,13748and environment local storage functions).13749<p/>13750This event is always sent as a matched pair with13751<eventlink id="GarbageCollectionFinish"/>13752(assuming both events are enabled) and no garbage collection13753events will occur between them.13754</description>13755<origin>new</origin>13756<capabilities>13757<required id="can_generate_garbage_collection_events"></required>13758</capabilities>13759<parameters>13760</parameters>13761</event>1376213763<event label="Garbage Collection Finish"13764id="GarbageCollectionFinish" const="JVMTI_EVENT_GARBAGE_COLLECTION_FINISH" num="82">13765<description>13766A Garbage Collection Finish event is sent when a13767garbage collection pause ends.13768This event is sent while the VM is still stopped, thus13769the event handler must not use JNI functions and13770must not use <jvmti/> functions except those which13771specifically allow such use (see the raw monitor, memory management,13772and environment local storage functions).13773<p/>13774Some agents may need to do post garbage collection operations that13775require the use of the disallowed <jvmti/> or JNI functions. For these13776cases an agent thread can be created which waits on a raw monitor,13777and the handler for the Garbage Collection Finish event simply13778notifies the raw monitor13779<p/>13780This event is always sent as a matched pair with13781<eventlink id="GarbageCollectionStart"/> (assuming both events are enabled).13782<issue>13783The most important use of this event is to provide timing information,13784and thus additional information is not required. However,13785information about the collection which is "free" should be included -13786what that information is needs to be determined.13787</issue>13788</description>13789<origin>new</origin>13790<capabilities>13791<required id="can_generate_garbage_collection_events"></required>13792</capabilities>13793<parameters>13794</parameters>13795</event>1379613797<elide>13798<event label="Verbose Output" phase="any"13799id="VerboseOutput" const="JVMTI_EVENT_VERBOSE_OUTPUT" num="85">13800<description>13801Send verbose messages as strings.13802<issue>13803This format is extremely fragile, as it can change with each13804platform, collector and version. Alternatives include:13805<ul>13806<li>building off Java programming language M and M APIs</li>13807<li>XML</li>13808<li>key/value pairs</li>13809<li>removing it</li>13810</ul>13811</issue>13812<issue>13813Though this seemed trivial to implement.13814In the RI it appears this will be quite complex.13815</issue>13816</description>13817<origin>new</origin>13818<capabilities>13819</capabilities>13820<parameters>13821<param id="flag">13822<enum>jvmtiVerboseFlag</enum>13823<description>13824Which verbose output is being sent.13825</description>13826</param>13827<param id="message">13828<vmbuf><char/></vmbuf>13829<description>13830Message text, encoded as a13831<internallink id="mUTF">modified UTF-8</internallink> string.13832</description>13833</param>13834</parameters>13835</event>13836</elide>1383713838</eventsection>1383913840<datasection>13841<intro>13842<jvmti/> extends the data types defined by JNI.13843</intro>13844<basetypes id="jniTypes" label="JNI Types Used in the JVM Tool Interface">13845<basetype id="jboolean">13846<description>13847Holds a Java programming language <code>boolean</code>.13848Unsigned 8 bits.13849</description>13850</basetype>13851<basetype id="jchar">13852<description>13853Holds a Java programming language <code>char</code>.13854Unsigned 16 bits.13855</description>13856</basetype>13857<basetype id="jint">13858<description>13859Holds a Java programming language <code>int</code>.13860Signed 32 bits.13861</description>13862</basetype>13863<basetype id="jlong">13864<description>13865Holds a Java programming language <code>long</code>.13866Signed 64 bits.13867</description>13868</basetype>13869<basetype id="jfloat">13870<description>13871Holds a Java programming language <code>float</code>.1387232 bits.13873</description>13874</basetype>13875<basetype id="jdouble">13876<description>13877Holds a Java programming language <code>double</code>.1387864 bits.13879</description>13880</basetype>13881<basetype id="jobject">13882<description>13883Holds a Java programming language object.13884</description>13885</basetype>13886<basetype id="jclass">13887<description>13888Holds a Java programming language class.13889</description>13890</basetype>13891<basetype id="jvalue">13892<description>13893Is a union of all primitive types and <code>jobject</code>. Thus, holds any Java13894programming language value.13895</description>13896</basetype>13897<basetype id="jfieldID">13898<description>13899Identifies a Java programming language field.13900<code>jfieldID</code>s returned by <jvmti/> functions and events may be13901safely stored.13902</description>13903</basetype>13904<basetype id="jmethodID">13905<description>13906Identifies a Java programming language method, initializer, or constructor.13907<code>jmethodID</code>s returned by <jvmti/> functions and events may be13908safely stored. However, if the class is unloaded, they become invalid13909and must not be used.13910</description>13911</basetype>13912<basetype id="JNIEnv">13913<description>13914Pointer to the JNI function table. Pointer to this (<code>JNIEnv *</code>)13915is a JNI environment.13916</description>13917</basetype>13918</basetypes>1391913920<basetypes id="jvmtiTypes" label="JVM Tool Interface Base Types">13921<basetype id="jvmtiEnv">13922<description>13923The <jvmti/> <internallink id="environments">environment</internallink> pointer.13924See the <internallink id="FunctionSection">Function Section</internallink>.13925<code>jvmtiEnv</code> points to the13926<internallink id="FunctionTable">function table</internallink> pointer.13927</description>13928</basetype>13929<basetype id="jthread">13930<definition>typedef jobject jthread;</definition>13931<description>13932Subtype of <datalink id="jobject"></datalink> that holds a thread.13933</description>13934</basetype>13935<basetype id="jthreadGroup">13936<definition>typedef jobject jthreadGroup;</definition>13937<description>13938Subtype of <datalink id="jobject"></datalink> that holds a thread group.13939</description>13940</basetype>13941<basetype id="jlocation">13942<definition>typedef jlong jlocation;</definition>13943<description>13944A 64 bit value, representing a monotonically increasing13945executable position within a method.13946<code>-1</code> indicates a native method.13947See <functionlink id="GetJLocationFormat"></functionlink> for the format on a13948given VM.13949</description>13950</basetype>13951<basetype id="jrawMonitorID">13952<definition>struct _jrawMonitorID;13953typedef struct _jrawMonitorID *jrawMonitorID;</definition>13954<description>13955A raw monitor.13956</description>13957</basetype>13958<basetype id="jvmtiError">13959<description>13960Holds an error return code.13961See the <internallink id="ErrorSection">Error section</internallink> for possible values.13962<example>13963typedef enum {13964JVMTI_ERROR_NONE = 0,13965JVMTI_ERROR_INVALID_THREAD = 10,13966...13967} jvmtiError;13968</example>13969</description>13970</basetype>13971<basetype id="jvmtiEvent">13972<description>13973An identifier for an event type.13974See the <internallink id="EventSection">Event section</internallink> for possible values.13975It is guaranteed that future versions of this specification will13976never assign zero as an event type identifier.13977<example>13978typedef enum {13979JVMTI_EVENT_SINGLE_STEP = 1,13980JVMTI_EVENT_BREAKPOINT = 2,13981...13982} jvmtiEvent;13983</example>13984</description>13985</basetype>13986<basetype id="jvmtiEventCallbacks" name="eventCallbacks">13987<description>13988The callbacks used for events.13989<example>13990typedef struct {13991jvmtiEventVMInit VMInit;13992jvmtiEventVMDeath VMDeath;13993...13994} jvmtiEventCallbacks;13995</example>13996See <internallink id="jvmtiEventCallbacks">event callbacks</internallink>13997for the complete structure.13998<p/>13999Where, for example, the VM initialization callback is defined:14000<example>14001typedef void (JNICALL *jvmtiEventVMInit)14002(jvmtiEnv *jvmti_env,14003JNIEnv* jni_env,14004jthread thread);14005</example>14006See the individual events for the callback function definition.14007</description>14008</basetype>14009<basetype id="jniNativeInterface">14010<definition>typedef struct JNINativeInterface_ jniNativeInterface;</definition>14011<description>14012Typedef for the JNI function table <code>JNINativeInterface</code>14013defined in the14014<externallink id="jni/functions.html#interface-function-table">14015JNI Specification</externallink>.14016The JNI reference implementation defines this with an underscore.14017</description>14018</basetype>14019</basetypes>1402014021</datasection>1402214023<issuessection label="Issues">14024<intro id="suspendRequired" label="Resolved Issue: Suspend - Required or Automatic">14025JVMDI requires that the agent suspend threads before calling14026certain sensitive functions. JVMPI requires garbage collection to be14027disabled before calling certain sensitive functions.14028It was suggested that rather than have this requirement, that14029VM place itself in a suitable state before performing an14030operation. This makes considerable sense since each VM14031knows its requirements and can most easily arrange a14032safe state.14033<p/>14034The ability to externally suspend/resume threads will, of14035course, remain. The ability to enable/disable garbage collection will not.14036<p/>14037This issue is resolved--suspend will not14038be required. The spec has been updated to reflect this.14039</intro>1404014041<intro id="stackSampling" label="Resolved Issue: Call Stack Sampling">14042There are a variety of approaches to sampling call stacks.14043The biggest bifurcation is between VM controlled and agent14044controlled.14045<p/>14046This issue is resolved--agent controlled14047sampling will be the approach.14048</intro>1404914050<intro id="threadRepresentation" label="Resolved Issue: Thread Representation">14051JVMDI represents threads as jthread. JVMPI primarily14052uses JNIEnv* to represent threads.14053<p/>14054The Expert Group has chosen jthread as the representation14055for threads in <jvmti/>.14056JNIEnv* is sent by14057events since it is needed to JNI functions. JNIEnv, per the14058JNI spec, are not supposed to be used outside their thread.14059</intro>1406014061<intro id="design" label="Resolved Issue: Method Representation">14062The JNI spec allows an implementation to depend on jclass/jmethodID14063pairs, rather than simply a jmethodID, to reference a method.14064JVMDI, for consistency, choose the same representation.14065JVMPI, however, specifies that a jmethodID alone maps to a14066method. Both of the Sun <tm>J2SE</tm> virtual machines (Classic and <tm>HotSpot</tm>) store14067pointers in jmethodIDs, and as a result, a jmethodID is sufficient.14068In fact, any JVM implementation that supports JVMPI must have14069such a representation.14070<jvmti/> will use jmethodID as a unique representation of a method14071(no jclass is used).14072There should be efficiency gains, particularly in14073functionality like stack dumping, to this representation.14074<p/>14075Note that fields were not used in JVMPI and that the access profile14076of fields differs from methods--for implementation efficiency14077reasons, a jclass/jfieldID pair will still be needed for field14078reference.14079</intro>1408014081<intro id="localReferenceIssue" label="Resolved Issue: Local References">14082Functions return local references.14083</intro>1408414085<intro id="frameRep" label="Resolved Issue: Representation of frames">14086In JVMDI, a frame ID is used to represent a frame. Problem with this14087is that a VM must track when a frame becomes invalid, a far better14088approach, and the one used in <jvmti/>, is to reference frames by depth.14089</intro>1409014091<intro id="requiredCapabilities" label="Issue: Required Capabilities">14092Currently, having a required capabilities means that the functionality14093is optional. Capabilities are useful even for required functionality14094since they can inform the VM is needed set-up. Thus, there should be14095a set of capabilities that a conformant implementation must provide14096(if requested during Agent_OnLoad).14097</intro>1409814099<intro id="taghint" label="Proposal: add tag hint function">14100A hint of the percentage of objects that will be tagged would14101help the VM pick a good implementation.14102</intro>1410314104<intro id="moreMonitorQueries" label="Request: More Monitor Quires">14105How difficult or easy would be to extend the monitor_info category to include14106<pre>14107- current number of monitors14108- enumeration of monitors14109- enumeration of threads waiting on a given monitor14110</pre>14111The reason for my question is the fact that current get_monitor_info support14112requires the agent to specify a given thread to get the info which is probably14113OK in the profiling/debugging space, while in the monitoring space the agent14114could be watching the monitor list and then decide which thread to ask for14115the info. You might ask why is this important for monitoring .... I think it14116can aid in the detection/prediction of application contention caused by hot-locks.14117</intro>14118</issuessection>1411914120<changehistory id="ChangeHistory" update="09/05/07">14121<intro>14122The <jvmti/> specification is an evolving document with major, minor,14123and micro version numbers.14124A released version of the specification is uniquely identified14125by its major and minor version.14126The functions, events, and capabilities in this specification14127indicate a "Since" value which is the major and minor version in14128which it was introduced.14129The version of the specification implemented by the VM can14130be retrieved at runtime with the <functionlink id="GetVersionNumber"/>14131function.14132</intro>14133<change date="14 Nov 2002">14134Converted to XML document.14135</change>14136<change date="14 Nov 2002">14137Elided heap dump functions (for now) since what was there14138was wrong.14139</change>14140<change date="18 Nov 2002">14141Added detail throughout.14142</change>14143<change date="18 Nov 2002">14144Changed JVMTI_THREAD_STATUS_RUNNING to JVMTI_THREAD_STATUS_RUNNABLE.14145</change>14146<change date="19 Nov 2002">14147Added AsyncGetStackTrace.14148</change>14149<change date="19 Nov 2002">14150Added jframeID return to GetStackTrace.14151</change>14152<change date="19 Nov 2002">14153Elided GetCurrentFrame and GetCallingFrame functions (for now) since what was there14154since they are redundant with GetStackTrace.14155</change>14156<change date="19 Nov 2002">14157Elided ClearAllBreakpoints since it has always been redundant.14158</change>14159<change date="19 Nov 2002">14160Added GetSystemProperties.14161</change>14162<change date="19 Nov 2002">14163Changed the thread local storage functions to use jthread.14164</change>14165<change date="20 Nov 2002">14166Added GetJLocationFormat.14167</change>14168<change date="22 Nov 2002">14169Added events and introductory text.14170</change>14171<change date="22 Nov 2002">14172Cross reference type and constant definitions.14173</change>14174<change date="24 Nov 2002">14175Added DTD.14176</change>14177<change date="24 Nov 2002">14178Added capabilities function section.14179</change>14180<change date="29 Nov 2002">14181Assign capabilities to each function and event.14182</change>14183<change date="29 Nov 2002">14184Add <internallink id="jniIntercept">JNI interception functions</internallink>.14185</change>14186<change date="30 Nov 2002">14187Auto generate SetEventNotificationMode capabilities.14188</change>14189<change date="30 Nov 2002">14190Add <eventlink id="VMObjectAlloc"></eventlink> event.14191</change>14192<change date="30 Nov 2002">14193Add <eventlink id="DynamicCodeGenerated"></eventlink> event.14194</change>14195<change date="30 Nov 2002">14196Add const to declarations.14197</change>14198<change date="30 Nov 2002">14199Change method exit and frame pop to send on exception.14200</change>14201<change date="1 Dec 2002">14202Add ForceGarbageCollection.14203</change>14204<change date="2 Dec 2002">14205Redo Xrun section; clarify GetStackTrace and add example;14206Fix width problems; use "agent" consistently.14207</change>14208<change date="8 Dec 2002">14209Remove previous start-up intro.14210Add <internallink id="environments"><jvmti/> Environments</internallink>14211section.14212</change>14213<change date="8 Dec 2002">14214Add <functionlink id="DisposeEnvironment"></functionlink>.14215</change>14216<change date="9 Dec 2002">14217Numerous minor updates.14218</change>14219<change date="15 Dec 2002">14220Add heap profiling functions added:14221get/set annotation, iterate live objects/heap.14222Add heap profiling functions place holder added:14223heap roots.14224Heap profiling event added: object free.14225Heap profiling event redesigned: vm object allocation.14226Heap profiling event placeholders added: garbage collection start/finish.14227Native method bind event added.14228</change>14229<change date="19 Dec 2002">14230Revamp suspend/resume functions.14231Add origin information with jvmdi tag.14232Misc fixes.14233</change>14234<change date="24 Dec 2002">14235Add semantics to types.14236</change>14237<change date="27 Dec 2002">14238Add local reference section.14239Autogenerate parameter descriptions from types.14240</change>14241<change date="28 Dec 2002">14242Document that RunAgentThread sends threadStart.14243</change>14244<change date="29 Dec 2002">14245Remove redundant local ref and dealloc warning.14246Convert GetRawMonitorName to allocated buffer.14247Add GenerateEvents.14248</change>14249<change date="30 Dec 2002">14250Make raw monitors a type and rename to "jrawMonitorID".14251</change>14252<change date="1 Jan 2003">14253Include origin information.14254Clean-up JVMDI issue references.14255Remove Deallocate warnings which are now automatically generated.14256</change>14257<change date="2 Jan 2003">14258Fix representation issues for jthread.14259</change>14260<change date="3 Jan 2003">14261Make capabilities buffered out to 64 bits - and do it automatically.14262</change>14263<change date="4 Jan 2003">14264Make constants which are enumeration into enum types.14265Parameters now of enum type.14266Clean-up and index type section.14267Replace remaining datadef entities with callback.14268</change>14269<change date="7 Jan 2003">14270Correct GenerateEvents description.14271More internal semantics work.14272</change>14273<change date="9 Jan 2003">14274Replace previous GetSystemProperties with two functions14275which use allocated information instead fixed.14276Add SetSystemProperty.14277More internal semantics work.14278</change>14279<change date="12 Jan 2003">14280Add varargs to end of SetEventNotificationMode.14281</change>14282<change date="20 Jan 2003">14283Finish fixing spec to reflect that alloc sizes are jlong.14284</change>14285<change date="22 Jan 2003">14286Allow NULL as RunAgentThread arg.14287</change>14288<change date="22 Jan 2003">14289Fixed names to standardized naming convention14290Removed AsyncGetStackTrace.14291</change>14292<change date="29 Jan 2003">14293Since we are using jthread, removed GetThread.14294</change>14295<change date="31 Jan 2003">14296Change GetFieldName to allow NULLs like GetMethodName.14297</change>14298<change date="29 Feb 2003" version="v40">14299Rewrite the introductory text, adding sections on14300start-up, environments and bytecode instrumentation.14301Change the command line arguments per EG discussions.14302Add an introduction to the capabilities section.14303Add the extension mechanism category and functions.14304Mark for deletion, but clarified anyhow, SuspendAllThreads.14305Rename IterateOverLiveObjects to IterateOverReachableObjects and14306change the text accordingly.14307Clarify IterateOverHeap.14308Clarify CompiledMethodLoad.14309Discuss prerequisite state for Calling Functions.14310Clarify SetAllocationHooks.14311Added issues ("To be resolved:") through-out.14312And so on...14313</change>14314<change date="6 Mar 2003" version="v41">14315Remove struct from the call to GetOwnedMonitorInfo.14316Automatically generate most error documentation, remove14317(rather broken) hand written error doc.14318Better describe capability use (empty initial set).14319Add min value to jint params.14320Remove the capability can_access_thread_local_storage.14321Rename error JVMTI_ERROR_NOT_IMPLEMENTED to JVMTI_ERROR_MUST_POSSESS_CAPABILITY;14322same for *NOT_IMPLEMENTED.14323Description fixes.14324</change>14325<change date="8 Mar 2003" version="v42">14326Rename GetClassSignature to GetClassName.14327Rename IterateOverClassObjects to IterateOverInstancesOfClass.14328Remove GetMaxStack (operand stack isn't used in <jvmti/>).14329Description fixes: define launch-time, remove native frame pop14330from PopFrame, and assorted clarifications.14331</change>14332<change date="8 Mar 2003" version="v43">14333Fix minor editing problem.14334</change>14335<change date="10 Mar 2003" version="v44">14336Add phase information.14337Remap (compact) event numbers.14338</change>14339<change date="11 Mar 2003" version="v45">14340More phase information - allow "any".14341Elide raw monitor queries and events.14342Minor description fixes.14343</change>14344<change date="12 Mar 2003" version="v46">14345Add GetPhase.14346Use "phase" through document.14347Elide GetRawMonitorName.14348Elide GetObjectMonitors.14349</change>14350<change date="12 Mar 2003" version="v47">14351Fixes from link, XML, and spell checking.14352Auto-generate the callback structure.14353</change>14354<change date="13 Mar 2003" version="v48">14355One character XML fix.14356</change>14357<change date="13 Mar 2003" version="v49">14358Change function parameter names to be consistent with14359event parameters (fooBarBaz becomes foo_bar_baz).14360</change>14361<change date="14 Mar 2003" version="v50">14362Fix broken link. Fix thread markers.14363</change>14364<change date="14 Mar 2003" version="v51">14365Change constants so they are under 128 to workaround14366compiler problems.14367</change>14368<change date="23 Mar 2003" version="v52">14369Overhaul capabilities. Separate GetStackTrace into14370GetStackTrace and GetStackFrames.14371</change>14372<change date="8 Apr 2003" version="v54">14373Use depth instead of jframeID to reference frames.14374Remove the now irrelevant GetCurrentFrame, GetCallerFrame and GetStackFrames.14375Remove frame arg from events.14376</change>14377<change date="9 Apr 2003" version="v55">14378Remove GetObjectWithAnnotation since tests show bufferred approach more efficient.14379Add missing annotation_count to GetObjectsWithAnnotations14380</change>14381<change date="10 Apr 2003" version="v56">14382Remove confusing parenthetical statement in GetObjectsWithAnnotations14383</change>14384<change date="13 Apr 2003" version="v58">14385Replace jclass/jmethodID representation of method with simply jmethodID;14386Pass JvmtiEnv* as first arg of every event; remove JNIEnv* where inappropriate.14387Replace can_access_frames with can_access_local_variables; remove from purely stack access.14388Use can_get_synthetic_attribute; fix description.14389Clarify that zero length arrays must be deallocated.14390Clarify RelinquishCapabilities.14391Generalize JVMTI_ERROR_VM_DEAD to JVMTI_ERROR_WRONG_PHASE.14392</change>14393<change date="27 Apr 2003" version="v59">14394Remove lingering indirect references to OBSOLETE_METHOD_ID.14395</change>14396<change date="4 May 2003" version="v60">14397Allow DestroyRawMonitor during OnLoad.14398</change>14399<change date="7 May 2003" version="v61">14400Added not monitor owner error return to DestroyRawMonitor.14401</change>14402<change date="13 May 2003" version="v62">14403Clarify semantics of raw monitors.14404Change flags on <code>GetThreadStatus</code>.14405<code>GetClassLoader</code> return NULL for the bootstrap class loader.14406Add <code>GetClassName</code> issue.14407Define local variable signature.14408Disallow zero in annotations array of <code>GetObjectsWithAnnotations</code>.14409Remove over specification in <code>GetObjectsWithAnnotations</code>.14410Elide <code>SetAllocationHooks</code>.14411Elide <code>SuspendAllThreads</code>.14412</change>14413<change date="14 May 2003" version="v63">14414Define the data type <code>jvmtiEventCallbacks</code>.14415Zero length allocations return NULL.14416Keep SetAllocationHooks in JVMDI, but remove from <jvmti/>.14417Add JVMTI_THREAD_STATUS_FLAG_INTERRUPTED.14418</change>14419<change date="15 May 2003" version="v64">14420Better wording, per review.14421</change>14422<change date="15 May 2003" version="v65">14423First Alpha.14424Make jmethodID and jfieldID unique, jclass not used.14425</change>14426<change date="27 May 2003" version="v66">14427Fix minor XSLT errors.14428</change>14429<change date="13 June 2003" version="v67">14430Undo making jfieldID unique (jmethodID still is).14431</change>14432<change date="17 June 2003" version="v68">14433Changes per June 11th Expert Group meeting --14434Overhaul Heap functionality: single callback,14435remove GetHeapRoots, add reachable iterators,14436and rename "annotation" to "tag".14437NULL thread parameter on most functions is current14438thread.14439Add timers.14440Remove ForceExit.14441Add GetEnvironmentLocalStorage.14442Add verbose flag and event.14443Add AddToBootstrapClassLoaderSearch.14444Update ClassFileLoadHook.14445</change>14446<change date="18 June 2003" version="v69">14447Clean up issues sections.14448Rename GetClassName back to GetClassSignature and14449fix description.14450Add generic signature to GetClassSignature,14451GetFieldSignature, GetMethodSignature, and14452GetLocalVariableTable.14453Elide EstimateCostOfCapabilities.14454Clarify that the system property functions operate14455on the VM view of system properties.14456Clarify Agent_OnLoad.14457Remove "const" from JNIEnv* in events.14458Add metadata accessors.14459</change>14460<change date="18 June 2003" version="v70">14461Add start_depth to GetStackTrace.14462Move system properties to a new category.14463Add GetObjectSize.14464Remove "X" from command line flags.14465XML, HTML, and spell check corrections.14466</change>14467<change date="19 June 2003" version="v71">14468Fix JVMTI_HEAP_ROOT_THREAD to be 6.14469Make each synopsis match the function name.14470Fix unclear wording.14471</change>14472<change date="26 June 2003" version="v72">14473SetThreadLocalStorage and SetEnvironmentLocalStorage should allow value14474to be set to NULL.14475NotifyFramePop, GetFrameLocationm and all the local variable operations14476needed to have their wording about frames fixed.14477Grammar and clarity need to be fixed throughout.14478Capitalization and puntuation need to be consistent.14479Need micro version number and masks for accessing major, minor, and micro.14480The error code lists should indicate which must be returned by14481an implementation.14482The command line properties should be visible in the properties functions.14483Disallow popping from the current thread.14484Allow implementations to return opaque frame error when they cannot pop.14485The NativeMethodBind event should be sent during any phase.14486The DynamicCodeGenerated event should be sent during any phase.14487The following functions should be allowed to operate before VMInit:14488Set/GetEnvironmentLocalStorage14489GetMethodDeclaringClass14490GetClassSignature14491GetClassModifiers14492IsInterface14493IsArrayClass14494GetMethodName14495GetMethodModifiers14496GetMaxLocals14497GetArgumentsSize14498GetLineNumberTable14499GetMethodLocation14500IsMethodNative14501IsMethodSynthetic.14502Other changes (to XSL):14503Argument description should show asterisk after not before pointers.14504NotifyFramePop, GetFrameLocationm and all the local variable operations14505should hsve the NO_MORE_FRAMES error added.14506Not alive threads should have a different error return than invalid thread.14507</change>14508<change date="7 July 2003" version="v73">14509VerboseOutput event was missing message parameter.14510Minor fix-ups.14511</change>14512<change date="14 July 2003" version="v74">14513Technical Publications Department corrections.14514Allow thread and environment local storage to be set to NULL.14515</change>14516<change date="23 July 2003" version="v75">14517Use new Agent_OnLoad rather than overloaded JVM_OnLoad.14518Add JNICALL to callbacks (XSL).14519Document JNICALL requirement for both events and callbacks (XSL).14520Restrict RedefineClasses to methods and attributes.14521Elide the VerboseOutput event.14522VMObjectAlloc: restrict when event is sent and remove method parameter.14523Finish loose ends from Tech Pubs edit.14524</change>14525<change date="24 July 2003" version="v76">14526Change ClassFileLoadHook event to send the class instead of a boolean of redefine.14527</change>14528<change date="24 July 2003" version="v77">14529XML fixes.14530Minor text clarifications and corrections.14531</change>14532<change date="24 July 2003" version="v78">14533Remove GetExceptionHandlerTable and GetThrownExceptions from <jvmti/>.14534Clarify that stack frames are JVM Spec frames.14535Split can_get_source_info into can_get_source_file_name, can_get_line_numbers,14536and can_get_source_debug_extension.14537PopFrame cannot have a native calling method.14538Removed incorrect statement in GetClassloaderClasses14539(see <vmspec chapter="4.4"/>).14540</change>14541<change date="24 July 2003" version="v79">14542XML and text fixes.14543Move stack frame description into Stack Frame category.14544</change>14545<change date="26 July 2003" version="v80">14546Allow NULL (means bootstrap loader) for GetClassloaderClasses.14547Add new heap reference kinds for references from classes.14548Add timer information struct and query functions.14549Add AvailableProcessors.14550Rename GetOtherThreadCpuTime to GetThreadCpuTime.14551Explicitly add JVMTI_ERROR_INVALID_THREAD and JVMTI_ERROR_THREAD_NOT_ALIVE14552to SetEventNotification mode.14553Add initial thread to the VM_INIT event.14554Remove platform assumptions from AddToBootstrapClassLoaderSearch.14555</change>14556<change date="26 July 2003" version="v81">14557Grammar and clarity changes per review.14558</change>14559<change date="27 July 2003" version="v82">14560More grammar and clarity changes per review.14561Add Agent_OnUnload.14562</change>14563<change date="28 July 2003" version="v83">14564Change return type of Agent_OnUnload to void.14565</change>14566<change date="28 July 2003" version="v84">14567Rename JVMTI_REFERENCE_ARRAY to JVMTI_REFERENCE_ARRAY_ELEMENT.14568</change>14569<change date="28 July 2003" version="v85">14570Steal java.lang.Runtime.availableProcessors() wording for14571AvailableProcessors().14572Guarantee that zero will never be an event ID.14573Remove some issues which are no longer issues.14574Per review, rename and more completely document the timer14575information functions.14576</change>14577<change date="29 July 2003" version="v86">14578Non-spec visible change to XML controlled implementation:14579SetThreadLocalStorage must run in VM mode.14580</change>14581<change date="5 August 2003" version="0.1.87">14582Add GetErrorName.14583Add varargs warning to jvmtiExtensionEvent.14584Remove "const" on the jvmtiEnv* of jvmtiExtensionEvent.14585Remove unused can_get_exception_info capability.14586Pass jvmtiEnv* and JNIEnv* to the jvmtiStartFunction.14587Fix jvmtiExtensionFunctionInfo.func declared type.14588Extension function returns error code.14589Use new version numbering.14590</change>14591<change date="5 August 2003" version="0.2.88">14592Remove the ClassUnload event.14593</change>14594<change date="8 August 2003" version="0.2.89">14595Heap reference iterator callbacks return an enum that14596allows outgoing object references to be ignored.14597Allow JNIEnv as a param type to extension events/functions.14598</change>14599<change date="15 August 2003" version="0.2.90">14600Fix a typo.14601</change>14602<change date="2 September 2003" version="0.2.91">14603Remove all metadata functions: GetClassMetadata,14604GetFieldMetadata, and GetMethodMetadata.14605</change>14606<change date="1 October 2003" version="0.2.92">14607Mark the functions Allocate. Deallocate, RawMonitor*,14608SetEnvironmentLocalStorage, and GetEnvironmentLocalStorage14609as safe for use in heap callbacks and GC events.14610</change>14611<change date="24 November 2003" version="0.2.93">14612Add pass through opaque user data pointer to heap iterate14613functions and callbacks.14614In the CompiledMethodUnload event, send the code address.14615Add GarbageCollectionOccurred event.14616Add constant pool reference kind.14617Mark the functions CreateRawMonitor and DestroyRawMonitor14618as safe for use in heap callbacks and GC events.14619Clarify: VMDeath, GetCurrentThreadCpuTimerInfo,14620GetThreadCpuTimerInfo, IterateOverReachableObjects,14621IterateOverObjectsReachableFromObject, GetTime and14622JVMTI_ERROR_NULL_POINTER.14623Add missing errors to: GenerateEvents and14624AddToBootstrapClassLoaderSearch.14625Fix description of ClassFileLoadHook name parameter.14626In heap callbacks and GC/ObjectFree events, specify14627that only explicitly allowed functions can be called.14628Allow GetCurrentThreadCpuTimerInfo, GetCurrentThreadCpuTime,14629GetTimerInfo, and GetTime during callback.14630Allow calling SetTag/GetTag during the onload phase.14631SetEventNotificationMode, add: error attempted inappropriate14632thread level control.14633Remove jvmtiExceptionHandlerEntry.14634Fix handling of native methods on the stack --14635location_ptr param of GetFrameLocation, remove14636JVMTI_ERROR_OPAQUE_FRAME from GetFrameLocation,14637jvmtiFrameInfo.location, and jlocation.14638Remove typo (from JVMPI) implying that the MonitorWaited14639event is sent on sleep.14640</change>14641<change date="25 November 2003" version="0.2.94">14642Clarifications and typos.14643</change>14644<change date="3 December 2003" version="0.2.95">14645Allow NULL user_data in heap iterators.14646</change>14647<change date="28 January 2004" version="0.2.97">14648Add GetThreadState, deprecate GetThreadStatus.14649</change>14650<change date="29 January 2004" version="0.2.98">14651INVALID_SLOT and TYPE_MISMATCH errors should be optional.14652</change>14653<change date="12 February 2004" version="0.2.102">14654Remove MonitorContendedExit.14655Added JNIEnv parameter to VMObjectAlloc.14656Clarified definition of class_tag and referrer_index14657parameters to heap callbacks.14658</change>14659<change date="16 Febuary 2004" version="0.2.103">14660Document JAVA_TOOL_OPTIONS.14661</change>14662<change date="17 Febuary 2004" version="0.2.105">14663Divide start phase into primordial and start.14664Add VMStart event14665Change phase associations of functions and events.14666</change>14667<change date="18 Febuary 2004" version="0.3.6">14668Elide deprecated GetThreadStatus.14669Bump minor version, subtract 100 from micro version14670</change>14671<change date="18 Febuary 2004" version="0.3.7">14672Document that timer nanosecond values are unsigned.14673Clarify text having to do with native methods.14674</change>14675<change date="19 Febuary 2004" version="0.3.8">14676Fix typos.14677Remove elided deprecated GetThreadStatus.14678</change>14679<change date="23 Febuary 2004" version="0.3.9">14680Require NotifyFramePop to act on suspended threads.14681</change>14682<change date="24 Febuary 2004" version="0.3.10">14683Add capabilities14684(<internallink id="jvmtiCapabilities.can_redefine_any_class"14685><code>can_redefine_any_class</code></internallink>14686and14687<internallink id="jvmtiCapabilities.can_generate_all_class_hook_events"14688><code>can_generate_all_class_hook_events</code></internallink>)14689and an error (<errorlink id="JVMTI_ERROR_UNMODIFIABLE_CLASS"></errorlink>)14690which allow some classes to be unmodifiable.14691</change>14692<change date="28 Febuary 2004" version="0.3.11">14693Add JVMTI_ERROR_MUST_POSSESS_CAPABILITY to SetEventNotificationMode.14694</change>14695<change date="8 March 2004" version="0.3.12">14696Clarified CompiledMethodUnload so that it is clear the event14697may be posted after the class has been unloaded.14698</change>14699<change date="5 March 2004" version="0.3.13">14700Change the size parameter of VMObjectAlloc to jlong to match GetObjectSize.14701</change>14702<change date="13 March 2004" version="0.3.14">14703Added guideline for the use of the JNI FindClass function in event14704callback functions.14705</change>14706<change date="15 March 2004" version="0.3.15">14707Add GetAllStackTraces and GetThreadListStackTraces.14708</change>14709<change date="19 March 2004" version="0.3.16">14710ClassLoad and ClassPrepare events can be posted during start phase.14711</change>14712<change date="25 March 2004" version="0.3.17">14713Add JVMTI_ERROR_NATIVE_METHOD to GetLineNumberTable, GetLocalVariableTable,14714GetMaxLocals, GetArgumentsSize, GetMethodLocation, GetBytecodes.14715</change>14716<change date="29 March 2004" version="0.3.18">14717Return the timer kind in the timer information structure.14718</change>14719<change date="31 March 2004" version="0.3.19">14720Spec clarifications:14721JVMTI_THREAD_STATE_IN_NATIVE might not include JNI or <jvmti/>.14722ForceGarbageCollection does not run finalizers.14723The context of the specification is the Java platform.14724Warn about early instrumentation.14725</change>14726<change date="1 April 2004" version="0.3.20">14727Refinements to the above clarifications and14728Clarify that an error returned by Agent_OnLoad terminates the VM.14729</change>14730<change date="1 April 2004" version="0.3.21">14731Array class creation does not generate a class load event.14732</change>14733<change date="7 April 2004" version="0.3.22">14734Align thread state hierarchy more closely with java.lang.Thread.State.14735</change>14736<change date="12 April 2004" version="0.3.23">14737Clarify the documentation of thread state.14738</change>14739<change date="19 April 2004" version="0.3.24">14740Remove GarbageCollectionOccurred event -- can be done by agent.14741</change>14742<change date="22 April 2004" version="0.3.25">14743Define "command-line option".14744</change>14745<change date="29 April 2004" version="0.3.26">14746Describe the intended use of bytecode instrumentation.14747Fix description of extension event first parameter.14748</change>14749<change date="30 April 2004" version="0.3.27">14750Clarification and typos.14751</change>14752<change date="18 May 2004" version="0.3.28">14753Remove DataDumpRequest event.14754</change>14755<change date="18 May 2004" version="0.3.29">14756Clarify RawMonitorWait with zero timeout.14757Clarify thread state after RunAgentThread.14758</change>14759<change date="24 May 2004" version="0.3.30">14760Clean-up: fix bad/old links, etc.14761</change>14762<change date="30 May 2004" version="0.3.31">14763Clarifications including:14764All character strings are modified UTF-8.14765Agent thread visibiity.14766Meaning of obsolete method version.14767Thread invoking heap callbacks,14768</change>14769<change date="1 June 2004" version="1.0.32">14770Bump major.minor version numbers to "1.0".14771</change>14772<change date="2 June 2004" version="1.0.33">14773Clarify interaction between ForceGarbageCollection14774and ObjectFree.14775</change>14776<change date="6 June 2004" version="1.0.34">14777Restrict AddToBootstrapClassLoaderSearch and14778SetSystemProperty to the OnLoad phase only.14779</change>14780<change date="11 June 2004" version="1.0.35">14781Fix typo in SetTag.14782</change>14783<change date="18 June 2004" version="1.0.36">14784Fix trademarks.14785Add missing parameter in example GetThreadState usage.14786</change>14787<change date="4 August 2004" version="1.0.37">14788Copyright updates.14789</change>14790<change date="5 November 2004" version="1.0.38">14791Add missing function table layout.14792Add missing description of C++ member function format of functions.14793Clarify that name in CFLH can be NULL.14794Released as part of <tm>J2SE</tm> 5.0.14795</change>14796<change date="24 April 2005" version="1.1.47">14797Bump major.minor version numbers to "1.1".14798Add ForceEarlyReturn* functions.14799Add GetOwnedMonitorStackDepthInfo function.14800Add GetCurrentThread function.14801Add "since" version marker.14802Add AddToSystemClassLoaderSearch.14803Allow AddToBootstrapClassLoaderSearch be used in live phase.14804Fix historic rubbish in the descriptions of the heap_object_callback14805parameter of IterateOverHeap and IterateOverInstancesOfClass functions;14806disallow NULL for this parameter.14807Clarify, correct and make consistent: wording about current thread,14808opaque frames and insufficient number of frames in PopFrame.14809Consistently use "current frame" rather than "topmost".14810Clarify the JVMTI_ERROR_TYPE_MISMATCH errors in GetLocal* and SetLocal*14811by making them compatible with those in ForceEarlyReturn*.14812Many other clarifications and wording clean ups.14813</change>14814<change date="25 April 2005" version="1.1.48">14815Add GetConstantPool.14816Switch references to the first edition of the VM Spec, to the seconds edition.14817</change>14818<change date="26 April 2005" version="1.1.49">14819Clarify minor/major version order in GetConstantPool.14820</change>14821<change date="26 April 2005" version="1.1.50">14822Add SetNativeMethodPrefix and SetNativeMethodPrefixes.14823Reassign GetOwnedMonitorStackDepthInfo to position 153.14824Break out Class Loader Search in its own documentation category.14825Deal with overly long lines in XML source.14826</change>14827<change date="29 April 2005" version="1.1.51">14828Allow agents be started in the live phase.14829Added paragraph about deploying agents.14830</change>14831<change date="30 April 2005" version="1.1.52">14832Add specification description to SetNativeMethodPrefix(es).14833Better define the conditions on GetConstantPool.14834</change>14835<change date="30 April 2005" version="1.1.53">14836Break out the GetClassVersionNumber function from GetConstantPool.14837Clean-up the references to the VM Spec.14838</change>14839<change date="1 May 2005" version="1.1.54">14840Allow SetNativeMethodPrefix(es) in any phase.14841Add clarifications about the impact of redefinition on GetConstantPool.14842</change>14843<change date="2 May 2005" version="1.1.56">14844Various clarifications to SetNativeMethodPrefix(es).14845</change>14846<change date="2 May 2005" version="1.1.57">14847Add missing performance warning to the method entry event.14848</change>14849<change date="5 May 2005" version="1.1.58">14850Remove internal JVMDI support.14851</change>14852<change date="8 May 2005" version="1.1.59">14853Add <functionlink id="RetransformClasses"/>.14854Revamp the bytecode instrumentation documentation.14855Change <functionlink id="IsMethodObsolete"/> to no longer14856require the can_redefine_classes capability.14857</change>14858<change date="11 May 2005" version="1.1.63">14859Clarifications for retransformation.14860</change>14861<change date="11 May 2005" version="1.1.64">14862Clarifications for retransformation, per review.14863Lock "retransformation (in)capable" at class load enable time.14864</change>14865<change date="4 June 2005" version="1.1.67">14866Add new heap functionity which supports reporting primitive values,14867allows setting the referrer tag, and has more powerful filtering:14868FollowReferences, IterateThroughHeap, and their associated14869callbacks, structs, enums, and constants.14870</change>14871<change date="4 June 2005" version="1.1.68">14872Clarification.14873</change>14874<change date="6 June 2005" version="1.1.69">14875FollowReferences, IterateThroughHeap: Put callbacks in a struct;14876Add missing error codes; reduce bits in the visit control flags.14877</change>14878<change date="14 June 2005" version="1.1.70">14879More on new heap functionity: spec clean-up per review.14880</change>14881<change date="15 June 2005" version="1.1.71">14882More on new heap functionity: Rename old heap section to Heap (1.0).14883</change>14884<change date="21 June 2005" version="1.1.72">14885Fix typos.14886</change>14887<change date="27 June 2005" version="1.1.73">14888Make referrer info structure a union.14889</change>14890<change date="9 September 2005" version="1.1.74">14891In new heap functions:14892Add missing superclass reference kind.14893Use a single scheme for computing field indexes.14894Remove outdated references to struct based referrer info.14895</change>14896<change date="12 September 2005" version="1.1.75">14897Don't callback during FollowReferences on frivolous java.lang.Object superclass.14898</change>14899<change date="13 September 2005" version="1.1.76">14900In string primitive callback, length now Unicode length.14901In array and string primitive callbacks, value now "const".14902Note possible compiler impacts on setting JNI function table.14903</change>14904<change date="13 September 2005" version="1.1.77">14905GetClassVersionNumbers() and GetConstantPool() should return14906error on array or primitive class.14907</change>14908<change date="14 September 2005" version="1.1.78">14909Grammar fixes.14910</change>14911<change date="26 September 2005" version="1.1.79">14912Add IsModifiableClass query.14913</change>14914<change date="9 February 2006" version="1.1.81">14915Add referrer_class_tag parameter to jvmtiHeapReferenceCallback.14916</change>14917<change date="13 February 2006" version="1.1.82">14918Doc fixes: update can_redefine_any_class to include retransform.14919Clarify that exception events cover all Throwables.14920In GetStackTrace, no test is done for start_depth too big if start_depth is zero,14921Clarify fields reported in Primitive Field Callback -- static vs instance.14922Repair confusing names of heap types, including callback names.14923Require consistent usage of stack depth in the face of thread launch methods.14924Note incompatibility of <jvmti/> memory management with other systems.14925</change>14926<change date="14 February 2006" version="1.1.85">14927Fix typos and missing renames.14928</change>14929<change date="13 March 2006" version="1.1.86">14930Clarify that jmethodIDs and jfieldIDs can be saved.14931Clarify that Iterate Over Instances Of Class includes subclasses.14932</change>14933<change date="14 March 2006" version="1.1.87">14934Better phrasing.14935</change>14936<change date="16 March 2006" version="1.1.88">14937Match the referrer_index for static fields in Object Reference Callback14938with the Reference Implementation (and all other known implementations);14939that is, make it match the definition for instance fields.14940In GetThreadListStackTraces, add JVMTI_ERROR_INVALID_THREAD to cover14941an invalid thread in the list; and specify that not started threads14942return empty stacks.14943</change>14944<change date="17 March 2006" version="1.1.89">14945Typo.14946</change>14947<change date="25 March 2006" version="1.1.90">14948Typo.14949</change>14950<change date="6 April 2006" version="1.1.91">14951Remove restrictions on AddToBootstrapClassLoaderSearch and14952AddToSystemClassLoaderSearch.14953</change>14954<change date="1 May 2006" version="1.1.93">14955Changed spec to return -1 for monitor stack depth for the14956implementation which can not determine stack depth.14957</change>14958<change date="3 May 2006" version="1.1.94">14959Corrections for readability and accuracy courtesy of Alan Pratt of IBM.14960List the object relationships reported in FollowReferences.14961</change>14962<change date="5 May 2006" version="1.1.95">14963Clarify the object relationships reported in FollowReferences.14964</change>14965<change date="28 June 2006" version="1.1.98">14966Clarify DisposeEnvironment; add warning.14967Fix typos in SetLocalXXX "retrieve" => "set".14968Clarify that native method prefixes must remain set while used.14969Clarify that exactly one Agent_OnXXX is called per agent.14970Clarify that library loading is independent from start-up.14971Remove ambiguous reference to Agent_OnLoad in the Agent_OnUnload spec.14972</change>14973<change date="31 July 2006" version="1.1.99">14974Clarify the interaction between functions and exceptions.14975Clarify and give examples of field indices.14976Remove confusing "That is" sentence from MonitorWait and MonitorWaited events.14977Update links to point to Java 6.14978</change>14979<change date="6 August 2006" version="1.1.102">14980Add ResourceExhaustedEvent.14981</change>14982<change date="11 October 2012" version="1.2.2">14983Fixed the "HTTP" and "Missing Anchor" errors reported by the LinkCheck tool.14984</change>14985<change date="19 June 2013" version="1.2.3">14986Added support for statically linked agents.14987</change>14988<change date="13 October 2016" version="9.0.0">14989Support for modules:14990- The majorversion is 9 now14991- The ClassFileLoadHook events are not sent during the primordial phase anymore.14992- Allow CompiledMethodLoad events at start phase14993- Add new capabilities:14994- can_generate_early_vmstart14995- can_generate_early_class_hook_events14996- Add new functions:14997- GetAllModules14998- AddModuleReads, AddModuleExports, AddModuleOpens, AddModuleUses, AddModuleProvides14999- IsModifiableModule15000Clarified can_redefine_any_classes, can_retransform_any_classes and IsModifiableClass API to15001disallow some implementation defined classes.15002</change>15003<change date="12 February 2017" version="9.0.0">15004Minor update for GetCurrentThread function:15005- The function may return NULL in the start phase if the15006can_generate_early_vmstart capability is enabled.15007</change>15008<change date="7 February 2018" version="11.0.0">15009Minor update for new class file NestHost and NestMembers attributes:15010- Specify that RedefineClasses and RetransformClasses are not allowed15011to change the class file NestHost and NestMembers attributes.15012- Add new error JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_ATTRIBUTE_CHANGED15013that can be returned by RedefineClasses and RetransformClasses.15014</change>15015<change date="20 May 2019" version="13.0.0">15016Minor spec update for the capability "can_redefine_any_class".15017It now says:15018"RedefineClasses can be called on any modifiable class. See IsModifiableClass.15019(can_redefine_classes must also be set)"15020</change>15021<change date="5 June 2019" version="13.0.0">15022Minor PopFrame spec update:15023- The specified thread must be suspended or must be the current thread.15024(It was not allowed to be the current thread before.)15025</change>15026<change date="10 October 2019" version="14.0.0">15027Minor update for new class file Record attribute:15028- Specify that RedefineClasses and RetransformClasses are not allowed15029to change the class file Record attribute.15030</change>15031<change date="13 May 2020" version="15.0.0">15032Minor update for new class file PermittedSubclasses attribute:15033- Specify that RedefineClasses and RetransformClasses are not allowed15034to change the class file PermittedSubclasses attribute.15035</change>15036</changehistory>1503715038</specification>15039<!-- Keep this comment at the end of the file15040Local variables:15041mode: sgml15042sgml-omittag:t15043sgml-shorttag:t15044sgml-namecase-general:t15045sgml-general-insert-case:lower15046sgml-minimize-attributes:nil15047sgml-always-quote-attributes:t15048sgml-indent-step:215049sgml-indent-data:t15050sgml-parent-document:nil15051sgml-exposed-tags:nil15052sgml-local-catalogs:nil15053sgml-local-ecat-files:nil15054End:15055-->150561505715058