Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/src/share/vm/prims/jvmti.xml
32285 views
<?xml version="1.0" encoding="ISO-8859-1"?>1<?xml-stylesheet type="text/xsl" href="jvmti.xsl"?>2<!--3Copyright (c) 2002, 2013, 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.2324-->2526<!DOCTYPE specification [27<!ELEMENT specification (title, intro*, functionsection, errorsection,28eventsection, datasection, issuessection, changehistory)>29<!ATTLIST specification label CDATA #REQUIRED30majorversion CDATA #REQUIRED31minorversion CDATA #REQUIRED32microversion CDATA #REQUIRED>3334<!ELEMENT title (#PCDATA|jvmti|tm)*>35<!ATTLIST title subtitle CDATA #REQUIRED>3637<!ELEMENT intro ANY>38<!ATTLIST intro id CDATA #IMPLIED39label CDATA "">4041<!ELEMENT functionsection (intro*, category*)>42<!ATTLIST functionsection label CDATA #REQUIRED>4344<!ELEMENT category ((intro|typedef|uniontypedef|capabilitiestypedef)*,45(function|callback|elide)*)>46<!ATTLIST category id CDATA #REQUIRED47label CDATA #REQUIRED>4849<!ELEMENT function (synopsis, typedef*, description?, origin,50(capabilities|eventcapabilities),51parameters, errors)>52<!ATTLIST function id CDATA #REQUIRED53num CDATA #REQUIRED54phase (onload|onloadOnly|start|live|any) #IMPLIED55callbacksafe (safe|unsafe) #IMPLIED56impl CDATA #IMPLIED57hide CDATA #IMPLIED58jkernel (yes|no) #IMPLIED59since CDATA "1.0">6061<!ELEMENT callback ((jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread|jthreadGroup|jobject|62jvalue|enum|jint|jlong|jfloat|jdouble|jlocation|jboolean|char|uchar|size_t|void),63synopsis, description?, parameters)>64<!ATTLIST callback id CDATA #REQUIRED65since CDATA "1.0">6667<!ELEMENT synopsis (#PCDATA|jvmti)*>6869<!ELEMENT typedef (description?, field*)>70<!ATTLIST typedef id CDATA #REQUIRED71label CDATA #REQUIRED72since CDATA "1.0">7374<!ELEMENT uniontypedef (description?, field*)>75<!ATTLIST uniontypedef id CDATA #REQUIRED76label CDATA #REQUIRED77since CDATA "1.0">7879<!ELEMENT field ((jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread|jthreadGroup|jobject|80jvalue|enum|jint|jlong|jfloat|jdouble|jlocation|jboolean|char|uchar|size_t|void|allocfieldbuf|inptr|inbuf|outbuf|vmbuf|ptrtype|struct),81description)>82<!ATTLIST field id CDATA #REQUIRED>8384<!ELEMENT capabilitiestypedef (description?, capabilityfield*)>85<!ATTLIST capabilitiestypedef id CDATA #REQUIRED86label CDATA #REQUIRED>8788<!ELEMENT capabilityfield (description)>89<!ATTLIST capabilityfield id CDATA #REQUIRED90disp1 CDATA ""91disp2 CDATA ""92since CDATA "1.0">9394<!ELEMENT description ANY>9596<!ELEMENT capabilities (required*, capability*)>9798<!ELEMENT eventcapabilities EMPTY>99100<!ELEMENT required ANY>101<!ATTLIST required id CDATA #REQUIRED>102103<!ELEMENT capability ANY>104<!ATTLIST capability id CDATA #REQUIRED>105106<!ELEMENT parameters (param*)>107108<!ELEMENT param ((jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread|jthreadGroup|jobject|109jvalue|enum|jint|jlong|jfloat|jdouble|jlocation|jboolean|char|uchar|size_t|void|varargs|struct|ptrtype|110outptr|allocbuf|allocallocbuf|inptr|inbuf|outbuf|vmbuf|agentbuf),111description)>112<!ATTLIST param id CDATA #REQUIRED>113114<!ELEMENT jmethodID EMPTY>115<!ATTLIST jmethodID class CDATA #IMPLIED116native CDATA #IMPLIED>117118<!ELEMENT jfieldID EMPTY>119<!ATTLIST jfieldID class CDATA #IMPLIED>120121<!ELEMENT jclass EMPTY>122<!ATTLIST jclass method CDATA #IMPLIED123field CDATA #IMPLIED>124125<!ELEMENT jframeID EMPTY>126<!ATTLIST jframeID thread CDATA #IMPLIED>127128<!ELEMENT jrawMonitorID EMPTY>129130<!ELEMENT jthread EMPTY>131<!ATTLIST jthread started CDATA #IMPLIED132null CDATA #IMPLIED133frame CDATA #IMPLIED134impl CDATA #IMPLIED>135136<!ELEMENT varargs EMPTY>137138<!ELEMENT jthreadGroup EMPTY>139<!ELEMENT jobject EMPTY>140<!ELEMENT jvalue EMPTY>141<!ELEMENT jchar EMPTY>142<!ELEMENT jint EMPTY>143<!ATTLIST jint min CDATA #IMPLIED>144<!ELEMENT jlong EMPTY>145<!ELEMENT jfloat EMPTY>146<!ELEMENT jdouble EMPTY>147<!ELEMENT jlocation EMPTY>148<!ELEMENT jboolean EMPTY>149<!ELEMENT char EMPTY>150<!ELEMENT uchar EMPTY>151<!ELEMENT size_t EMPTY>152<!ELEMENT void EMPTY>153<!ELEMENT enum (#PCDATA)*>154<!ELEMENT struct (#PCDATA)*>155156<!ELEMENT nullok ANY>157158<!ELEMENT ptrtype ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread|159jthreadGroup|jobject|jvalue), nullok?)>160161<!ELEMENT outptr ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread|162jthreadGroup|jobject|jvalue|enum|jchar|jint|jlong|jfloat|jdouble|163jlocation|jboolean|char|uchar|size_t|void), nullok?)>164165<!ELEMENT allocbuf ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread|166jthreadGroup|jobject|jvalue|enum|jint|jlong|jfloat|jdouble|167jlocation|jboolean|char|uchar|size_t|void), nullok?)>168<!ATTLIST allocbuf incount CDATA #IMPLIED169outcount CDATA #IMPLIED>170171<!ELEMENT allocallocbuf ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread|172jthreadGroup|jobject|jvalue|enum|jint|jlong|jfloat|jdouble|173jlocation|jboolean|char|uchar|size_t|void), nullok?)>174<!ATTLIST allocallocbuf incount CDATA #IMPLIED175outcount CDATA #IMPLIED>176177<!ELEMENT inptr (struct, nullok?)>178179<!ELEMENT inbuf ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread|180jthreadGroup|jobject|jvalue|enum|jint|jlong|jfloat|jdouble|181jlocation|jboolean|char|uchar|size_t|void), nullok?)>182<!ATTLIST inbuf incount CDATA #IMPLIED>183184<!ELEMENT outbuf ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread|185jthreadGroup|jobject|jvalue|enum|jint|jlong|jfloat|jdouble|186jlocation|jboolean|char|uchar|size_t|void|outbuf), nullok?)>187<!ATTLIST outbuf incount CDATA #IMPLIED188outcount CDATA #IMPLIED>189190<!ELEMENT vmbuf ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread|191jthreadGroup|jobject|jvalue|enum|jchar|jint|jlong|jfloat|jdouble|192jlocation|jboolean|char|uchar|size_t|void), nullok?)>193<!ATTLIST vmbuf incount CDATA #IMPLIED194outcount CDATA #IMPLIED>195196<!ELEMENT agentbuf ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread|197jthreadGroup|jobject|jvalue|enum|jint|jlong|jfloat|jdouble|198jlocation|jboolean|char|uchar|size_t|void), nullok?)>199<!ATTLIST agentbuf incount CDATA #IMPLIED200outcount CDATA #IMPLIED>201202<!ELEMENT allocfieldbuf ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread|203jthreadGroup|jobject|jvalue|enum|jint|jlong|jfloat|jdouble|204jlocation|jboolean|char|uchar|size_t|void))>205<!ATTLIST allocfieldbuf outcount CDATA #IMPLIED>206207<!ELEMENT errors (error*)>208209<!ELEMENT error ANY>210<!ATTLIST error id CDATA #REQUIRED>211212<!ELEMENT errorsection (intro*, errorcategory*)>213<!ATTLIST errorsection label CDATA #REQUIRED>214215<!ELEMENT errorcategory (intro*, errorid*)>216<!ATTLIST errorcategory id CDATA #REQUIRED217label CDATA #REQUIRED>218219<!ELEMENT errorid ANY>220<!ATTLIST errorid id CDATA #REQUIRED221num CDATA #REQUIRED>222223<!ELEMENT datasection (intro*, basetypes*)>224225<!ELEMENT basetypes (intro*, basetype*)>226<!ATTLIST basetypes id CDATA #REQUIRED227label CDATA #REQUIRED>228229<!ELEMENT basetype (definition?,description)>230<!ATTLIST basetype id CDATA #REQUIRED>231232<!ELEMENT definition (#PCDATA|jvmti)*>233234<!ELEMENT eventsection (intro*, (event|elide)*)>235<!ATTLIST eventsection label CDATA #REQUIRED>236237<!ELEMENT event (description, origin, typedef*, capabilities, parameters)>238<!ATTLIST event id CDATA #REQUIRED239label CDATA #REQUIRED240const CDATA #REQUIRED241num CDATA #REQUIRED242phase (onload|start|live|any) #IMPLIED243filtered (thread|global) #IMPLIED244since CDATA "1.0">245246<!ELEMENT issuessection (intro*)>247<!ATTLIST issuessection label CDATA #REQUIRED>248249<!ELEMENT changehistory (intro*, change*)>250<!ATTLIST changehistory update CDATA #REQUIRED251id CDATA #REQUIRED>252253<!ELEMENT change ANY>254<!ATTLIST change date CDATA #REQUIRED255version CDATA #IMPLIED>256257<!ELEMENT functionlink (#PCDATA|jvmti|code|i|b)*>258<!ATTLIST functionlink id CDATA #REQUIRED>259260<!ELEMENT datalink (#PCDATA|jvmti|code|i|b)*>261<!ATTLIST datalink id CDATA #REQUIRED>262263<!ELEMENT typelink (#PCDATA|jvmti|code|i|b)*>264<!ATTLIST typelink id CDATA #REQUIRED>265266<!ELEMENT fieldlink (#PCDATA|jvmti|code|i|b)*>267<!ATTLIST fieldlink id CDATA #REQUIRED268struct CDATA #REQUIRED>269270<!ELEMENT paramlink (#PCDATA|jvmti|code|i|b)*>271<!ATTLIST paramlink id CDATA #REQUIRED>272273<!ELEMENT eventlink (#PCDATA|jvmti|code|i|b)*>274<!ATTLIST eventlink id CDATA #REQUIRED>275276<!ELEMENT errorlink (#PCDATA|jvmti|code|i|b|tm)*>277<!ATTLIST errorlink id CDATA #REQUIRED>278279<!ELEMENT externallink (#PCDATA|jvmti|code|i|b|tm)*>280<!ATTLIST externallink id CDATA #REQUIRED>281282<!ELEMENT vmspec EMPTY>283<!ATTLIST vmspec chapter CDATA #IMPLIED>284285<!ELEMENT internallink (#PCDATA|jvmti|code|i|b)*>286<!ATTLIST internallink id CDATA #REQUIRED>287288<!ELEMENT functionphaselist EMPTY>289<!ATTLIST functionphaselist phase (onload|onloadOnly|start|live|any) #REQUIRED>290291<!ELEMENT eventphaselist EMPTY>292<!ATTLIST eventphaselist phase (onload|start|live|any) #REQUIRED>293294<!ELEMENT issue ANY>295296<!ELEMENT rationale ANY>297298<!ELEMENT todo ANY>299300<!ELEMENT origin (#PCDATA)*>301302<!ELEMENT elide (intro|function|callback|event)*>303<!ATTLIST elide why CDATA #IMPLIED>304305<!ELEMENT constants (constant*)>306<!ATTLIST constants id CDATA #REQUIRED307label CDATA #REQUIRED308kind (enum|bits|const) #REQUIRED309since CDATA "1.0">310311<!ELEMENT constant ANY>312<!ATTLIST constant id CDATA #REQUIRED313num CDATA #REQUIRED>314315<!ELEMENT tm (#PCDATA)>316317<!ELEMENT i (#PCDATA|jvmti|tm)*>318319<!ELEMENT b (#PCDATA|jvmti|code)*>320321<!ELEMENT code (#PCDATA|space)*>322323<!ELEMENT pre ANY>324325<!ELEMENT space EMPTY>326327<!ELEMENT jvmti EMPTY>328329<!ELEMENT example (#PCDATA|i)*>330331<!ELEMENT br EMPTY>332333<!ELEMENT p EMPTY>334335<!ELEMENT dl (dt|dd)+>336337<!ELEMENT dd ANY>338339<!ELEMENT dt (#PCDATA|jvmti|code|i|b)*>340341<!ELEMENT table (tr)+>342343<!ELEMENT tr (td|th)*>344345<!ELEMENT td ANY>346<!ATTLIST td align (left|right|center) "center">347348<!ELEMENT th ANY>349<!ATTLIST th align (left|right|center) "center">350351<!ELEMENT ul (li)+>352<!ATTLIST ul type (disc|circle|square) "disc">353354<!ELEMENT li ANY>355]>356357<specification label="JVM(TM) Tool Interface"358majorversion="1"359minorversion="2"360microversion="3">361<title subtitle="Version">362<tm>JVM</tm> Tool Interface363</title>364365<intro id="whatIs" label="What is the JVM Tool Interface?">366The <tm>JVM</tm> Tool Interface (<jvmti/>)367is a programming interface used by development and monitoring tools.368It provides both a way to inspect the state and369to control the execution of applications running in the370<tm>Java</tm> virtual machine (VM).371<p/>372<jvmti/> is intended to provide a VM interface for the full breadth of tools373that need access to VM state, including but not limited to: profiling,374debugging, monitoring, thread analysis, and coverage analysis tools.375<p/>376<jvmti/> may not be available in all implementations of the <tm>Java</tm> virtual377machine.378<p/>379<jvmti/> is a two-way interface.380A client of <jvmti/>, hereafter called an <i>agent</i>,381can be notified of382interesting occurrences through <internallink id="EventSection">events</internallink>.383<jvmti/>384can query and control the application through many385<internallink id="FunctionSection">functions</internallink>,386either in response to events or387independent of them.388<p/>389Agents run in the same process with and communicate directly with390the virtual machine executing391the application being examined. This communication is392through a native interface (<jvmti/>). The native in-process interface allows393maximal control with minimal intrusion on the part of a tool.394Typically, agents are relatively compact. They can be controlled395by a separate process which implements the bulk of a tool's396function without interfering with the target application's normal execution.397</intro>398399<intro id="architecture" label="Architecture">400Tools can be written directly to <jvmti/> or indirectly401through higher level interfaces.402The Java Platform Debugger Architecture includes <jvmti/>, but also403contains higher-level, out-of-process debugger interfaces. The higher-level404interfaces are more appropriate than <jvmti/> for many tools.405For more information on the Java Platform Debugger Architecture,406see the407<externallink id="http://docs.oracle.com/javase/7/docs/technotes/guides/jpda/architecture.html">Java408Platform Debugger Architecture website</externallink>.409</intro>410411<intro id="writingAgents" label="Writing Agents">412Agents can be written in any native language that supports C413language calling conventions and C or C++414definitions.415<p/>416The function, event, data type, and constant definitions needed for417using <jvmti/> are defined in the include file <code>jvmti.h</code>.418To use these definitions add the <tm>J2SE</tm> include directory419to your include path and add420<example>421#include <jvmti.h>422</example>423to your source code.424</intro>425426<intro id="deployingAgents" label="Deploying Agents">427An agent is deployed in a platform specific manner but is typically the428platform equivalent of a dynamic library. On the <tm>Windows</tm> operating429system, for example, an agent library is a "Dynamic Linked Library" (DLL).430On the <tm>Solaris</tm> Operating Environment, an agent library is a shared431object (<code>.so</code> file).432<p/>433434An agent may be started at VM startup by specifying the agent library435name using a <internallink id="starting">command line option</internallink>.436Some implementations may support a mechanism to <internallink id="onattach">437start agents</internallink> in the live <functionlink id="GetPhase">phase</functionlink>.438The details of how this is initiated are implementation specific.439</intro>440441<intro id="entry point" label="Statically Linked Agents (since version 1.2.3)">442443A native JVMTI Agent may be <i>statically linked</i> with the VM.444The manner in which the library and VM image are combined is445implementation-dependent.446An agent L whose image has been combined with the VM is defined as447<i>statically linked</i> if and only if the agent exports a function448called Agent_OnLoad_L.449<p/>450If a <i>statically linked</i> agent L exports a function called451Agent_OnLoad_L and a function called Agent_OnLoad, the Agent_OnLoad452function will be ignored.453If an agent L is <i>statically linked</i>, an Agent_OnLoad_L454function will be invoked with the same arguments and expected return455value as specified for the Agent_OnLoad function.456An agent L that is <i>statically linked</i> will prohibit an agent of457the same name from being loaded dynamically.458<p/>459The VM will invoke the Agent_OnUnload_L function of the agent, if such460a function is exported, at the same point during VM execution as it would461have called the dynamic entry point Agent_OnUnLoad. A statically loaded462agent cannot be unloaded. The Agent_OnUnload_L function will still be463called to do any other agent shutdown related tasks.464If a <i>statically linked</i> agent L exports a function called465Agent_OnUnLoad_L and a function called Agent_OnUnLoad, the Agent_OnUnLoad466function will be ignored.467<p/>468If an agent L is <i>statically linked</i>, an Agent_OnAttach_L function469will be invoked with the same arguments and expected return value as470specified for the Agent_OnAttach function.471If a <i>statically linked</i> agent L exports a function called472Agent_OnAttach_L and a function called Agent_OnAttach, the Agent_OnAttach473function will be ignored.474</intro>475476<intro id="starting" label="Agent Command Line Options">477The term "command-line option" is used below to478mean options supplied in the <code>JavaVMInitArgs</code> argument479to the <code>JNI_CreateJavaVM</code> function of the JNI480Invocation API.481<p/>482One of the two following483command-line options is used on VM startup to484properly load and run agents.485These arguments identify the library containing486the agent as well as an options487string to be passed in at startup.488<dl>489<dt><code>-agentlib:</code><i><agent-lib-name></i><code>=</code><i><options></i></dt>490<dd>491The name following <code>-agentlib:</code> is the name of the492library to load. Lookup of the library, both its full name and location,493proceeds in a platform-specific manner.494Typically, the <i><agent-lib-name></i> is expanded to an495operating system specific file name.496The <i><options></i> will be passed to the agent on start-up.497For example, if the option498<code>-agentlib:foo=opt1,opt2</code> is specified, the VM will attempt to499load the shared library <code>foo.dll</code> from the system <code>PATH</code>500under <tm>Windows</tm> or <code>libfoo.so</code> from the501<code>LD_LIBRARY_PATH</code> under the <tm>Solaris</tm> operating502environment.503If the agent library is statically linked into the executable504then no actual loading takes place.505<p/>506</dd>507<dt><code>-agentpath:</code><i><path-to-agent></i><code>=</code><i><options></i></dt>508<dd>509The path following <code>-agentpath:</code> is the absolute path from which510to load the library.511No library name expansion will occur.512The <i><options></i> will be passed to the agent on start-up.513For example, if the option514<code>-agentpath:c:\myLibs\foo.dll=opt1,opt2</code> is specified, the VM will attempt to515load the shared library <code>c:\myLibs\foo.dll</code>. If the agent516library is statically linked into the executable517then no actual loading takes place.518<p/>519</dd>520</dl>521For a dynamic shared library agent, the start-up routine522<internallink id="onload"><code>Agent_OnLoad</code></internallink>523in the library will be invoked. If the agent library is statically linked524into the executable then the system will attempt to invoke the525<code>Agent_OnLoad_<agent-lib-name></code> entry point where526<agent-lib-name> is the basename of the527agent. In the above example <code>-agentpath:c:\myLibs\foo.dll=opt1,opt2</code>,528the system will attempt to find and call the <code>Agent_OnLoad_foo</code> start-up routine.529<p/>530Libraries loaded with <code>-agentlib:</code> or <code>-agentpath:</code>531will be searched for JNI native method implementations to facilitate the532use of Java programming language code in tools, as is needed for533<internallink id="bci">bytecode instrumentation</internallink>.534<p/>535The agent libraries will be searched after all other libraries have been536searched (agents wishing to override or intercept the native method537implementations of non-agent methods can use the538<eventlink id="NativeMethodBind">NativeMethodBind event</eventlink>).539<p/>540These switches do the above and nothing more - they do not change the541state of the VM or <jvmti/>. No command line options are needed542to enable <jvmti/>543or aspects of <jvmti/>, this is handled programmatically544by the use of545<internallink id="capability">capabilities</internallink>.546</intro>547548<intro id="startup" label="Agent Start-Up">549The VM starts each agent by invoking a start-up function.550If the agent is started in the <code>OnLoad</code>551<functionlink id="GetPhase">phase</functionlink> the function552<internallink id="onload"><code>Agent_OnLoad</code></internallink>553or <internallink id="onload"><code>Agent_OnLoad_L</code></internallink>554for statically linked agents will be invoked.555If the agent is started in the live556<functionlink id="GetPhase">phase</functionlink> the function557<internallink id="onattach"><code>Agent_OnAttach</code></internallink>558or <internallink id="onattach"><code>Agent_OnAttach_L</code></internallink>559for statically linked agents will be invoked.560Exactly one call to a start-up function is made per agent.561</intro>562563<intro id="onload" label="Agent Start-Up (OnLoad phase)">564If an agent is started during the <code>OnLoad</code> phase then its565agent library must export a start-up function with the following prototype:566<example>567JNIEXPORT jint JNICALL568Agent_OnLoad(JavaVM *vm, char *options, void *reserved)</example>569Or for a statically linked agent named 'L':570<example>571JNIEXPORT jint JNICALL572Agent_OnLoad_L(JavaVM *vm, char *options, void *reserved)</example>573574The VM will start the agent by calling this function.575It will be called early enough in VM initialization that:576<ul>577<li><functionlink id="SetSystemProperty">system properties</functionlink>578may be set before they have been used in the start-up of the VM</li>579<li>the full set of580<internallink id="capability">capabilities</internallink>581is still available (note that capabilities that configure the VM582may only be available at this time--see the583<internallink id="capability">Capability function section</internallink>)</li>584<li>no bytecodes have executed</li>585<li>no classes have been loaded</li>586<li>no objects have been created</li>587</ul>588<p/>589The VM will call the <code>Agent_OnLoad</code> or590<code>Agent_OnLoad_<agent-lib-name></code> function with591<i><options></i> as the second argument -592that is, using the command-line option examples,593<code>"opt1,opt2"</code> will be passed to the <code>char *options</code>594argument of <code>Agent_OnLoad</code>.595The <code>options</code> argument is encoded as a596<internallink id="mUTF">modified UTF-8</internallink> string.597If <i>=<options></i> is not specified,598a zero length string is passed to <code>options</code>.599The lifespan of the <code>options</code> string is the600<code>Agent_OnLoad</code> or <code>Agent_OnLoad_<agent-lib-name></code>601call. If needed beyond this time the string or parts of the string must602be copied.603The period between when <code>Agent_OnLoad</code> is called and when it604returns is called the <i>OnLoad phase</i>.605Since the VM is not initialized during the OnLoad606<functionlink id="GetPhase">phase</functionlink>,607the set of allowed operations608inside <code>Agent_OnLoad</code> is restricted (see the function descriptions for the609functionality available at this time).610The agent can safely process the options and set611event callbacks with <functionlink id="SetEventCallbacks"></functionlink>. Once612the VM initialization event is received613(that is, the <eventlink id="VMInit">VMInit</eventlink>614callback is invoked), the agent615can complete its initialization.616<rationale>617Early startup is required so that agents can set the desired capabilities,618many of which must be set before the VM is initialized.619In JVMDI, the -Xdebug command-line option provided620very coarse-grain control of capabilities.621JVMPI implementations use various tricks to provide a single "JVMPI on" switch.622No reasonable command-line623option could provide the fine-grain of control required to balance needed capabilities vs624performance impact.625Early startup is also needed so that agents can control the execution626environment - modifying the file system and system properties to install627their functionality.628</rationale>629<p/>630The return value from <code>Agent_OnLoad</code> or631<code>Agent_OnLoad_<agent-lib-name></code> is used to indicate an error.632Any value other than zero indicates an error and causes termination of the VM.633</intro>634635<intro id="onattach" label="Agent Start-Up (Live phase)">636A VM may support a mechanism that allows agents to be started in the VM during the live637<functionlink id="GetPhase">phase</functionlink>. The details of how this is supported,638are implementation specific. For example, a tool may use some platform specific mechanism,639or implementation specific API, to attach to the running VM, and request it start a given640agent.641<p/>642If an agent is started during the live phase then its agent library643must export a start-up function644with the following prototype:645<example>646JNIEXPORT jint JNICALL647Agent_OnAttach(JavaVM* vm, char *options, void *reserved)</example>648Or for a statically linked agent named 'L':649<example>650JNIEXPORT jint JNICALL651Agent_OnAttach_L(JavaVM* vm, char *options, void *reserved)</example>652653<p/>654The VM will start the agent by calling this function.655It will be called in the context of a thread656that is attached to the VM. The first argument <i><vm></i> is the Java VM.657The <i><options></i> argument is the startup options provided to the agent.658<i><options></i> is encoded as a <internallink id="mUTF">modified UTF-8659</internallink> string.660If startup options were not provided, a zero length string is passed to661<code>options</code>. The lifespan of the <code>options</code> string is the662<code>Agent_OnAttach</code> or <code>Agent_OnAttach_<agent-lib-name></code> call.663If needed beyond this time the string or parts of the string must be copied.664<p/>665Note that some <internallink id="capability">capabilities</internallink>666may not be available in the live phase.667<p/>668The <code>Agent_OnAttach</code> or <code>Agent_OnAttach_<agent-lib-name669></code> function initializes the agent and returns a value670to the VM to indicate if an error occurred. Any value other than zero indicates an error.671An error does not cause the VM to terminate. Instead the VM ignores the error, or takes672some implementation specific action -- for example it might print an error to standard error,673or record the error in a system log.674</intro>675676<intro id="onunload" label="Agent Shutdown">677The library may optionally export a678shutdown function with the following prototype:679<example>680JNIEXPORT void JNICALL681Agent_OnUnload(JavaVM *vm)</example>682Or for a statically linked agent named 'L':683<example>684JNIEXPORT void JNICALL685Agent_OnUnload_L(JavaVM *vm)</example>686687This function will be called by the VM when the library is about to be unloaded.688The library will be unloaded (unless it is statically linked into the689executable) and this function will be called if some platform specific690mechanism causes the unload (an unload mechanism is not specified in this document)691or the library is (in effect) unloaded by the termination of the VM whether through692normal termination or VM failure, including start-up failure.693Uncontrolled shutdown is, of couse, an exception to this rule.694Note the distinction between this function and the695<eventlink id="VMDeath">VM Death event</eventlink>: for the VM Death event696to be sent, the VM must have run at least to the point of initialization and a valid697<jvmti/> environment must exist which has set a callback for VMDeath698and enabled the event.699None of these are required for <code>Agent_OnUnload</code> or700<code>Agent_OnUnload_<agent-lib-name></code> and this function701is also called if the library is unloaded for other reasons.702In the case that a VM Death event is sent, it will be sent before this703function is called (assuming this function is called due to VM termination).704This function can be used to clean-up resources allocated by the agent.705</intro>706707<intro id="tooloptions" label="JAVA_TOOL_OPTIONS">708Since the command-line cannot always be accessed or modified, for example in embedded VMs709or simply VMs launched deep within scripts, a <code>JAVA_TOOL_OPTIONS</code> variable is710provided so that agents may be launched in these cases.711<p/>712Platforms which support environment variables or other named strings, may support the713<code>JAVA_TOOL_OPTIONS</code> variable. This variable will be broken into options at white-space714boundaries. White-space characters include space, tab, carriage-return, new-line,715vertical-tab, and form-feed. Sequences of white-space characters are considered716equivalent to a single white-space character. No white-space is included in the options717unless quoted. Quoting is as follows:718<ul>719<li>All characters enclosed between a pair of single quote marks (''), except a single720quote, are quoted.</li>721<li>Double quote characters have no special meaning inside a pair of single quote marks.</li>722<li>All characters enclosed between a pair of double quote marks (""), except a double723quote, are quoted.</li>724<li>Single quote characters have no special meaning inside a pair of double quote marks.</li>725<li>A quoted part can start or end anywhere in the variable.</li>726<li>White-space characters have no special meaning when quoted -- they are included in727the option like any other character and do not mark white-space boundaries.</li>728<li>The pair of quote marks is not included in the option.</li>729</ul>730<code>JNI_CreateJavaVM</code> (in the JNI Invocation API) will prepend these options to the options supplied731in its <code>JavaVMInitArgs</code> argument. Platforms may disable this feature in cases where security is732a concern; for example, the Reference Implementation disables this feature on Unix systems when733the effective user or group ID differs from the real ID.734This feature is intended to support the initialization of tools -- specifically including the735launching of native or Java programming language agents. Multiple tools may wish to use this736feature, so the variable should not be overwritten, instead, options should be appended to737the variable. Note that since the variable is processed at the time of the JNI Invocation738API create VM call, options processed by a launcher (e.g., VM selection options) will not be handled.739</intro>740741<intro id="environments" label="Environments">742The <jvmti/> specification supports the use of multiple simultaneous743<jvmti/> agents.744Each agent has its own <jvmti/> environment.745That is, the <jvmti/> state is746separate for each agent - changes to one environment do not affect the747others. The state of a <jvmti/>748environment includes:749<ul>750<li><functionlink id="SetEventCallbacks">the event callbacks</functionlink></li>751<li><functionlink id="SetEventNotificationMode">the set of events which are enabled</functionlink></li>752<li><internallink id="capability">the capabilities</internallink></li>753<li><internallink id="memory">the memory allocation/deallocation hooks</internallink></li>754</ul>755Although their <jvmti/> state756is separate, agents inspect and modify the shared state757of the VM, they also share the native environment in which they execute.758As such, an agent can perturb the results of other agents or cause them759to fail. It is the responsibility of the agent writer to specify the level760of compatibility with other agents. <jvmti/> implementations are not capable761of preventing destructive interactions between agents. Techniques to reduce762the likelihood of these occurrences are beyond the scope of this document.763<p/>764An agent creates a <jvmti/> environment765by passing a <jvmti/> version766as the interface ID to the JNI Invocation API function767<externallink id="http://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/invocation.html#GetEnv"><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 object allocation events and 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="mUTF" label="Modified UTF-8 String Encoding">866<jvmti/> uses modified UTF-8 to encode character strings.867This is the same encoding used by JNI.868Modified UTF-8 differs869from standard UTF-8 in the representation of supplementary characters870and of the null character. See the871<externallink id="http://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/types.html#wp16542">872Modified UTF-8 Strings</externallink>873section of the JNI specification for details.874</intro>875876<intro id="context" label="Specification Context">877Since this interface provides access to the state of applications running in the878Java virtual machine;879terminology refers to the Java platform and not the native880platform (unless stated otherwise). For example:881<ul>882<li>"thread" means Java programming language thread.</li>883<li>"stack frame" means Java virtual machine stack frame.</li>884<li>"class" means Java programming language class.</li>885<li>"heap" means Java virtual machine heap.</li>886<li>"monitor" means Java programming language object monitor.</li>887</ul>888<p/>889Sun, Sun Microsystems, the Sun logo, Java, and JVM890are trademarks or registered trademarks of Oracle891and/or its affiliates, in the U.S. and other countries.892</intro>893894895<functionsection label="Functions">896<intro id="jvmtiEnvAccess" label="Accessing Functions">897Native code accesses <jvmti/> features898by calling <jvmti/> functions.899Access to <jvmti/> functions is by use of an interface pointer900in the same manner as901<externallink id="http://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/design.html">Java902Native Interface (JNI) functions</externallink> are accessed.903The <jvmti/> interface pointer is called the904<i>environment pointer</i>.905<p/>906An environment pointer is a pointer to an environment and has907the type <code>jvmtiEnv*</code>.908An environment has information about its <jvmti/> connection.909The first value in the environment is a pointer to the function table.910The function table is an array of pointers to <jvmti/> functions.911Every function pointer is at a predefined offset inside the912array.913<p/>914When used from the C language:915double indirection is used to access the functions;916the environment pointer provides context and is the first917parameter of each function call; for example:918<example>919jvmtiEnv *jvmti;920...921jvmtiError err = (*jvmti)->GetLoadedClasses(jvmti, &class_count, &classes);922</example>923<p/>924When used from the C++ language:925functions are accessed as member functions of <code>jvmtiEnv</code>;926the environment pointer is not passed to the function call; for example:927<example>928jvmtiEnv *jvmti;929...930jvmtiError err = jvmti->GetLoadedClasses(&class_count, &classes);931</example>932Unless otherwise stated, all examples and declarations in this933specification use the C language.934<p/>935A <jvmti/> environment can be obtained through the JNI Invocation API936<code>GetEnv</code> function:937<example>938jvmtiEnv *jvmti;939...940(*jvm)->GetEnv(jvm, &jvmti, JVMTI_VERSION_1_0);941</example>942Each call to <code>GetEnv</code>943creates a new <jvmti/> connection and thus944a new <jvmti/> environment.945The <code>version</code> argument of <code>GetEnv</code> must be946a <jvmti/> version.947The returned environment may have a different version than the948requested version but the returned environment must be compatible.949<code>GetEnv</code> will return <code>JNI_EVERSION</code> if a950compatible version is not available, if <jvmti/> is not supported or951<jvmti/> is not supported in the current VM configuration.952Other interfaces may be added for creating <jvmti/> environments953in specific contexts.954Each environment has its own state (for example,955<functionlink id="SetEventNotificationMode">desired events</functionlink>,956<functionlink id="SetEventCallbacks">event handling functions</functionlink>, and957<functionlink id="AddCapabilities">capabilities</functionlink>).958An environment is released with959<functionlink id="DisposeEnvironment"></functionlink>.960Thus, unlike JNI which has one environment per thread, <jvmti/> environments work961across threads and are created dynamically.962</intro>963964<intro id="functionReturn" label="Function Return Values">965<jvmti/> functions always return an966<internallink id="ErrorSection">error code</internallink> via the967<datalink id="jvmtiError"/> function return value.968Some functions can return additional969values through pointers provided by the calling function.970In some cases, <jvmti/> functions allocate memory that your program must971explicitly deallocate. This is indicated in the individual <jvmti/>972function descriptions. Empty lists, arrays, sequences, etc are973returned as <code>NULL</code>.974<p/>975In the event that the <jvmti/> function encounters976an error (any return value other than <code>JVMTI_ERROR_NONE</code>) the values977of memory referenced by argument pointers is undefined, but no memory978will have been allocated and no global references will have been allocated.979If the error occurs because of invalid input, no action will have occurred.980</intro>981982<intro id="refs" label="Managing JNI Object References">983<jvmti/> functions identify objects with JNI references984(<datalink id="jobject"/> and <datalink id="jclass"/>)985and their derivatives986(<datalink id="jthread"/> and <datalink id="jthreadGroup"/>).987References passed to988<jvmti/> functions can be either global or local, but they must be989strong references. All references returned by <jvmti/> functions are990local references--these local references are created991during the <jvmti/> call.992Local references are a resource that must be managed (see the993<externallink id="http://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/functions.html#wp18654">JNI Documentation</externallink>).994When threads return from native code all local references995are freed. Note that some threads, including typical996agent threads, will never return from native code.997A thread is ensured the ability to create sixteen local998references without the need for any explicit management.999For threads executing a limited number of <jvmti/> calls before1000returning from native code1001(for example, threads processing events),1002it may be determined that no explicit management1003is needed.1004However, long running agent threads will need explicit1005local reference management--usually with the JNI functions1006<code>PushLocalFrame</code> and <code>PopLocalFrame</code>.1007Conversely, to preserve references beyond the1008return from native code, they must be converted to global references.1009These rules do not apply to <datalink id="jmethodID"/> and <datalink id="jfieldID"/>1010as they are not <datalink id="jobject"/>s.1011</intro>10121013<intro id="prereqState" label="Prerequisite State for Calling Functions">1014Unless the function explicitly states that the agent must bring1015a thread or the VM to a particular state (for example, suspended),1016the <jvmti/> implementation is responsible for bringing the VM to a1017safe and consistent state for performing the function.1018</intro>10191020<intro id="functionsExceptions" label="Exceptions and Functions">1021<jvmti/> functions never throw exceptions; error conditions are1022communicated via the1023<internallink id="functionReturn">function return value</internallink>.1024Any existing exception state is preserved across a call to a1025<jvmti/> function.1026See the1027<externallink1028id="http://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/design.html#wp770"1029>Java Exceptions</externallink>1030section of the JNI specification for information on handling exceptions.1031</intro>10321033<category id="memory" label="Memory Management">1034<intro>1035These functions provide for the allocation and deallocation of1036memory used by <jvmti/> functionality and can be used to provide1037working memory for agents.1038Memory managed by <jvmti/> is not compatible with other memory1039allocation libraries and mechanisms.1040</intro>10411042<function id="Allocate" jkernel="yes" phase="any" callbacksafe="safe" impl="notrace" num="46">1043<synopsis>Allocate</synopsis>1044<description>1045Allocate an area of memory through the <jvmti/> allocator.1046The allocated1047memory should be freed with <functionlink id="Deallocate"></functionlink>.1048</description>1049<origin>jvmdi</origin>1050<capabilities>1051</capabilities>1052<parameters>1053<param id="size">1054<jlong/>1055<description>1056The number of bytes to allocate.1057<rationale>1058<code>jlong</code> is used for compatibility with JVMDI.1059</rationale>1060</description>1061</param>1062<param id="mem_ptr">1063<allocbuf incount="size"><uchar/></allocbuf>1064<description>1065On return, a pointer to the beginning of the allocated memory.1066If <code>size</code> is zero, <code>NULL</code> is returned.1067</description>1068</param>1069</parameters>1070<errors>1071<error id="JVMTI_ERROR_OUT_OF_MEMORY">1072Memory request cannot be honored.1073</error>1074<error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">1075<paramlink id="size"></paramlink> is less than zero.1076</error>1077</errors>1078</function>10791080<function id="Deallocate" jkernel="yes" phase="any" callbacksafe="safe" impl="notrace" num="47">1081<synopsis>Deallocate</synopsis>1082<description>1083Deallocate <code>mem</code> using the <jvmti/> allocator.1084This function should1085be used to deallocate any memory allocated and returned1086by a <jvmti/> function1087(including memory allocated with <functionlink id="Allocate"></functionlink>).1088All allocated memory must be deallocated1089or the memory cannot be reclaimed.1090</description>1091<origin>jvmdi</origin>1092<capabilities>1093</capabilities>1094<parameters>1095<param id="mem">1096<outbuf>1097<uchar/>1098<nullok>the call is ignored</nullok>1099</outbuf>1100<description>1101A pointer to the beginning of the allocated memory.1102Please ignore "On return, the elements are set."1103<todo>keep it from generating "On return, the elements are set"</todo>1104</description>1105</param>1106</parameters>1107<errors>1108</errors>1109</function>1110</category>11111112<category id="threadCategory" label="Thread">1113<intro>1114</intro>11151116<function id="GetThreadState" num="17">1117<synopsis>Get Thread State</synopsis>1118<description>1119Get the state of a thread. The state of the thread is represented by the1120answers to the hierarchical set of questions below:1121<ul type="circle">1122<li><i>Alive?</i>1123<ul>1124<li>Not alive.1125<ul type="circle">1126<li><i>Why not alive?</i>1127<ul>1128<li>New.</li>1129<li>Terminated (<datalink1130id="JVMTI_THREAD_STATE_TERMINATED"><code>JVMTI_THREAD_STATE_TERMINATED</code></datalink>)</li>1131</ul>1132</li>1133</ul>1134</li>1135<li>Alive (<datalink1136id="JVMTI_THREAD_STATE_ALIVE"><code>JVMTI_THREAD_STATE_ALIVE</code></datalink>)1137<ul type="circle">1138<li><i>Suspended?</i>1139<ul>1140<li>Suspended (<datalink1141id="JVMTI_THREAD_STATE_SUSPENDED"><code>JVMTI_THREAD_STATE_SUSPENDED</code></datalink>)</li>1142<li>Not suspended</li>1143</ul>1144</li>1145<li><i>Interrupted?</i>1146<ul>1147<li>Interrupted (<datalink1148id="JVMTI_THREAD_STATE_INTERRUPTED"><code>JVMTI_THREAD_STATE_INTERRUPTED</code></datalink>)</li>1149<li>Not interrupted.</li>1150</ul>1151</li>1152<li><i>In native?</i>1153<ul>1154<li>In native code (<datalink1155id="JVMTI_THREAD_STATE_IN_NATIVE"><code>JVMTI_THREAD_STATE_IN_NATIVE</code></datalink>)</li>1156<li>In Java programming language code</li>1157</ul>1158</li>1159<li><i>What alive state?</i>1160<ul>1161<li>Runnable (<datalink1162id="JVMTI_THREAD_STATE_RUNNABLE"><code>JVMTI_THREAD_STATE_RUNNABLE</code></datalink>)</li>1163<li>Blocked (<datalink1164id="JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER"><code>JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER</code></datalink>)</li>1165<li>Waiting (<datalink1166id="JVMTI_THREAD_STATE_WAITING"><code>JVMTI_THREAD_STATE_WAITING</code></datalink>)1167<ul type="circle">1168<li><i>Timed wait?</i>1169<ul>1170<li>Indefinite (<datalink1171id="JVMTI_THREAD_STATE_WAITING_INDEFINITELY"><code>JVMTI_THREAD_STATE_WAITING_INDEFINITELY</code></datalink></li>1172<li>Timed (<datalink1173id="JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT"><code>JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT</code></datalink>)</li>1174</ul>1175</li>1176<li><i>Why waiting?</i>1177<ul>1178<li>Object.wait (<datalink1179id="JVMTI_THREAD_STATE_IN_OBJECT_WAIT"><code>JVMTI_THREAD_STATE_IN_OBJECT_WAIT</code></datalink>)</li>1180<li>LockSupport.park (<datalink1181id="JVMTI_THREAD_STATE_PARKED"><code>JVMTI_THREAD_STATE_PARKED</code></datalink>)</li>1182<li>Sleeping (<datalink1183id="JVMTI_THREAD_STATE_SLEEPING"><code>JVMTI_THREAD_STATE_SLEEPING</code></datalink>)</li>1184</ul>1185</li>1186</ul>1187</li>1188</ul>1189</li>1190</ul>1191</li>1192</ul>1193</li>1194</ul>1195<p/>1196The answers are represented by the following bit vector.1197<constants id="jvmtiThreadState" label="Thread State Flags" kind="bits">1198<constant id="JVMTI_THREAD_STATE_ALIVE" num="0x0001">1199Thread is alive. Zero if thread is new (not started) or terminated.1200</constant>1201<constant id="JVMTI_THREAD_STATE_TERMINATED" num="0x0002">1202Thread has completed execution.1203</constant>1204<constant id="JVMTI_THREAD_STATE_RUNNABLE" num="0x0004">1205Thread is runnable.1206</constant>1207<constant id="JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER" num="0x0400">1208Thread is waiting to enter a synchronization block/method or,1209after an <code>Object.wait()</code>, waiting to re-enter a1210synchronization block/method.1211</constant>1212<constant id="JVMTI_THREAD_STATE_WAITING" num="0x0080">1213Thread is waiting.1214</constant>1215<constant id="JVMTI_THREAD_STATE_WAITING_INDEFINITELY" num="0x0010">1216Thread is waiting without a timeout.1217For example, <code>Object.wait()</code>.1218</constant>1219<constant id="JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT" num="0x0020">1220Thread is waiting with a maximum time to wait specified.1221For example, <code>Object.wait(long)</code>.1222</constant>1223<constant id="JVMTI_THREAD_STATE_SLEEPING" num="0x0040">1224Thread is sleeping -- <code>Thread.sleep(long)</code>.1225</constant>1226<constant id="JVMTI_THREAD_STATE_IN_OBJECT_WAIT" num="0x0100">1227Thread is waiting on an object monitor -- <code>Object.wait</code>.1228</constant>1229<constant id="JVMTI_THREAD_STATE_PARKED" num="0x0200">1230Thread is parked, for example: <code>LockSupport.park</code>,1231<code>LockSupport.parkUtil</code> and <code>LockSupport.parkNanos</code>.1232</constant>1233<constant id="JVMTI_THREAD_STATE_SUSPENDED" num="0x100000">1234Thread suspended.1235<code>java.lang.Thread.suspend()</code>1236or a <jvmti/> suspend function1237(such as <functionlink id="SuspendThread"></functionlink>)1238has been called on the thread. If this bit1239is set, the other bits refer to the thread state before suspension.1240</constant>1241<constant id="JVMTI_THREAD_STATE_INTERRUPTED" num="0x200000">1242Thread has been interrupted.1243</constant>1244<constant id="JVMTI_THREAD_STATE_IN_NATIVE" num="0x400000">1245Thread is in native code--that is, a native method is running1246which has not called back into the VM or Java programming1247language code.1248<p/>1249This flag is not set when running VM compiled Java programming1250language code nor is it set when running VM code or1251VM support code. Native VM interface functions, such as JNI and1252<jvmti/> functions, may be implemented as VM code.1253</constant>1254<constant id="JVMTI_THREAD_STATE_VENDOR_1" num="0x10000000">1255Defined by VM vendor.1256</constant>1257<constant id="JVMTI_THREAD_STATE_VENDOR_2" num="0x20000000">1258Defined by VM vendor.1259</constant>1260<constant id="JVMTI_THREAD_STATE_VENDOR_3" num="0x40000000">1261Defined by VM vendor.1262</constant>1263</constants>1264The following definitions are used to convert <jvmti/> thread state1265to <code>java.lang.Thread.State</code> style states.1266<constants id="jvmtiJavaLangThreadState" label="java.lang.Thread.State Conversion Masks" kind="bits">1267<constant id="JVMTI_JAVA_LANG_THREAD_STATE_MASK"1268num="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">1269Mask the state with this before comparison1270</constant>1271<constant id="JVMTI_JAVA_LANG_THREAD_STATE_NEW"1272num="0">1273<code>java.lang.Thread.State.NEW</code>1274</constant>1275<constant id="JVMTI_JAVA_LANG_THREAD_STATE_TERMINATED"1276num="JVMTI_THREAD_STATE_TERMINATED">1277<code>java.lang.Thread.State.TERMINATED</code>1278</constant>1279<constant id="JVMTI_JAVA_LANG_THREAD_STATE_RUNNABLE"1280num="JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_RUNNABLE">1281<code>java.lang.Thread.State.RUNNABLE</code>1282</constant>1283<constant id="JVMTI_JAVA_LANG_THREAD_STATE_BLOCKED"1284num="JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER">1285<code>java.lang.Thread.State.BLOCKED</code>1286</constant>1287<constant id="JVMTI_JAVA_LANG_THREAD_STATE_WAITING"1288num="JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_WAITING | JVMTI_THREAD_STATE_WAITING_INDEFINITELY">1289<code>java.lang.Thread.State.WAITING</code>1290</constant>1291<constant id="JVMTI_JAVA_LANG_THREAD_STATE_TIMED_WAITING"1292num="JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_WAITING | JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT">1293<code>java.lang.Thread.State.TIMED_WAITING</code>1294</constant>1295</constants>1296<b>Rules</b>1297<p/>1298There can be no more than one answer to a question, although there can be no1299answer (because the answer is unknown, does not apply, or none of the answers is1300correct). An answer is set only when the enclosing answers match.1301That is, no more than one of1302<ul type="circle">1303<li><code>JVMTI_THREAD_STATE_RUNNABLE</code></li>1304<li><code>JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER</code></li>1305<li><code>JVMTI_THREAD_STATE_WAITING</code></li>1306</ul>1307can be set (a <tm>J2SE</tm> compliant implementation will always set1308one of these if <code>JVMTI_THREAD_STATE_ALIVE</code> is set).1309And if any of these are set, the enclosing answer1310<code>JVMTI_THREAD_STATE_ALIVE</code> is set.1311No more than one of1312<ul type="circle">1313<li><code>JVMTI_THREAD_STATE_WAITING_INDEFINITELY</code></li>1314<li><code>JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT</code></li>1315</ul>1316can be set (a <tm>J2SE</tm> compliant implementation will always set1317one of these if <code>JVMTI_THREAD_STATE_WAITING</code> is set).1318And if either is set, the enclosing answers1319<code>JVMTI_THREAD_STATE_ALIVE</code> and1320<code>JVMTI_THREAD_STATE_WAITING</code> are set.1321No more than one of1322<ul type="circle">1323<li><code>JVMTI_THREAD_STATE_IN_OBJECT_WAIT</code></li>1324<li><code>JVMTI_THREAD_STATE_PARKED</code></li>1325<li><code>JVMTI_THREAD_STATE_SLEEPING</code></li>1326</ul>1327can be set. And if any of these is set, the enclosing answers1328<code>JVMTI_THREAD_STATE_ALIVE</code> and1329<code>JVMTI_THREAD_STATE_WAITING</code> are set.1330Also, if <code>JVMTI_THREAD_STATE_SLEEPING</code> is set,1331then <code>JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT</code> is set.1332If a state <i>A</i> is implemented using the mechanism of1333state <i>B</i> then it is state <i>A</i> which1334is returned by this function.1335For example, if <code>Thread.sleep(long)</code>1336is implemented using <code>Object.wait(long)</code>1337then it is still <code>JVMTI_THREAD_STATE_SLEEPING</code>1338which is returned.1339More than one of1340<ul type="circle">1341<li><code>JVMTI_THREAD_STATE_SUSPENDED</code></li>1342<li><code>JVMTI_THREAD_STATE_INTERRUPTED</code></li>1343<li><code>JVMTI_THREAD_STATE_IN_NATIVE</code></li>1344</ul>1345can be set, but if any is set,1346<code>JVMTI_THREAD_STATE_ALIVE</code> is set.1347<p/>1348And finally,1349<code>JVMTI_THREAD_STATE_TERMINATED</code> cannot be set unless1350<code>JVMTI_THREAD_STATE_ALIVE</code> is not set.1351<p/>1352The thread state representation is designed for extension in future versions1353of the specification; thread state values should be used accordingly, that is1354they should not be used as ordinals.1355Most queries can be made by testing a single bit, if use in a switch statement is desired,1356the state bits should be masked with the interesting bits.1357All bits not defined above are reserved for future use.1358A VM, compliant to the current specification, must set reserved bits to zero.1359An agent should ignore reserved bits --1360they should not be assumed to be zero and thus should not be included in comparisons.1361<p/>1362<b>Examples</b>1363<p/>1364Note that the values below exclude reserved and vendor bits.1365<p/>1366The state of a thread blocked at a <code>synchronized</code>-statement would be:1367<example>1368JVMTI_THREAD_STATE_ALIVE + JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER1369</example>1370The state of a thread which hasn't started yet would be:1371<example>137201373</example>1374The state of a thread at a <code>Object.wait(3000)</code> would be:1375<example>1376JVMTI_THREAD_STATE_ALIVE + JVMTI_THREAD_STATE_WAITING +1377JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT +1378JVMTI_THREAD_STATE_MONITOR_WAITING1379</example>1380The state of a thread suspended while runnable would be:1381<example>1382JVMTI_THREAD_STATE_ALIVE + JVMTI_THREAD_STATE_RUNNABLE + JVMTI_THREAD_STATE_SUSPENDED1383</example>1384<p/>1385<b>Testing the State</b>1386<p/>1387In most cases, the thread state can be determined by testing the one bit corresponding1388to that question. For example, the code to test if a thread is sleeping:1389<example>1390jint state;1391jvmtiError err;13921393err = (*jvmti)->GetThreadState(jvmti, thread, &state);1394if (err == JVMTI_ERROR_NONE) {1395if (state & JVMTI_THREAD_STATE_SLEEPING) { ...1396</example>1397<p/>1398For waiting (that is, in <code>Object.wait</code>, parked, or sleeping) it would be:1399<example>1400if (state & JVMTI_THREAD_STATE_WAITING) { ...1401</example>1402For some states, more than one bit will need to be tested as is the case1403when testing if a thread has not yet been started:1404<example>1405if ((state & (JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_TERMINATED)) == 0) { ...1406</example>1407To distinguish timed from untimed <code>Object.wait</code>:1408<example>1409if (state & JVMTI_THREAD_STATE_IN_OBJECT_WAIT) {1410if (state & JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT) {1411printf("in Object.wait(long timeout)\n");1412} else {1413printf("in Object.wait()\n");1414}1415}1416</example>1417<p/>1418<b>Relationship to <code>java.lang.Thread.State</code></b>1419<p/>1420The thread state represented by <code>java.lang.Thread.State</code>1421returned from <code>java.lang.Thread.getState()</code> is a subset of the1422information returned from this function.1423The corresponding <code>java.lang.Thread.State</code> can be determined1424by using the provided conversion masks.1425For example, this returns the name of the <code>java.lang.Thread.State</code> thread state:1426<example>1427err = (*jvmti)->GetThreadState(jvmti, thread, &state);1428abortOnError(err);1429switch (state & JVMTI_JAVA_LANG_THREAD_STATE_MASK) {1430case JVMTI_JAVA_LANG_THREAD_STATE_NEW:1431return "NEW";1432case JVMTI_JAVA_LANG_THREAD_STATE_TERMINATED:1433return "TERMINATED";1434case JVMTI_JAVA_LANG_THREAD_STATE_RUNNABLE:1435return "RUNNABLE";1436case JVMTI_JAVA_LANG_THREAD_STATE_BLOCKED:1437return "BLOCKED";1438case JVMTI_JAVA_LANG_THREAD_STATE_WAITING:1439return "WAITING";1440case JVMTI_JAVA_LANG_THREAD_STATE_TIMED_WAITING:1441return "TIMED_WAITING";1442}1443</example>1444</description>1445<origin>new</origin>1446<capabilities>1447</capabilities>1448<parameters>1449<param id="thread">1450<jthread null="current" started="maybe" impl="noconvert"/>1451<description>1452The thread to query.1453</description>1454</param>1455<param id="thread_state_ptr">1456<outptr><jint/></outptr>1457<description>1458On return, points to state flags,1459as defined by the <internallink id="jvmtiThreadState">Thread State Flags</internallink>.1460</description>1461</param>1462</parameters>1463<errors>1464</errors>1465</function>14661467<function id="GetCurrentThread" phase="start" num="18" since="1.1">1468<synopsis>Get Current Thread</synopsis>1469<description>1470Get the current thread.1471The current thread is the Java programming language thread which has called the function.1472<p/>1473Note that most <jvmti/> functions that take a thread1474as an argument will accept <code>NULL</code> to mean1475the current thread.1476</description>1477<origin>new</origin>1478<capabilities>1479</capabilities>1480<parameters>1481<param id="thread_ptr">1482<outptr><jthread/></outptr>1483<description>1484On return, points to the current thread.1485</description>1486</param>1487</parameters>1488<errors>1489</errors>1490</function>14911492<function id="GetAllThreads" num="4">1493<synopsis>Get All Threads</synopsis>1494<description>1495Get all live threads.1496The threads are Java programming language threads;1497that is, threads that are attached to the VM.1498A thread is live if <code>java.lang.Thread.isAlive()</code>1499would return <code>true</code>, that is, the thread has1500been started and has not yet died.1501The universe of threads is determined by the context of the <jvmti/>1502environment, which typically is all threads attached to the VM.1503Note that this includes <jvmti/> agent threads1504(see <functionlink id="RunAgentThread"/>).1505</description>1506<origin>jvmdi</origin>1507<capabilities>1508</capabilities>1509<parameters>1510<param id="threads_count_ptr">1511<outptr><jint/></outptr>1512<description>1513On return, points to the number of running threads.1514</description>1515</param>1516<param id="threads_ptr">1517<allocbuf outcount="threads_count_ptr"><jthread/></allocbuf>1518<description>1519On return, points to an array of references, one1520for each running thread.1521</description>1522</param>1523</parameters>1524<errors>1525</errors>1526</function>15271528<function id="SuspendThread" num="5">1529<synopsis>Suspend Thread</synopsis>1530<description>1531Suspend the specified thread. If the calling thread is specified,1532this function will not return until some other thread calls1533<functionlink id="ResumeThread"></functionlink>.1534If the thread is currently suspended, this function1535does nothing and returns an error.1536</description>1537<origin>jvmdi</origin>1538<capabilities>1539<required id="can_suspend"></required>1540</capabilities>1541<parameters>1542<param id="thread">1543<jthread null="current"/>1544<description>1545The thread to suspend.1546</description>1547</param>1548</parameters>1549<errors>1550<error id="JVMTI_ERROR_THREAD_SUSPENDED">1551Thread already suspended.1552</error>1553</errors>1554</function>15551556<elide>1557<function id="SuspendAllThreads" num="101">1558<synopsis>Suspend All Threads</synopsis>1559<description>1560<issue>1561There has been no explicit call for this function, and it will1562thus be removed if there is no interest.1563</issue>1564Suspend all live threads except:1565<ul>1566<li>already suspended threads</li>1567<li>those listed in <paramlink id="except_list"></paramlink></li>1568<li>certain system (non application) threads, as determined1569by the VM implementation</li>1570</ul>1571The threads are Java programming language threads;1572native threads which are not attached to the VM are not1573Java programming language threads.1574A thread is live if <code>java.lang.Thread.isAlive()</code>1575would return <code>true</code>, that is, the thread has1576been started and has not yet died.1577The universe of threads is determined1578by the context of the <jvmti/>1579environment, which, typically, is all threads attached to the VM,1580except critical VM internal threads and <jvmti/> agent threads1581(see <functionlink id="RunAgentThread"/>).1582<p/>1583If the calling thread is specified,1584all other threads are suspended first then the caller thread is suspended -1585this function will not return until some other thread calls1586<functionlink id="ResumeThread"></functionlink>.1587<p/>1588The list of actually1589suspended threads is returned in1590<paramlink id="suspended_list_ptr"></paramlink>.1591Suspension is as defined in <functionlink id="SuspendThread"></functionlink>.1592<functionlink id="ResumeThreadList"></functionlink>1593can be used to resume the suspended threads.1594</description>1595<origin>new</origin>1596<capabilities>1597<required id="can_suspend"></required>1598</capabilities>1599<parameters>1600<param id="except_count">1601<jint min="0"/>1602<description>1603The number of threads in the list of threads not to be suspended.1604</description>1605</param>1606<param id="except_list">1607<inbuf incount="except_count">1608<jthread/>1609<nullok>not an error if <code>except_count == 0</code></nullok>1610</inbuf>1611<description>1612The list of threads not to be suspended.1613</description>1614</param>1615<param id="suspended_count_ptr">1616<outptr><jint/></outptr>1617<description>1618On return, points to the number of threads suspended by this call.1619</description>1620</param>1621<param id="suspended_list_ptr">1622<allocbuf outcount="suspended_count_ptr"><jthread/></allocbuf>1623<description>1624On return, points to an array of references, one1625for each thread suspended.1626</description>1627</param>1628</parameters>1629<errors>1630<error id="JVMTI_ERROR_INVALID_THREAD">1631A thread in <paramlink id="except_list"></paramlink> was invalid.1632</error>1633<error id="JVMTI_ERROR_NULL_POINTER">1634Both <paramlink id="except_list"></paramlink> was <code>NULL</code>1635and <paramlink id="except_count"></paramlink> was non-zero.1636</error>1637</errors>1638</function>1639</elide>16401641<function id="SuspendThreadList" num="92">1642<synopsis>Suspend Thread List</synopsis>1643<description>1644Suspend the <paramlink id="request_count"></paramlink>1645threads specified in the1646<paramlink id="request_list"></paramlink> array.1647Threads may be resumed with1648<functionlink id="ResumeThreadList"></functionlink> or1649<functionlink id="ResumeThread"></functionlink>.1650If the calling thread is specified in the1651<paramlink id="request_list"></paramlink> array, this function will1652not return until some other thread resumes it.1653Errors encountered in the suspension of a thread1654are returned in the <paramlink id="results"></paramlink>1655array, <b>not</b> in the return value of this function.1656Threads that are currently suspended do not change state.1657</description>1658<origin>jvmdi</origin>1659<capabilities>1660<required id="can_suspend"></required>1661</capabilities>1662<parameters>1663<param id="request_count">1664<jint min="0"/>1665<description>1666The number of threads to suspend.1667</description>1668</param>1669<param id="request_list">1670<inbuf incount="request_count"><jthread/></inbuf>1671<description>1672The list of threads to suspend.1673</description>1674</param>1675<param id="results">1676<outbuf incount="request_count"><enum>jvmtiError</enum></outbuf>1677<description>1678An agent supplied array of1679<paramlink id="request_count"></paramlink> elements.1680On return, filled with the error code for1681the suspend of the corresponding thread.1682The error code will be1683<errorlink id="JVMTI_ERROR_NONE"></errorlink>1684if the thread was suspended by this call.1685Possible error codes are those specified1686for <functionlink id="SuspendThread"></functionlink>.1687</description>1688</param>1689</parameters>1690<errors>1691</errors>1692</function>16931694<function id="ResumeThread" num="6">1695<synopsis>Resume Thread</synopsis>1696<description>1697Resume a suspended thread.1698Any threads currently suspended through1699a <jvmti/> suspend function (eg.1700<functionlink id="SuspendThread"></functionlink>)1701or <code>java.lang.Thread.suspend()</code>1702will resume execution;1703all other threads are unaffected.1704</description>1705<origin>jvmdi</origin>1706<capabilities>1707<required id="can_suspend"></required>1708</capabilities>1709<parameters>1710<param id="thread">1711<jthread/>1712<description>1713The thread to resume.1714</description>1715</param>1716</parameters>1717<errors>1718<error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">1719Thread was not suspended.1720</error>1721<error id="JVMTI_ERROR_INVALID_TYPESTATE">1722The state of the thread has been modified, and is now inconsistent.1723</error>1724</errors>1725</function>17261727<function id="ResumeThreadList" num="93">1728<synopsis>Resume Thread List</synopsis>1729<description>1730Resume the <paramlink id="request_count"></paramlink>1731threads specified in the1732<paramlink id="request_list"></paramlink> array.1733Any thread suspended through1734a <jvmti/> suspend function (eg.1735<functionlink id="SuspendThreadList"></functionlink>)1736or <code>java.lang.Thread.suspend()</code>1737will resume execution.1738</description>1739<origin>jvmdi</origin>1740<capabilities>1741<required id="can_suspend"></required>1742</capabilities>1743<parameters>1744<param id="request_count">1745<jint min="0"/>1746<description>1747The number of threads to resume.1748</description>1749</param>1750<param id="request_list">1751<inbuf incount="request_count"><jthread/></inbuf>1752<description>1753The threads to resume.1754</description>1755</param>1756<param id="results">1757<outbuf incount="request_count"><enum>jvmtiError</enum></outbuf>1758<description>1759An agent supplied array of1760<paramlink id="request_count"></paramlink> elements.1761On return, filled with the error code for1762the resume of the corresponding thread.1763The error code will be1764<errorlink id="JVMTI_ERROR_NONE"></errorlink>1765if the thread was suspended by this call.1766Possible error codes are those specified1767for <functionlink id="ResumeThread"></functionlink>.1768</description>1769</param>1770</parameters>1771<errors>1772</errors>1773</function>17741775<function id="StopThread" num="7">1776<synopsis>Stop Thread</synopsis>1777<description>1778Send the specified asynchronous exception to the specified thread1779(similar to <code>java.lang.Thread.stop</code>).1780Normally, this function is used to kill the specified thread with an1781instance of the exception <code>ThreadDeath</code>.1782</description>1783<origin>jvmdi</origin>1784<capabilities>1785<required id="can_signal_thread"></required>1786</capabilities>1787<parameters>1788<param id="thread">1789<jthread/>1790<description>1791The thread to stop.1792</description>1793</param>1794<param id="exception">1795<jobject/>1796<description>1797The asynchronous exception object.1798</description>1799</param>1800</parameters>1801<errors>1802</errors>1803</function>18041805<function id="InterruptThread" num="8">1806<synopsis>Interrupt Thread</synopsis>1807<description>1808Interrupt the specified thread1809(similar to <code>java.lang.Thread.interrupt</code>).1810</description>1811<origin>jvmdi</origin>1812<capabilities>1813<required id="can_signal_thread"></required>1814</capabilities>1815<parameters>1816<param id="thread">1817<jthread impl="noconvert"/>1818<description>1819The thread to interrupt.1820</description>1821</param>1822</parameters>1823<errors>1824</errors>1825</function>18261827<function id="GetThreadInfo" num="9">1828<synopsis>Get Thread Info</synopsis>1829<typedef id="jvmtiThreadInfo" label="Thread information structure">1830<field id="name">1831<allocfieldbuf><char/></allocfieldbuf>1832<description>1833The thread name, encoded as a1834<internallink id="mUTF">modified UTF-8</internallink> string.1835</description>1836</field>1837<field id="priority">1838<jint/>1839<description>1840The thread priority. See the thread priority constants:1841<datalink id="jvmtiThreadPriority"></datalink>.1842</description>1843</field>1844<field id="is_daemon">1845<jboolean/>1846<description>1847Is this a daemon thread?1848</description>1849</field>1850<field id="thread_group">1851<jthreadGroup/>1852<description>1853The thread group to which this thread belongs.1854<code>NULL</code> if the thread has died.1855</description>1856</field>1857<field id="context_class_loader">1858<jobject/>1859<description>1860The context class loader associated with this thread.1861</description>1862</field>1863</typedef>1864<description>1865Get thread information. The fields of the <datalink id="jvmtiThreadInfo"/> structure1866are filled in with details of the specified thread.1867</description>1868<origin>jvmdi</origin>1869<capabilities>1870</capabilities>1871<parameters>1872<param id="thread">1873<jthread null="current" impl="noconvert" started="maybe"/>1874<description>1875The thread to query.1876</description>1877</param>1878<param id="info_ptr">1879<outptr><struct>jvmtiThreadInfo</struct></outptr>1880<description>1881On return, filled with information describing the specified thread.1882<p/>1883For JDK 1.1 implementations that don't1884recognize context class loaders,1885the <code>context_class_loader</code> field will be NULL.1886</description>1887</param>1888</parameters>1889<errors>1890</errors>1891</function>18921893<function id="GetOwnedMonitorInfo" num="10">1894<synopsis>Get Owned Monitor Info</synopsis>1895<description>1896Get information about the monitors owned by the1897specified thread.1898</description>1899<origin>jvmdiClone</origin>1900<capabilities>1901<required id="can_get_owned_monitor_info"></required>1902</capabilities>1903<parameters>1904<param id="thread">1905<jthread null="current"/>1906<description>1907The thread to query.1908</description>1909</param>1910<param id="owned_monitor_count_ptr">1911<outptr><jint/></outptr>1912<description>1913The number of monitors returned.1914</description>1915</param>1916<param id="owned_monitors_ptr">1917<allocbuf outcount="owned_monitor_count_ptr"><jobject/></allocbuf>1918<description>1919The array of owned monitors.1920</description>1921</param>1922</parameters>1923<errors>1924</errors>1925</function>19261927<function id="GetOwnedMonitorStackDepthInfo" num="153" since="1.1">1928<synopsis>Get Owned Monitor Stack Depth Info</synopsis>1929<typedef id="jvmtiMonitorStackDepthInfo"1930label="Monitor stack depth information structure">1931<field id="monitor">1932<jobject/>1933<description>1934The owned monitor.1935</description>1936</field>1937<field id="stack_depth">1938<jint/>1939<description>1940The stack depth. Corresponds to the stack depth used in the1941<internallink id="stack">Stack Frame functions</internallink>.1942That is, zero is the current frame, one is the frame which1943called the current frame. And it is negative one if the1944implementation cannot determine the stack depth (e.g., for1945monitors acquired by JNI <code>MonitorEnter</code>).1946</description>1947</field>1948</typedef>1949<description>1950Get information about the monitors owned by the1951specified thread and the depth of the stack frame which locked them.1952</description>1953<origin>new</origin>1954<capabilities>1955<required id="can_get_owned_monitor_stack_depth_info"></required>1956</capabilities>1957<parameters>1958<param id="thread">1959<jthread null="current"/>1960<description>1961The thread to query.1962</description>1963</param>1964<param id="monitor_info_count_ptr">1965<outptr><jint/></outptr>1966<description>1967The number of monitors returned.1968</description>1969</param>1970<param id="monitor_info_ptr">1971<allocbuf outcount="monitor_info_count_ptr">1972<struct>jvmtiMonitorStackDepthInfo</struct>1973</allocbuf>1974<description>1975The array of owned monitor depth information.1976</description>1977</param>1978</parameters>1979<errors>1980</errors>1981</function>19821983<function id="GetCurrentContendedMonitor" num="11">1984<synopsis>Get Current Contended Monitor</synopsis>1985<description>1986Get the object, if any, whose monitor the specified thread is waiting to1987enter or waiting to regain through <code>java.lang.Object.wait</code>.1988</description>1989<origin>jvmdi</origin>1990<capabilities>1991<required id="can_get_current_contended_monitor"></required>1992</capabilities>1993<parameters>1994<param id="thread">1995<jthread null="current"/>1996<description>1997The thread to query.1998</description>1999</param>2000<param id="monitor_ptr">2001<outptr><jobject/></outptr>2002<description>2003On return, filled with the current contended monitor, or2004NULL if there is none.2005</description>2006</param>2007</parameters>2008<errors>2009</errors>2010</function>20112012<callback id="jvmtiStartFunction">2013<void/>2014<synopsis>Agent Start Function</synopsis>2015<description>2016Agent supplied callback function.2017This function is the entry point for an agent thread2018started with2019<functionlink id="RunAgentThread"></functionlink>.2020</description>2021<parameters>2022<param id="jvmti_env">2023<outptr>2024<struct>jvmtiEnv</struct>2025</outptr>2026<description>2027The <jvmti/> environment.2028</description>2029</param>2030<param id="jni_env">2031<outptr>2032<struct>JNIEnv</struct>2033</outptr>2034<description>2035The JNI environment.2036</description>2037</param>2038<param id="arg">2039<outptr>2040<void/>2041</outptr>2042<description>2043The <code>arg</code> parameter passed to2044<functionlink id="RunAgentThread"></functionlink>.2045</description>2046</param>2047</parameters>2048</callback>20492050<function id="RunAgentThread" num="12">2051<synopsis>Run Agent Thread</synopsis>2052<description>2053Starts the execution of an agent thread. with the specified native function.2054The parameter <paramlink id="arg"></paramlink> is forwarded on to the2055<functionlink id="jvmtiStartFunction">start function</functionlink>2056(specified with <paramlink id="proc"></paramlink>) as its single argument.2057This function allows the creation of agent threads2058for handling communication with another process or for handling events2059without the need to load a special subclass of <code>java.lang.Thread</code> or2060implementer of <code>java.lang.Runnable</code>.2061Instead, the created thread can run entirely in native code.2062However, the created thread does require a newly created instance2063of <code>java.lang.Thread</code> (referenced by the argument <code>thread</code>) to2064which it will be associated.2065The thread object can be created with JNI calls.2066<p/>2067The following common thread priorities are provided for your convenience:2068<constants id="jvmtiThreadPriority" label="Thread Priority Constants" kind="const">2069<constant id="JVMTI_THREAD_MIN_PRIORITY" num="1">2070Minimum possible thread priority2071</constant>2072<constant id="JVMTI_THREAD_NORM_PRIORITY" num="5">2073Normal thread priority2074</constant>2075<constant id="JVMTI_THREAD_MAX_PRIORITY" num="10">2076Maximum possible thread priority2077</constant>2078</constants>2079<p/>2080The new thread is started as a daemon thread with the specified2081<paramlink id="priority"></paramlink>.2082If enabled, a <eventlink id="ThreadStart"/> event will be sent.2083<p/>2084Since the thread has been started, the thread will be live when this function2085returns, unless the thread has died immediately.2086<p/>2087The thread group of the thread is ignored -- specifically, the thread is not2088added to the thread group and the thread is not seen on queries of the thread2089group at either the Java programming language or <jvmti/> levels.2090<p/>2091The thread is not visible to Java programming language queries but is2092included in <jvmti/> queries (for example,2093<functionlink id="GetAllThreads"/> and2094<functionlink id="GetAllStackTraces"/>).2095<p/>2096Upon execution of <code>proc</code>, the new thread will be attached to the2097VM--see the JNI documentation on2098<externallink id="http://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/invocation.html#wp1060"2099>Attaching to the VM</externallink>.2100</description>2101<origin>jvmdiClone</origin>2102<capabilities>2103</capabilities>2104<parameters>2105<param id="thread">2106<jthread impl="noconvert" started="no"/>2107<description>2108The thread to run.2109</description>2110</param>2111<param id="proc">2112<ptrtype>2113<struct>jvmtiStartFunction</struct>2114</ptrtype>2115<description>2116The start function.2117</description>2118</param>2119<param id="arg">2120<inbuf>2121<void/>2122<nullok><code>NULL</code> is passed to the start function</nullok>2123</inbuf>2124<description>2125The argument to the start function.2126</description>2127</param>2128<param id="priority">2129<jint/>2130<description>2131The priority of the started thread. Any thread2132priority allowed by <code>java.lang.Thread.setPriority</code> can be used including2133those in <datalink id="jvmtiThreadPriority"></datalink>.2134</description>2135</param>2136</parameters>2137<errors>2138<error id="JVMTI_ERROR_INVALID_PRIORITY">2139<paramlink id="priority"/> is less than2140<datalink id="JVMTI_THREAD_MIN_PRIORITY"/>2141or greater than2142<datalink id="JVMTI_THREAD_MAX_PRIORITY"/>2143</error>2144</errors>2145</function>21462147<function id="SetThreadLocalStorage" jkernel="yes" impl="notrace" phase="start" num="103">2148<synopsis>Set Thread Local Storage</synopsis>2149<description>2150The VM stores a pointer value associated with each environment-thread2151pair. This pointer value is called <i>thread-local storage</i>.2152This value is <code>NULL</code> unless set with this function.2153Agents can allocate memory in which they store thread specific2154information. By setting thread-local storage it can then be2155accessed with2156<functionlink id="GetThreadLocalStorage"></functionlink>.2157<p/>2158This function is called by the agent to set the value of the <jvmti/>2159thread-local storage. <jvmti/> supplies to the agent a pointer-size2160thread-local storage that can be used to record per-thread2161information.2162</description>2163<origin>jvmpi</origin>2164<capabilities>2165</capabilities>2166<parameters>2167<param id="thread">2168<jthread null="current"/>2169<description>2170Store to this thread.2171</description>2172</param>2173<param id="data">2174<inbuf>2175<void/>2176<nullok>value is set to <code>NULL</code></nullok>2177</inbuf>2178<description>2179The value to be entered into the thread-local storage.2180</description>2181</param>2182</parameters>2183<errors>2184</errors>2185</function>21862187<function id="GetThreadLocalStorage" jkernel="yes" impl="innative notrace" phase="start" num="102">2188<synopsis>Get Thread Local Storage</synopsis>2189<description>2190Called by the agent to get the value of the <jvmti/> thread-local2191storage.2192</description>2193<origin>jvmpi</origin>2194<capabilities>2195</capabilities>2196<parameters>2197<param id="thread">2198<jthread null="current" impl="noconvert"/>2199<description>2200Retrieve from this thread.2201</description>2202</param>2203<param id="data_ptr">2204<agentbuf><void/></agentbuf>2205<description>2206Pointer through which the value of the thread local2207storage is returned.2208If thread-local storage has not been set with2209<functionlink id="SetThreadLocalStorage"></functionlink> the returned2210pointer is <code>NULL</code>.2211</description>2212</param>2213</parameters>2214<errors>2215</errors>2216</function>22172218</category>22192220<category id="thread_groups" label="Thread Group">2221<intro>2222</intro>22232224<function id="GetTopThreadGroups" num="13">2225<synopsis>Get Top Thread Groups</synopsis>2226<description>2227Return all top-level (parentless) thread groups in the VM.2228</description>2229<origin>jvmdi</origin>2230<capabilities>2231</capabilities>2232<parameters>2233<param id="group_count_ptr">2234<outptr><jint/></outptr>2235<description>2236On return, points to the number of top-level thread groups.2237</description>2238</param>2239<param id="groups_ptr">2240<allocbuf outcount="group_count_ptr"><jthreadGroup/></allocbuf>2241<description>2242On return, refers to a pointer to the top-level thread group array.2243</description>2244</param>2245</parameters>2246<errors>2247</errors>2248</function>22492250<function id="GetThreadGroupInfo" num="14">2251<synopsis>Get Thread Group Info</synopsis>2252<typedef id="jvmtiThreadGroupInfo" label="Thread group information structure">2253<field id="parent">2254<jthreadGroup/>2255<description>2256The parent thread group.2257</description>2258</field>2259<field id="name">2260<allocfieldbuf><char/></allocfieldbuf>2261<description>2262The thread group's name, encoded as a2263<internallink id="mUTF">modified UTF-8</internallink> string.2264</description>2265</field>2266<field id="max_priority">2267<jint/>2268<description>2269The maximum priority for this thread group.2270</description>2271</field>2272<field id="is_daemon">2273<jboolean/>2274<description>2275Is this a daemon thread group?2276</description>2277</field>2278</typedef>2279<description>2280Get information about the thread group. The fields of the2281<functionlink id="jvmtiThreadGroupInfo"></functionlink> structure2282are filled in with details of the specified thread group.2283</description>2284<origin>jvmdi</origin>2285<capabilities>2286</capabilities>2287<parameters>2288<param id="group">2289<jthreadGroup/>2290<description>2291The thread group to query.2292</description>2293</param>2294<param id="info_ptr">2295<outptr><struct>jvmtiThreadGroupInfo</struct></outptr>2296<description>2297On return, filled with information describing the specified2298thread group.2299</description>2300</param>2301</parameters>2302<errors>2303</errors>2304</function>23052306<function id="GetThreadGroupChildren" num="15">2307<synopsis>Get Thread Group Children</synopsis>2308<description>2309Get the live threads and active subgroups in this thread group.2310</description>2311<origin>jvmdi</origin>2312<capabilities>2313</capabilities>2314<parameters>2315<param id="group">2316<jthreadGroup/>2317<description>2318The group to query.2319</description>2320</param>2321<param id="thread_count_ptr">2322<outptr><jint/></outptr>2323<description>2324On return, points to the number of live threads in this thread group.2325</description>2326</param>2327<param id="threads_ptr">2328<allocbuf outcount="thread_count_ptr"><jthread/></allocbuf>2329<description>2330On return, points to an array of the live threads in this thread group.2331</description>2332</param>2333<param id="group_count_ptr">2334<outptr><jint/></outptr>2335<description>2336On return, points to the number of active child thread groups2337</description>2338</param>2339<param id="groups_ptr">2340<allocbuf outcount="group_count_ptr"><jthreadGroup/></allocbuf>2341<description>2342On return, points to an array of the active child thread groups.2343</description>2344</param>2345</parameters>2346<errors>2347</errors>2348</function>2349</category>23502351<category id="stack" label="Stack Frame">2352<intro>2353These functions provide information about the stack of a thread.2354Stack frames are referenced by depth.2355The frame at depth zero is the current frame.2356<p/>2357Stack frames are as described in2358<vmspec chapter="3.6"/>,2359That is, they correspond to method2360invocations (including native methods) but do not correspond to platform native or2361VM internal frames.2362<p/>2363A <jvmti/> implementation may use method invocations to launch a thread and2364the corresponding frames may be included in the stack as presented by these functions --2365that is, there may be frames shown2366deeper than <code>main()</code> and <code>run()</code>.2367However this presentation must be consistent across all <jvmti/> functionality which2368uses stack frames or stack depth.2369</intro>23702371<typedef id="jvmtiFrameInfo" label="Stack frame information structure">2372<description>2373Information about a stack frame is returned in this structure.2374</description>2375<field id="method">2376<jmethodID/>2377<description>2378The method executing in this frame.2379</description>2380</field>2381<field id="location">2382<jlocation/>2383<description>2384The index of the instruction executing in this frame.2385<code>-1</code> if the frame is executing a native method.2386</description>2387</field>2388</typedef>23892390<typedef id="jvmtiStackInfo" label="Stack information structure">2391<description>2392Information about a set of stack frames is returned in this structure.2393</description>2394<field id="thread">2395<jthread/>2396<description>2397On return, the thread traced.2398</description>2399</field>2400<field id="state">2401<jint/>2402<description>2403On return, the thread state. See <functionlink id="GetThreadState"></functionlink>.2404</description>2405</field>2406<field id="frame_buffer">2407<outbuf incount="max_frame_count">2408<struct>jvmtiFrameInfo</struct>2409</outbuf>2410<description>2411On return, this agent allocated buffer is filled2412with stack frame information.2413</description>2414</field>2415<field id="frame_count">2416<jint/>2417<description>2418On return, the number of records filled into2419<code>frame_buffer</code>.2420This will be2421min(<code>max_frame_count</code>, <i>stackDepth</i>).2422</description>2423</field>2424</typedef>24252426<function id="GetStackTrace" num="104">2427<synopsis>Get Stack Trace</synopsis>2428<description>2429Get information about the stack of a thread.2430If <paramlink id="max_frame_count"></paramlink> is less than the depth of the stack,2431the <paramlink id="max_frame_count"></paramlink> topmost frames are returned,2432otherwise the entire stack is returned.2433The topmost frames, those most recently invoked, are at the beginning of the returned buffer.2434<p/>2435The following example causes up to five of the topmost frames2436to be returned and (if there are any frames) the currently2437executing method name to be printed.2438<example>2439jvmtiFrameInfo frames[5];2440jint count;2441jvmtiError err;24422443err = (*jvmti)->GetStackTrace(jvmti, aThread, 0, 5,2444frames, &count);2445if (err == JVMTI_ERROR_NONE && count >= 1) {2446char *methodName;2447err = (*jvmti)->GetMethodName(jvmti, frames[0].method,2448&methodName, NULL, NULL);2449if (err == JVMTI_ERROR_NONE) {2450printf("Executing method: %s", methodName);2451}2452}2453</example>2454<todo>2455check example code.2456</todo>2457<p/>2458The <paramlink id="thread"></paramlink> need not be suspended2459to call this function.2460<p/>2461The <functionlink id="GetLineNumberTable"></functionlink>2462function can be used to map locations to line numbers. Note that2463this mapping can be done lazily.2464</description>2465<origin>jvmpi</origin>2466<capabilities>2467</capabilities>2468<parameters>2469<param id="thread">2470<jthread null="current"/>2471<description>2472Fetch the stack trace of this thread.2473</description>2474</param>2475<param id="start_depth">2476<jint/>2477<description>2478Begin retrieving frames at this depth.2479If non-negative, count from the current frame,2480the first frame retrieved is at depth <code>start_depth</code>.2481For example, if zero, start from the current frame; if one, start from the2482caller of the current frame; if two, start from the caller of the2483caller of the current frame; and so on.2484If negative, count from below the oldest frame,2485the first frame retrieved is at depth <i>stackDepth</i><code> + start_depth</code>,2486where <i>stackDepth</i> is the count of frames on the stack.2487For example, if negative one, only the oldest frame is retrieved;2488if negative two, start from the frame called by the oldest frame.2489</description>2490</param>2491<param id="max_frame_count">2492<jint min="0"/>2493<description>2494The maximum number of <datalink id="jvmtiFrameInfo"/> records to retrieve.2495</description>2496</param>2497<param id="frame_buffer">2498<outbuf incount="max_frame_count" outcount="count_ptr">2499<struct>jvmtiFrameInfo</struct>2500</outbuf>2501<description>2502On return, this agent allocated buffer is filled2503with stack frame information.2504</description>2505</param>2506<param id="count_ptr">2507<outptr><jint/></outptr>2508<description>2509On return, points to the number of records filled in.2510For non-negative <code>start_depth</code>, this will be2511min(<code>max_frame_count</code>, <i>stackDepth</i><code> - start_depth</code>).2512For negative <code>start_depth</code>, this will be2513min(<code>max_frame_count</code>, <code>-start_depth</code>).2514</description>2515</param>2516</parameters>2517<errors>2518<error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">2519<paramlink id="start_depth"/> is positive and greater than or equal to <i>stackDepth</i>.2520Or <paramlink id="start_depth"/> is negative and less than <i>-stackDepth</i>.2521</error>2522</errors>2523</function>252425252526<function id="GetAllStackTraces" num="100">2527<synopsis>Get All Stack Traces</synopsis>2528<description>2529Get information about the stacks of all live threads2530(including <internallink id="RunAgentThread">agent threads</internallink>).2531If <paramlink id="max_frame_count"/> is less than the depth of a stack,2532the <paramlink id="max_frame_count"/> topmost frames are returned for that thread,2533otherwise the entire stack is returned.2534The topmost frames, those most recently invoked, are at the beginning of the returned buffer.2535<p/>2536All stacks are collected simultaneously, that is, no changes will occur to the2537thread state or stacks between the sampling of one thread and the next.2538The threads need not be suspended.25392540<example>2541jvmtiStackInfo *stack_info;2542jint thread_count;2543int ti;2544jvmtiError err;25452546err = (*jvmti)->GetAllStackTraces(jvmti, MAX_FRAMES, &stack_info, &thread_count);2547if (err != JVMTI_ERROR_NONE) {2548...2549}2550for (ti = 0; ti < thread_count; ++ti) {2551jvmtiStackInfo *infop = &stack_info[ti];2552jthread thread = infop->thread;2553jint state = infop->state;2554jvmtiFrameInfo *frames = infop->frame_buffer;2555int fi;25562557myThreadAndStatePrinter(thread, state);2558for (fi = 0; fi < infop->frame_count; fi++) {2559myFramePrinter(frames[fi].method, frames[fi].location);2560}2561}2562/* this one Deallocate call frees all data allocated by GetAllStackTraces */2563err = (*jvmti)->Deallocate(jvmti, stack_info);2564</example>2565<todo>2566check example code.2567</todo>25682569</description>2570<origin>new</origin>2571<capabilities>2572</capabilities>2573<parameters>2574<param id="max_frame_count">2575<jint min="0"/>2576<description>2577The maximum number of <datalink id="jvmtiFrameInfo"/> records to retrieve per thread.2578</description>2579</param>2580<param id="stack_info_ptr">2581<allocbuf>2582<struct>jvmtiStackInfo</struct>2583</allocbuf>2584<description>2585On return, this buffer is filled2586with stack information for each thread.2587The number of <datalink id="jvmtiStackInfo"/> records is determined2588by <paramlink id="thread_count_ptr"/>.2589<p/>2590Note that this buffer is allocated to include the <datalink id="jvmtiFrameInfo"/>2591buffers pointed to by <datalink id="jvmtiStackInfo.frame_buffer"/>.2592These buffers must not be separately deallocated.2593</description>2594</param>2595<param id="thread_count_ptr">2596<outptr><jint/></outptr>2597<description>2598The number of threads traced.2599</description>2600</param>2601</parameters>2602<errors>2603</errors>2604</function>26052606<function id="GetThreadListStackTraces" num="101">2607<synopsis>Get Thread List Stack Traces</synopsis>2608<description>2609Get information about the stacks of the supplied threads.2610If <paramlink id="max_frame_count"/> is less than the depth of a stack,2611the <paramlink id="max_frame_count"/> topmost frames are returned for that thread,2612otherwise the entire stack is returned.2613The topmost frames, those most recently invoked, are at the beginning of the returned buffer.2614<p/>2615All stacks are collected simultaneously, that is, no changes will occur to the2616thread state or stacks between the sampling one thread and the next.2617The threads need not be suspended.2618<p/>2619If a thread has not yet started or terminates before the stack information is collected,2620a zero length stack (<datalink id="jvmtiStackInfo.frame_count"/> will be zero)2621will be returned and the thread <datalink id="jvmtiStackInfo.state"/> can be checked.2622<p/>2623See the example for the similar function2624<functionlink id="GetAllStackTraces"/>.2625</description>2626<origin>new</origin>2627<capabilities>2628</capabilities>2629<parameters>2630<param id="thread_count">2631<jint min="0"/>2632<description>2633The number of threads to trace.2634</description>2635</param>2636<param id="thread_list">2637<inbuf incount="thread_count"><jthread/></inbuf>2638<description>2639The list of threads to trace.2640</description>2641</param>2642<param id="max_frame_count">2643<jint min="0"/>2644<description>2645The maximum number of <datalink id="jvmtiFrameInfo"/> records to retrieve per thread.2646</description>2647</param>2648<param id="stack_info_ptr">2649<allocbuf outcount="thread_count">2650<struct>jvmtiStackInfo</struct>2651</allocbuf>2652<description>2653On return, this buffer is filled2654with stack information for each thread.2655The number of <datalink id="jvmtiStackInfo"/> records is determined2656by <paramlink id="thread_count"/>.2657<p/>2658Note that this buffer is allocated to include the <datalink id="jvmtiFrameInfo"/>2659buffers pointed to by <datalink id="jvmtiStackInfo.frame_buffer"/>.2660These buffers must not be separately deallocated.2661</description>2662</param>2663</parameters>2664<errors>2665<error id="JVMTI_ERROR_INVALID_THREAD">2666An element in <paramlink id="thread_list"/> is not a thread object.2667</error>2668</errors>2669</function>26702671<elide>2672<function id="AsyncGetStackTrace" num="1000">2673<synopsis>Get Stack Trace--Asynchronous</synopsis>2674<description>2675Get information about the entire stack of a thread (or a sub-section of it).2676This is the asynchronous version of <functionlink id="GetStackTrace"></functionlink>2677and is reentrant and safe to call2678from asynchronous signal handlers.2679The stack trace is returned only for the calling thread.2680<p/>2681The <functionlink id="GetLineNumberTable"></functionlink>2682function can be used to map locations to line numbers. Note that2683this mapping can be done lazily.2684</description>2685<origin>jvmpi</origin>2686<capabilities>2687<required id="can_get_async_stack_trace"></required>2688<capability id="can_show_JVM_spec_async_frames">2689If <code>false</code>,2690<paramlink id="use_java_stack"></paramlink>2691must be <code>false</code>.2692</capability>2693</capabilities>2694<parameters>2695<param id="use_java_stack">2696<jboolean/>2697<description>2698Return the stack showing <vmspec/>2699model of the stack;2700otherwise, show the internal representation of the stack with2701inlined and optimized methods missing. If the virtual machine2702is using the <i>Java Virtual Machine Specification</i> stack model2703internally, this flag is ignored.2704</description>2705</param>2706<param id="max_count">2707<jint min="0"/>2708<description>2709The maximum number of <datalink id="jvmtiFrameInfo"/> records to retrieve.2710Retrieve this many unless the stack depth is less than <code>max_count</code>.2711</description>2712</param>2713<param id="frame_buffer">2714<outbuf incount="max_count" outcount="count_ptr">2715<struct>jvmtiFrameInfo</struct>2716<nullok>this information is not returned</nullok>2717</outbuf>2718<description>2719The agent passes in a buffer2720large enough to hold <code>max_count</code> records of2721<datalink id="jvmtiFrameInfo"></datalink>. This buffer must be2722pre-allocated by the agent.2723</description>2724</param>2725<param id="count_ptr">2726<outptr><jint/></outptr>2727<description>2728On return, points to the number of records filled in..2729</description>2730</param>2731</parameters>2732<errors>2733<error id="JVMTI_ERROR_UNATTACHED_THREAD">2734The thread being used to call this function is not attached2735to the virtual machine. Calls must be made from attached threads.2736</error>2737</errors>2738</function>2739</elide>27402741<function id="GetFrameCount" num="16">2742<synopsis>Get Frame Count</synopsis>2743<description>2744Get the number of frames currently in the specified thread's call stack.2745<p/>2746If this function is called for a thread actively executing bytecodes (for example,2747not the current thread and not suspended), the information returned is transient.2748</description>2749<origin>jvmdi</origin>2750<capabilities>2751</capabilities>2752<parameters>2753<param id="thread">2754<jthread null="current"/>2755<description>2756The thread to query.2757</description>2758</param>2759<param id="count_ptr">2760<outptr><jint/></outptr>2761<description>2762On return, points to the number of frames in the call stack.2763</description>2764</param>2765</parameters>2766<errors>2767</errors>2768</function>27692770<function id="PopFrame" num="80">2771<synopsis>Pop Frame</synopsis>2772<description>2773Pop the current frame of <code>thread</code>'s stack.2774Popping a frame takes you to the previous frame.2775When the thread is resumed, the execution2776state of the thread is reset to the state2777immediately before the called method was invoked.2778That is (using <vmspec/> terminology):2779<ul>2780<li>the current frame is discarded as the previous frame becomes the current one</li>2781<li>the operand stack is restored--the argument values are added back2782and if the invoke was not <code>invokestatic</code>,2783<code>objectref</code> is added back as well</li>2784<li>the Java virtual machine PC is restored to the opcode2785of the invoke instruction</li>2786</ul>2787Note however, that any changes to the arguments, which2788occurred in the called method, remain;2789when execution continues, the first instruction to2790execute will be the invoke.2791<p/>2792Between calling <code>PopFrame</code> and resuming the2793thread the state of the stack is undefined.2794To pop frames beyond the first,2795these three steps must be repeated:2796<ul>2797<li>suspend the thread via an event (step, breakpoint, ...)</li>2798<li>call <code>PopFrame</code></li>2799<li>resume the thread</li>2800</ul>2801<p/>2802A lock acquired by calling the called method2803(if it is a <code>synchronized</code> method)2804and locks acquired by entering <code>synchronized</code>2805blocks within the called method are released.2806Note: this does not apply to native locks or2807<code>java.util.concurrent.locks</code> locks.2808<p/>2809Finally blocks are not executed.2810<p/>2811Changes to global state are not addressed and thus remain changed.2812<p/>2813The specified thread must be suspended (which implies it cannot be the current thread).2814<p/>2815Both the called method and calling method must be non-native Java programming2816language methods.2817<p/>2818No <jvmti/> events are generated by this function.2819</description>2820<origin>jvmdi</origin>2821<capabilities>2822<required id="can_pop_frame"></required>2823</capabilities>2824<parameters>2825<param id="thread">2826<jthread/>2827<description>2828The thread whose current frame is to be popped.2829</description>2830</param>2831</parameters>2832<errors>2833<error id="JVMTI_ERROR_OPAQUE_FRAME">2834Called or calling method is a native method.2835The implementation is unable to pop this frame.2836</error>2837<error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">2838Thread was not suspended.2839</error>2840<error id="JVMTI_ERROR_NO_MORE_FRAMES">2841There are less than two stack frames on the call stack.2842</error>2843</errors>2844</function>28452846<function id="GetFrameLocation" num="19">2847<synopsis>Get Frame Location</synopsis>2848<description>2849<p/>2850For a Java programming language frame, return the location of the instruction2851currently executing.2852</description>2853<origin>jvmdiClone</origin>2854<capabilities>2855</capabilities>2856<parameters>2857<param id="thread">2858<jthread null="current" frame="frame"/>2859<description>2860The thread of the frame to query.2861</description>2862</param>2863<param id="depth">2864<jframeID thread="thread"/>2865<description>2866The depth of the frame to query.2867</description>2868</param>2869<param id="method_ptr">2870<outptr><jmethodID/></outptr>2871<description>2872On return, points to the method for the current location.2873</description>2874</param>2875<param id="location_ptr">2876<outptr><jlocation/></outptr>2877<description>2878On return, points to the index of the currently2879executing instruction.2880Is set to <code>-1</code> if the frame is executing2881a native method.2882</description>2883</param>2884</parameters>2885<errors>2886</errors>2887</function>28882889<function id="NotifyFramePop" num="20">2890<synopsis>Notify Frame Pop</synopsis>2891<description>2892When the frame that is currently at <paramlink id="depth"></paramlink>2893is popped from the stack, generate a2894<eventlink id="FramePop"></eventlink> event. See the2895<eventlink id="FramePop"></eventlink> event for details.2896Only frames corresponding to non-native Java programming language2897methods can receive notification.2898<p/>2899The specified thread must either be the current thread2900or the thread must be suspended.2901</description>2902<origin>jvmdi</origin>2903<capabilities>2904<required id="can_generate_frame_pop_events"></required>2905</capabilities>2906<parameters>2907<param id="thread">2908<jthread null="current" frame="depth"/>2909<description>2910The thread of the frame for which the frame pop event will be generated.2911</description>2912</param>2913<param id="depth">2914<jframeID thread="thread"/>2915<description>2916The depth of the frame for which the frame pop event will be generated.2917</description>2918</param>2919</parameters>2920<errors>2921<error id="JVMTI_ERROR_OPAQUE_FRAME">2922The frame at <code>depth</code> is executing a2923native method.2924</error>2925<error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">2926Thread was not suspended and was not the current thread.2927</error>2928</errors>2929</function>29302931</category>29322933<category id="ForceEarlyReturn" label="Force Early Return">2934<intro>2935These functions allow an agent to force a method2936to return at any point during its execution.2937The method which will return early is referred to as the <i>called method</i>.2938The called method is the current method2939(as defined by2940<vmspec chapter="3.6"/>)2941for the specified thread at2942the time the function is called.2943<p/>2944The specified thread must be suspended or must be the current thread.2945The return occurs when execution of Java programming2946language code is resumed on this thread.2947Between calling one of these functions and resumption2948of thread execution, the state of the stack is undefined.2949<p/>2950No further instructions are executed in the called method.2951Specifically, finally blocks are not executed.2952Note: this can cause inconsistent states in the application.2953<p/>2954A lock acquired by calling the called method2955(if it is a <code>synchronized</code> method)2956and locks acquired by entering <code>synchronized</code>2957blocks within the called method are released.2958Note: this does not apply to native locks or2959<code>java.util.concurrent.locks</code> locks.2960<p/>2961Events, such as <eventlink id="MethodExit"></eventlink>,2962are generated as they would be in a normal return.2963<p/>2964The called method must be a non-native Java programming2965language method.2966Forcing return on a thread with only one frame on the2967stack causes the thread to exit when resumed.2968</intro>29692970<function id="ForceEarlyReturnObject" num="81" since="1.1">2971<synopsis>Force Early Return - Object</synopsis>2972<description>2973This function can be used to return from a method whose2974result type is <code>Object</code>2975or a subclass of <code>Object</code>.2976</description>2977<origin>new</origin>2978<capabilities>2979<required id="can_force_early_return"></required>2980</capabilities>2981<parameters>2982<param id="thread">2983<jthread null="current"/>2984<description>2985The thread whose current frame is to return early.2986</description>2987</param>2988<param id="value">2989<jobject/>2990<description>2991The return value for the called frame.2992An object or <code>NULL</code>.2993</description>2994</param>2995</parameters>2996<errors>2997<error id="JVMTI_ERROR_OPAQUE_FRAME">2998Attempted to return early from a frame2999corresponding to a native method.3000Or the implementation is unable to provide3001this functionality on this frame.3002</error>3003<error id="JVMTI_ERROR_TYPE_MISMATCH">3004The result type of the called method is not3005<code>Object</code> or a subclass of <code>Object</code>.3006</error>3007<error id="JVMTI_ERROR_TYPE_MISMATCH">3008The supplied <paramlink id="value"/> is not compatible with the3009result type of the called method.3010</error>3011<error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">3012Thread was not the current thread and was not suspended.3013</error>3014<error id="JVMTI_ERROR_NO_MORE_FRAMES">3015There are no more frames on the call stack.3016</error>3017</errors>3018</function>30193020<function id="ForceEarlyReturnInt" num="82" since="1.1">3021<synopsis>Force Early Return - Int</synopsis>3022<description>3023This function can be used to return from a method whose3024result type is <code>int</code>, <code>short</code>,3025<code>char</code>, <code>byte</code>, or3026<code>boolean</code>.3027</description>3028<origin>new</origin>3029<capabilities>3030<required id="can_force_early_return"></required>3031</capabilities>3032<parameters>3033<param id="thread">3034<jthread null="current"/>3035<description>3036The thread whose current frame is to return early.3037</description>3038</param>3039<param id="value">3040<jint/>3041<description>3042The return value for the called frame.3043</description>3044</param>3045</parameters>3046<errors>3047<error id="JVMTI_ERROR_OPAQUE_FRAME">3048Attempted to return early from a frame3049corresponding to a native method.3050Or the implementation is unable to provide3051this functionality on this frame.3052</error>3053<error id="JVMTI_ERROR_TYPE_MISMATCH">3054The result type of the called method is not3055<code>int</code>, <code>short</code>,3056<code>char</code>, <code>byte</code>, or3057<code>boolean</code>.3058</error>3059<error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">3060Thread was not the current thread and was not suspended.3061</error>3062<error id="JVMTI_ERROR_NO_MORE_FRAMES">3063There are no frames on the call stack.3064</error>3065</errors>3066</function>30673068<function id="ForceEarlyReturnLong" num="83" since="1.1">3069<synopsis>Force Early Return - Long</synopsis>3070<description>3071This function can be used to return from a method whose3072result type is <code>long</code>.3073</description>3074<origin>new</origin>3075<capabilities>3076<required id="can_force_early_return"></required>3077</capabilities>3078<parameters>3079<param id="thread">3080<jthread null="current"/>3081<description>3082The thread whose current frame is to return early.3083</description>3084</param>3085<param id="value">3086<jlong/>3087<description>3088The return value for the called frame.3089</description>3090</param>3091</parameters>3092<errors>3093<error id="JVMTI_ERROR_OPAQUE_FRAME">3094Attempted to return early from a frame3095corresponding to a native method.3096Or the implementation is unable to provide3097this functionality on this frame.3098</error>3099<error id="JVMTI_ERROR_TYPE_MISMATCH">3100The result type of the called method is not <code>long</code>.3101</error>3102<error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">3103Thread was not the current thread and was not suspended.3104</error>3105<error id="JVMTI_ERROR_NO_MORE_FRAMES">3106There are no frames on the call stack.3107</error>3108</errors>3109</function>31103111<function id="ForceEarlyReturnFloat" num="84" since="1.1">3112<synopsis>Force Early Return - Float</synopsis>3113<description>3114This function can be used to return from a method whose3115result type is <code>float</code>.3116</description>3117<origin>new</origin>3118<capabilities>3119<required id="can_force_early_return"></required>3120</capabilities>3121<parameters>3122<param id="thread">3123<jthread null="current"/>3124<description>3125The thread whose current frame is to return early.3126</description>3127</param>3128<param id="value">3129<jfloat/>3130<description>3131The return value for the called frame.3132</description>3133</param>3134</parameters>3135<errors>3136<error id="JVMTI_ERROR_OPAQUE_FRAME">3137Attempted to return early from a frame3138corresponding to a native method.3139Or the implementation is unable to provide3140this functionality on this frame.3141</error>3142<error id="JVMTI_ERROR_TYPE_MISMATCH">3143The result type of the called method is not <code>float</code>.3144</error>3145<error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">3146Thread was not the current thread and was not suspended.3147</error>3148<error id="JVMTI_ERROR_NO_MORE_FRAMES">3149There are no frames on the call stack.3150</error>3151</errors>3152</function>31533154<function id="ForceEarlyReturnDouble" num="85" since="1.1">3155<synopsis>Force Early Return - Double</synopsis>3156<description>3157This function can be used to return from a method whose3158result type is <code>double</code>.3159</description>3160<origin>new</origin>3161<capabilities>3162<required id="can_force_early_return"></required>3163</capabilities>3164<parameters>3165<param id="thread">3166<jthread null="current"/>3167<description>3168The thread whose current frame is to return early.3169</description>3170</param>3171<param id="value">3172<jdouble/>3173<description>3174The return value for the called frame.3175</description>3176</param>3177</parameters>3178<errors>3179<error id="JVMTI_ERROR_OPAQUE_FRAME">3180Attempted to return early from a frame corresponding to a native method.3181Or the implementation is unable to provide this functionality on this frame.3182</error>3183<error id="JVMTI_ERROR_TYPE_MISMATCH">3184The result type of the called method is not <code>double</code>.3185</error>3186<error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">3187Thread was not the current thread and was not suspended.3188</error>3189<error id="JVMTI_ERROR_NO_MORE_FRAMES">3190There are no frames on the call stack.3191</error>3192</errors>3193</function>31943195<function id="ForceEarlyReturnVoid" num="86" since="1.1">3196<synopsis>Force Early Return - Void</synopsis>3197<description>3198This function can be used to return from a method with no result type.3199That is, the called method must be declared <code>void</code>.3200</description>3201<origin>new</origin>3202<capabilities>3203<required id="can_force_early_return"></required>3204</capabilities>3205<parameters>3206<param id="thread">3207<jthread null="current"/>3208<description>3209The thread whose current frame is to return early.3210</description>3211</param>3212</parameters>3213<errors>3214<error id="JVMTI_ERROR_OPAQUE_FRAME">3215Attempted to return early from a frame3216corresponding to a native method.3217Or the implementation is unable to provide3218this functionality on this frame.3219</error>3220<error id="JVMTI_ERROR_TYPE_MISMATCH">3221The called method has a result type.3222</error>3223<error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">3224Thread was not the current thread and was not suspended.3225</error>3226<error id="JVMTI_ERROR_NO_MORE_FRAMES">3227There are no frames on the call stack.3228</error>3229</errors>3230</function>32313232</category>32333234<category id="Heap" label="Heap">3235<intro>3236These functions are used to analyze the heap.3237Functionality includes the ability to view the objects in the3238heap and to tag these objects.3239</intro>32403241<intro id="objectTags" label="Object Tags">3242A <i>tag</i> is a value associated with an object.3243Tags are explicitly set by the agent using the3244<functionlink id="SetTag"></functionlink> function or by3245callback functions such as <functionlink id="jvmtiHeapIterationCallback"/>.3246<p/>3247Tags are local to the environment; that is, the tags of one3248environment are not visible in another.3249<p/>3250Tags are <code>jlong</code> values which can be used3251simply to mark an object or to store a pointer to more detailed3252information. Objects which have not been tagged have a3253tag of zero.3254Setting a tag to zero makes the object untagged.3255</intro>32563257<intro id="heapCallbacks" label="Heap Callback Functions">3258Heap functions which iterate through the heap and recursively3259follow object references use agent supplied callback functions3260to deliver the information.3261<p/>3262These heap callback functions must adhere to the following restrictions --3263These callbacks must not use JNI functions.3264These callbacks must not use <jvmti/> functions except3265<i>callback safe</i> functions which3266specifically allow such use (see the raw monitor, memory management,3267and environment local storage functions).3268<p/>3269An implementation may invoke a callback on an internal thread or3270the thread which called the iteration function.3271Heap callbacks are single threaded -- no more than one callback will3272be invoked at a time.3273<p/>3274The Heap Filter Flags can be used to prevent reporting3275based on the tag status of an object or its class.3276If no flags are set (the <code>jint</code> is zero), objects3277will not be filtered out.32783279<constants id="jvmtiHeapFilter" label="Heap Filter Flags" kind="bits">3280<constant id="JVMTI_HEAP_FILTER_TAGGED" num="0x4">3281Filter out tagged objects. Objects which are tagged are not included.3282</constant>3283<constant id="JVMTI_HEAP_FILTER_UNTAGGED" num="0x8">3284Filter out untagged objects. Objects which are not tagged are not included.3285</constant>3286<constant id="JVMTI_HEAP_FILTER_CLASS_TAGGED" num="0x10">3287Filter out objects with tagged classes. Objects whose class is tagged are not included.3288</constant>3289<constant id="JVMTI_HEAP_FILTER_CLASS_UNTAGGED" num="0x20">3290Filter out objects with untagged classes. Objects whose class is not tagged are not included.3291</constant>3292</constants>32933294<p/>3295The Heap Visit Control Flags are returned by the heap callbacks3296and can be used to abort the iteration. For the3297<functionlink id="jvmtiHeapReferenceCallback">Heap3298Reference Callback</functionlink>, it can also be used3299to prune the graph of traversed references3300(<code>JVMTI_VISIT_OBJECTS</code> is not set).33013302<constants id="jvmtiHeapVisitControl"3303label="Heap Visit Control Flags"3304kind="bits"3305since="1.1">3306<constant id="JVMTI_VISIT_OBJECTS" num="0x100">3307If we are visiting an object and if this callback3308was initiated by <functionlink id="FollowReferences"/>,3309traverse the references of this object.3310Otherwise ignored.3311</constant>3312<constant id="JVMTI_VISIT_ABORT" num="0x8000">3313Abort the iteration. Ignore all other bits.3314</constant>3315</constants>33163317<p/>3318The Heap Reference Enumeration is provided by the3319<functionlink id="jvmtiHeapReferenceCallback">Heap3320Reference Callback</functionlink> and3321<functionlink id="jvmtiPrimitiveFieldCallback">Primitive Field3322Callback</functionlink> to3323describe the kind of reference3324being reported.33253326<constants id="jvmtiHeapReferenceKind"3327label="Heap Reference Enumeration"3328kind="enum"3329since="1.1">3330<constant id="JVMTI_HEAP_REFERENCE_CLASS" num="1">3331Reference from an object to its class.3332</constant>3333<constant id="JVMTI_HEAP_REFERENCE_FIELD" num="2">3334Reference from an object to the value of one of its instance fields.3335</constant>3336<constant id="JVMTI_HEAP_REFERENCE_ARRAY_ELEMENT" num="3">3337Reference from an array to one of its elements.3338</constant>3339<constant id="JVMTI_HEAP_REFERENCE_CLASS_LOADER" num="4">3340Reference from a class to its class loader.3341</constant>3342<constant id="JVMTI_HEAP_REFERENCE_SIGNERS" num="5">3343Reference from a class to its signers array.3344</constant>3345<constant id="JVMTI_HEAP_REFERENCE_PROTECTION_DOMAIN" num="6">3346Reference from a class to its protection domain.3347</constant>3348<constant id="JVMTI_HEAP_REFERENCE_INTERFACE" num="7">3349Reference from a class to one of its interfaces.3350Note: interfaces are defined via a constant pool reference,3351so the referenced interfaces may also be reported with a3352<code>JVMTI_HEAP_REFERENCE_CONSTANT_POOL</code> reference kind.3353</constant>3354<constant id="JVMTI_HEAP_REFERENCE_STATIC_FIELD" num="8">3355Reference from a class to the value of one of its static fields.3356</constant>3357<constant id="JVMTI_HEAP_REFERENCE_CONSTANT_POOL" num="9">3358Reference from a class to a resolved entry in the constant pool.3359</constant>3360<constant id="JVMTI_HEAP_REFERENCE_SUPERCLASS" num="10">3361Reference from a class to its superclass.3362A callback is bot sent if the superclass is <code>java.lang.Object</code>.3363Note: loaded classes define superclasses via a constant pool3364reference, so the referenced superclass may also be reported with3365a <code>JVMTI_HEAP_REFERENCE_CONSTANT_POOL</code> reference kind.3366</constant>3367<constant id="JVMTI_HEAP_REFERENCE_JNI_GLOBAL" num="21">3368Heap root reference: JNI global reference.3369</constant>3370<constant id="JVMTI_HEAP_REFERENCE_SYSTEM_CLASS" num="22">3371Heap root reference: System class.3372</constant>3373<constant id="JVMTI_HEAP_REFERENCE_MONITOR" num="23">3374Heap root reference: monitor.3375</constant>3376<constant id="JVMTI_HEAP_REFERENCE_STACK_LOCAL" num="24">3377Heap root reference: local variable on the stack.3378</constant>3379<constant id="JVMTI_HEAP_REFERENCE_JNI_LOCAL" num="25">3380Heap root reference: JNI local reference.3381</constant>3382<constant id="JVMTI_HEAP_REFERENCE_THREAD" num="26">3383Heap root reference: Thread.3384</constant>3385<constant id="JVMTI_HEAP_REFERENCE_OTHER" num="27">3386Heap root reference: other heap root reference.3387</constant>3388</constants>33893390<p/>3391Definitions for the single character type descriptors of3392primitive types.33933394<constants id="jvmtiPrimitiveType"3395label="Primitive Type Enumeration"3396kind="enum"3397since="1.1">3398<constant id="JVMTI_PRIMITIVE_TYPE_BOOLEAN" num="90">3399'Z' - Java programming language <code>boolean</code> - JNI <code>jboolean</code>3400</constant>3401<constant id="JVMTI_PRIMITIVE_TYPE_BYTE" num="66">3402'B' - Java programming language <code>byte</code> - JNI <code>jbyte</code>3403</constant>3404<constant id="JVMTI_PRIMITIVE_TYPE_CHAR" num="67">3405'C' - Java programming language <code>char</code> - JNI <code>jchar</code>3406</constant>3407<constant id="JVMTI_PRIMITIVE_TYPE_SHORT" num="83">3408'S' - Java programming language <code>short</code> - JNI <code>jshort</code>3409</constant>3410<constant id="JVMTI_PRIMITIVE_TYPE_INT" num="73">3411'I' - Java programming language <code>int</code> - JNI <code>jint</code>3412</constant>3413<constant id="JVMTI_PRIMITIVE_TYPE_LONG" num="74">3414'J' - Java programming language <code>long</code> - JNI <code>jlong</code>3415</constant>3416<constant id="JVMTI_PRIMITIVE_TYPE_FLOAT" num="70">3417'F' - Java programming language <code>float</code> - JNI <code>jfloat</code>3418</constant>3419<constant id="JVMTI_PRIMITIVE_TYPE_DOUBLE" num="68">3420'D' - Java programming language <code>double</code> - JNI <code>jdouble</code>3421</constant>3422</constants>3423</intro>34243425<typedef id="jvmtiHeapReferenceInfoField"3426label="Reference information structure for Field references"3427since="1.1">3428<description>3429Reference information returned for3430<datalink id="JVMTI_HEAP_REFERENCE_FIELD"/> and3431<datalink id="JVMTI_HEAP_REFERENCE_STATIC_FIELD"/> references.3432</description>3433<field id="index">3434<jint/>3435<description>3436For <datalink id="JVMTI_HEAP_REFERENCE_FIELD"/>, the3437referrer object is not a class or an inteface.3438In this case, <code>index</code> is the index of the field3439in the class of the referrer object.3440This class is referred to below as <i>C</i>.3441<p/>3442For <datalink id="JVMTI_HEAP_REFERENCE_STATIC_FIELD"/>,3443the referrer object is a class (referred to below as <i>C</i>)3444or an interface (referred to below as <i>I</i>).3445In this case, <code>index</code> is the index of the field in3446that class or interface.3447<p/>3448If the referrer object is not an interface, then the field3449indices are determined as follows:3450<ul>3451<li>make a list of all the fields in <i>C</i> and its3452superclasses, starting with all the fields in3453<code>java.lang.Object</code> and ending with all the3454fields in <i>C</i>.</li>3455<li>Within this list, put3456the fields for a given class in the order returned by3457<functionlink id="GetClassFields"/>.</li>3458<li>Assign the fields in this list indices3459<i>n</i>, <i>n</i>+1, ..., in order, where <i>n</i>3460is the count of the fields in all the interfaces3461implemented by <i>C</i>.3462Note that <i>C</i> implements all interfaces3463directly implemented by its superclasses; as well3464as all superinterfaces of these interfaces.</li>3465</ul>3466If the referrer object is an interface, then the field3467indices are determined as follows:3468<ul>3469<li>make a list of the fields directly declared in3470<i>I</i>.</li>3471<li>Within this list, put3472the fields in the order returned by3473<functionlink id="GetClassFields"/>.</li>3474<li>Assign the fields in this list indices3475<i>n</i>, <i>n</i>+1, ..., in order, where <i>n</i>3476is the count of the fields in all the superinterfaces3477of <i>I</i>.</li>3478</ul>3479All fields are included in this computation, regardless of3480field modifier (static, public, private, etc).3481<p/>3482For example, given the following classes and interfaces:3483<example>3484interface I0 {3485int p = 0;3486}34873488interface I1 extends I0 {3489int x = 1;3490}34913492interface I2 extends I0 {3493int y = 2;3494}34953496class C1 implements I1 {3497public static int a = 3;3498private int b = 4;3499}35003501class C2 extends C1 implements I2 {3502static int q = 5;3503final int r = 6;3504}3505</example>3506Assume that <functionlink id="GetClassFields"/> called on3507<code>C1</code> returns the fields of <code>C1</code> in the3508order: a, b; and that the fields of <code>C2</code> are3509returned in the order: q, r.3510An instance of class <code>C1</code> will have the3511following field indices:3512<dl><dd><table>3513<tr>3514<td>3515a3516</td>3517<td>351823519</td>3520<td align="left">3521The count of the fields in the interfaces3522implemented by <code>C1</code> is two (<i>n</i>=2):3523<code>p</code> of <code>I0</code>3524and <code>x</code> of <code>I1</code>.3525</td>3526</tr>3527<tr>3528<td>3529b3530</td>3531<td>353233533</td>3534<td align="left">3535the subsequent index.3536</td>3537</tr>3538</table></dd></dl>3539The class <code>C1</code> will have the same field indices.3540<p/>3541An instance of class <code>C2</code> will have the3542following field indices:3543<dl><dd><table>3544<tr>3545<td>3546a3547</td>3548<td>354933550</td>3551<td align="left">3552The count of the fields in the interfaces3553implemented by <code>C2</code> is three (<i>n</i>=3):3554<code>p</code> of <code>I0</code>,3555<code>x</code> of <code>I1</code> and <code>y</code> of <code>I2</code>3556(an interface of <code>C2</code>). Note that the field <code>p</code>3557of <code>I0</code> is only included once.3558</td>3559</tr>3560<tr>3561<td>3562b3563</td>3564<td>356543566</td>3567<td align="left">3568the subsequent index to "a".3569</td>3570</tr>3571<tr>3572<td>3573q3574</td>3575<td>357653577</td>3578<td align="left">3579the subsequent index to "b".3580</td>3581</tr>3582<tr>3583<td>3584r3585</td>3586<td>358763588</td>3589<td align="left">3590the subsequent index to "q".3591</td>3592</tr>3593</table></dd></dl>3594The class <code>C2</code> will have the same field indices.3595Note that a field may have a different index depending on the3596object that is viewing it -- for example field "a" above.3597Note also: not all field indices may be visible from the3598callbacks, but all indices are shown for illustrative purposes.3599<p/>3600The interface <code>I1</code> will have the3601following field indices:3602<dl><dd><table>3603<tr>3604<td>3605x3606</td>3607<td>360813609</td>3610<td align="left">3611The count of the fields in the superinterfaces3612of <code>I1</code> is one (<i>n</i>=1):3613<code>p</code> of <code>I0</code>.3614</td>3615</tr>3616</table></dd></dl>3617</description>3618</field>3619</typedef>36203621<typedef id="jvmtiHeapReferenceInfoArray"3622label="Reference information structure for Array references"3623since="1.1">3624<description>3625Reference information returned for3626<datalink id="JVMTI_HEAP_REFERENCE_ARRAY_ELEMENT"/> references.3627</description>3628<field id="index">3629<jint/>3630<description>3631The array index.3632</description>3633</field>3634</typedef>36353636<typedef id="jvmtiHeapReferenceInfoConstantPool"3637label="Reference information structure for Constant Pool references"3638since="1.1">3639<description>3640Reference information returned for3641<datalink id="JVMTI_HEAP_REFERENCE_CONSTANT_POOL"/> references.3642</description>3643<field id="index">3644<jint/>3645<description>3646The index into the constant pool of the class. See the description in3647<vmspec chapter="4.4"/>.3648</description>3649</field>3650</typedef>36513652<typedef id="jvmtiHeapReferenceInfoStackLocal"3653label="Reference information structure for Local Variable references"3654since="1.1">3655<description>3656Reference information returned for3657<datalink id="JVMTI_HEAP_REFERENCE_STACK_LOCAL"/> references.3658</description>3659<field id="thread_tag">3660<jlong/>3661<description>3662The tag of the thread corresponding to this stack, zero if not tagged.3663</description>3664</field>3665<field id="thread_id">3666<jlong/>3667<description>3668The unique thread ID of the thread corresponding to this stack.3669</description>3670</field>3671<field id="depth">3672<jint/>3673<description>3674The depth of the frame.3675</description>3676</field>3677<field id="method">3678<jmethodID/>3679<description>3680The method executing in this frame.3681</description>3682</field>3683<field id="location">3684<jlocation/>3685<description>3686The currently executing location in this frame.3687</description>3688</field>3689<field id="slot">3690<jint/>3691<description>3692The slot number of the local variable.3693</description>3694</field>3695</typedef>36963697<typedef id="jvmtiHeapReferenceInfoJniLocal"3698label="Reference information structure for JNI local references"3699since="1.1">3700<description>3701Reference information returned for3702<datalink id="JVMTI_HEAP_REFERENCE_JNI_LOCAL"/> references.3703</description>3704<field id="thread_tag">3705<jlong/>3706<description>3707The tag of the thread corresponding to this stack, zero if not tagged.3708</description>3709</field>3710<field id="thread_id">3711<jlong/>3712<description>3713The unique thread ID of the thread corresponding to this stack.3714</description>3715</field>3716<field id="depth">3717<jint/>3718<description>3719The depth of the frame.3720</description>3721</field>3722<field id="method">3723<jmethodID/>3724<description>3725The method executing in this frame.3726</description>3727</field>3728</typedef>37293730<typedef id="jvmtiHeapReferenceInfoReserved"3731label="Reference information structure for Other references"3732since="1.1">3733<description>3734Reference information returned for other references.3735</description>3736<field id="reserved1">3737<jlong/>3738<description>3739reserved for future use.3740</description>3741</field>3742<field id="reserved2">3743<jlong/>3744<description>3745reserved for future use.3746</description>3747</field>3748<field id="reserved3">3749<jlong/>3750<description>3751reserved for future use.3752</description>3753</field>3754<field id="reserved4">3755<jlong/>3756<description>3757reserved for future use.3758</description>3759</field>3760<field id="reserved5">3761<jlong/>3762<description>3763reserved for future use.3764</description>3765</field>3766<field id="reserved6">3767<jlong/>3768<description>3769reserved for future use.3770</description>3771</field>3772<field id="reserved7">3773<jlong/>3774<description>3775reserved for future use.3776</description>3777</field>3778<field id="reserved8">3779<jlong/>3780<description>3781reserved for future use.3782</description>3783</field>3784</typedef>37853786<uniontypedef id="jvmtiHeapReferenceInfo"3787label="Reference information structure"3788since="1.1">3789<description>3790The information returned about referrers.3791Represented as a union of the various kinds of reference information.3792</description>3793<field id="field">3794<struct>jvmtiHeapReferenceInfoField</struct>3795<description>3796The referrer information for3797<datalink id="JVMTI_HEAP_REFERENCE_FIELD"/>3798and <datalink id="JVMTI_HEAP_REFERENCE_STATIC_FIELD"/> references.3799</description>3800</field>3801<field id="array">3802<struct>jvmtiHeapReferenceInfoArray</struct>3803<description>3804The referrer information for3805For <datalink id="JVMTI_HEAP_REFERENCE_ARRAY_ELEMENT"/> references.3806</description>3807</field>3808<field id="constant_pool">3809<struct>jvmtiHeapReferenceInfoConstantPool</struct>3810<description>3811The referrer information for3812For <datalink id="JVMTI_HEAP_REFERENCE_CONSTANT_POOL"/> references.3813</description>3814</field>3815<field id="stack_local">3816<struct>jvmtiHeapReferenceInfoStackLocal</struct>3817<description>3818The referrer information for3819For <datalink id="JVMTI_HEAP_REFERENCE_STACK_LOCAL"/> references.3820</description>3821</field>3822<field id="jni_local">3823<struct>jvmtiHeapReferenceInfoJniLocal</struct>3824<description>3825The referrer information for3826For <datalink id="JVMTI_HEAP_REFERENCE_JNI_LOCAL"/> references.3827</description>3828</field>3829<field id="other">3830<struct>jvmtiHeapReferenceInfoReserved</struct>3831<description>3832reserved for future use.3833</description>3834</field>3835</uniontypedef>38363837<typedef id="jvmtiHeapCallbacks"3838label="Heap callback function structure"3839since="1.1">3840<field id="heap_iteration_callback">3841<ptrtype>3842<struct>jvmtiHeapIterationCallback</struct>3843</ptrtype>3844<description>3845The callback to be called to describe an3846object in the heap. Used by the3847<functionlink id="IterateThroughHeap"/> function, ignored by the3848<functionlink id="FollowReferences"/> function.3849</description>3850</field>3851<field id="heap_reference_callback">3852<ptrtype>3853<struct>jvmtiHeapReferenceCallback</struct>3854</ptrtype>3855<description>3856The callback to be called to describe an3857object reference. Used by the3858<functionlink id="FollowReferences"/> function, ignored by the3859<functionlink id="IterateThroughHeap"/> function.3860</description>3861</field>3862<field id="primitive_field_callback">3863<ptrtype>3864<struct>jvmtiPrimitiveFieldCallback</struct>3865</ptrtype>3866<description>3867The callback to be called to describe a3868primitive field.3869</description>3870</field>3871<field id="array_primitive_value_callback">3872<ptrtype>3873<struct>jvmtiArrayPrimitiveValueCallback</struct>3874</ptrtype>3875<description>3876The callback to be called to describe an3877array of primitive values.3878</description>3879</field>3880<field id="string_primitive_value_callback">3881<ptrtype>3882<struct>jvmtiStringPrimitiveValueCallback</struct>3883</ptrtype>3884<description>3885The callback to be called to describe a String value.3886</description>3887</field>3888<field id="reserved5">3889<ptrtype>3890<struct>jvmtiReservedCallback</struct>3891</ptrtype>3892<description>3893Reserved for future use..3894</description>3895</field>3896<field id="reserved6">3897<ptrtype>3898<struct>jvmtiReservedCallback</struct>3899</ptrtype>3900<description>3901Reserved for future use..3902</description>3903</field>3904<field id="reserved7">3905<ptrtype>3906<struct>jvmtiReservedCallback</struct>3907</ptrtype>3908<description>3909Reserved for future use..3910</description>3911</field>3912<field id="reserved8">3913<ptrtype>3914<struct>jvmtiReservedCallback</struct>3915</ptrtype>3916<description>3917Reserved for future use..3918</description>3919</field>3920<field id="reserved9">3921<ptrtype>3922<struct>jvmtiReservedCallback</struct>3923</ptrtype>3924<description>3925Reserved for future use..3926</description>3927</field>3928<field id="reserved10">3929<ptrtype>3930<struct>jvmtiReservedCallback</struct>3931</ptrtype>3932<description>3933Reserved for future use..3934</description>3935</field>3936<field id="reserved11">3937<ptrtype>3938<struct>jvmtiReservedCallback</struct>3939</ptrtype>3940<description>3941Reserved for future use..3942</description>3943</field>3944<field id="reserved12">3945<ptrtype>3946<struct>jvmtiReservedCallback</struct>3947</ptrtype>3948<description>3949Reserved for future use..3950</description>3951</field>3952<field id="reserved13">3953<ptrtype>3954<struct>jvmtiReservedCallback</struct>3955</ptrtype>3956<description>3957Reserved for future use..3958</description>3959</field>3960<field id="reserved14">3961<ptrtype>3962<struct>jvmtiReservedCallback</struct>3963</ptrtype>3964<description>3965Reserved for future use..3966</description>3967</field>3968<field id="reserved15">3969<ptrtype>3970<struct>jvmtiReservedCallback</struct>3971</ptrtype>3972<description>3973Reserved for future use..3974</description>3975</field>3976</typedef>397739783979<intro>3980<rationale>3981The heap dumping functionality (below) uses a callback3982for each object. While it would seem that a buffered approach3983would provide better throughput, tests do3984not show this to be the case--possibly due to locality of3985memory reference or array access overhead.3986</rationale>39873988<issue>3989Still under investigation as to if java.lang.ref references3990are reported as a different type of reference.3991</issue>39923993<issue>3994Should or can an indication of the cost or relative cost of3995these operations be included?3996</issue>39973998</intro>39994000<callback id="jvmtiHeapIterationCallback" since="1.1">4001<jint/>4002<synopsis>Heap Iteration Callback</synopsis>4003<description>4004Agent supplied callback function.4005Describes (but does not pass in) an object in the heap.4006<p/>4007This function should return a bit vector of the desired4008<datalink id="jvmtiHeapVisitControl">visit control flags</datalink>.4009This will determine if the entire iteration should be aborted4010(the <code>JVMTI_VISIT_OBJECTS</code> flag is ignored).4011<p/>4012See the <internallink id="heapCallbacks">heap callback4013function restrictions</internallink>.4014</description>4015<parameters>4016<param id="class_tag">4017<jlong/>4018<description>4019The tag of the class of object (zero if the class is not tagged).4020If the object represents a runtime class,4021the <code>class_tag</code> is the tag4022associated with <code>java.lang.Class</code>4023(zero if <code>java.lang.Class</code> is not tagged).4024</description>4025</param>4026<param id="size">4027<jlong/>4028<description>4029Size of the object (in bytes). See <functionlink id="GetObjectSize"/>.4030</description>4031</param>4032<param id="tag_ptr">4033<outptr><jlong/></outptr>4034<description>4035The object tag value, or zero if the object is not tagged.4036To set the tag value to be associated with the object4037the agent sets the <code>jlong</code> pointed to by the parameter.4038</description>4039</param>4040<param id="length">4041<jint/>4042<description>4043If this object is an array, the length of the array. Otherwise negative one (-1).4044</description>4045</param>4046<param id="user_data">4047<outptr><void/></outptr>4048<description>4049The user supplied data that was passed into the iteration function.4050</description>4051</param>4052</parameters>4053</callback>40544055<callback id="jvmtiHeapReferenceCallback" since="1.1">4056<jint/>4057<synopsis>Heap Reference Callback</synopsis>4058<description>4059Agent supplied callback function.4060Describes a reference from an object or the VM (the referrer) to another object4061(the referree) or a heap root to a referree.4062<p/>4063This function should return a bit vector of the desired4064<datalink id="jvmtiHeapVisitControl">visit control flags</datalink>.4065This will determine if the objects referenced by the referree4066should be visited or if the entire iteration should be aborted.4067<p/>4068See the <internallink id="heapCallbacks">heap callback4069function restrictions</internallink>.4070</description>4071<parameters>4072<param id="reference_kind">4073<enum>jvmtiHeapReferenceKind</enum>4074<description>4075The kind of reference.4076</description>4077</param>4078<param id="reference_info">4079<inptr>4080<struct>jvmtiHeapReferenceInfo</struct>4081</inptr>4082<description>4083Details about the reference.4084Set when the <datalink id="jvmtiHeapReferenceCallback.reference_kind">reference_kind</datalink> is4085<datalink id="JVMTI_HEAP_REFERENCE_FIELD"/>,4086<datalink id="JVMTI_HEAP_REFERENCE_STATIC_FIELD"/>,4087<datalink id="JVMTI_HEAP_REFERENCE_ARRAY_ELEMENT"/>,4088<datalink id="JVMTI_HEAP_REFERENCE_CONSTANT_POOL"/>,4089<datalink id="JVMTI_HEAP_REFERENCE_STACK_LOCAL"/>,4090or <datalink id="JVMTI_HEAP_REFERENCE_JNI_LOCAL"/>.4091Otherwise <code>NULL</code>.4092</description>4093</param>4094<param id="class_tag">4095<jlong/>4096<description>4097The tag of the class of referree object (zero if the class is not tagged).4098If the referree object represents a runtime class,4099the <code>class_tag</code> is the tag4100associated with <code>java.lang.Class</code>4101(zero if <code>java.lang.Class</code> is not tagged).4102</description>4103</param>4104<param id="referrer_class_tag">4105<jlong/>4106<description>4107The tag of the class of the referrer object (zero if the class is not tagged4108or the referree is a heap root). If the referrer object represents a runtime4109class, the <code>referrer_class_tag</code> is the tag associated with4110the <code>java.lang.Class</code>4111(zero if <code>java.lang.Class</code> is not tagged).4112</description>4113</param>4114<param id="size">4115<jlong/>4116<description>4117Size of the referree object (in bytes).4118See <functionlink id="GetObjectSize"/>.4119</description>4120</param>4121<param id="tag_ptr">4122<outptr><jlong/></outptr>4123<description>4124Points to the referree object tag value, or zero if the object is not4125tagged.4126To set the tag value to be associated with the object4127the agent sets the <code>jlong</code> pointed to by the parameter.4128</description>4129</param>4130<param id="referrer_tag_ptr">4131<outptr><jlong/></outptr>4132<description>4133Points to the tag of the referrer object, or4134points to the zero if the referrer4135object is not tagged.4136<code>NULL</code> if the referrer in not an object (that is,4137this callback is reporting a heap root).4138To set the tag value to be associated with the referrer object4139the agent sets the <code>jlong</code> pointed to by the parameter.4140If this callback is reporting a reference from an object to itself,4141<code>referrer_tag_ptr == tag_ptr</code>.4142</description>4143</param>4144<param id="length">4145<jint/>4146<description>4147If this object is an array, the length of the array. Otherwise negative one (-1).4148</description>4149</param>4150<param id="user_data">4151<outptr><void/></outptr>4152<description>4153The user supplied data that was passed into the iteration function.4154</description>4155</param>4156</parameters>4157</callback>41584159<callback id="jvmtiPrimitiveFieldCallback" since="1.1">4160<jint/>4161<synopsis>Primitive Field Callback</synopsis>4162<description>4163Agent supplied callback function which4164describes a primitive field of an object (<i>the object</i>).4165A primitive field is a field whose type is a primitive type.4166This callback will describe a static field if the object is a class,4167and otherwise will describe an instance field.4168<p/>4169This function should return a bit vector of the desired4170<datalink id="jvmtiHeapVisitControl">visit control flags</datalink>.4171This will determine if the entire iteration should be aborted4172(the <code>JVMTI_VISIT_OBJECTS</code> flag is ignored).4173<p/>4174See the <internallink id="heapCallbacks">heap callback4175function restrictions</internallink>.4176</description>4177<parameters>4178<param id="kind">4179<enum>jvmtiHeapReferenceKind</enum>4180<description>4181The kind of field -- instance or static (<datalink id="JVMTI_HEAP_REFERENCE_FIELD"/> or4182<datalink id="JVMTI_HEAP_REFERENCE_STATIC_FIELD"/>).4183</description>4184</param>4185<param id="info">4186<inptr>4187<struct>jvmtiHeapReferenceInfo</struct>4188</inptr>4189<description>4190Which field (the field index).4191</description>4192</param>4193<param id="object_class_tag">4194<jlong/>4195<description>4196The tag of the class of the object (zero if the class is not tagged).4197If the object represents a runtime class, the4198<code>object_class_tag</code> is the tag4199associated with <code>java.lang.Class</code>4200(zero if <code>java.lang.Class</code> is not tagged).4201</description>4202</param>4203<param id="object_tag_ptr">4204<outptr><jlong/></outptr>4205<description>4206Points to the tag of the object, or zero if the object is not4207tagged.4208To set the tag value to be associated with the object4209the agent sets the <code>jlong</code> pointed to by the parameter.4210</description>4211</param>4212<param id="value">4213<jvalue/>4214<description>4215The value of the field.4216</description>4217</param>4218<param id="value_type">4219<enum>jvmtiPrimitiveType</enum>4220<description>4221The type of the field.4222</description>4223</param>4224<param id="user_data">4225<outptr><void/></outptr>4226<description>4227The user supplied data that was passed into the iteration function.4228</description>4229</param>4230</parameters>4231</callback>42324233<callback id="jvmtiArrayPrimitiveValueCallback" since="1.1">4234<jint/>4235<synopsis>Array Primitive Value Callback</synopsis>4236<description>4237Agent supplied callback function.4238Describes the values in an array of a primitive type.4239<p/>4240This function should return a bit vector of the desired4241<datalink id="jvmtiHeapVisitControl">visit control flags</datalink>.4242This will determine if the entire iteration should be aborted4243(the <code>JVMTI_VISIT_OBJECTS</code> flag is ignored).4244<p/>4245See the <internallink id="heapCallbacks">heap callback4246function restrictions</internallink>.4247</description>4248<parameters>4249<param id="class_tag">4250<jlong/>4251<description>4252The tag of the class of the array object (zero if the class is not tagged).4253</description>4254</param>4255<param id="size">4256<jlong/>4257<description>4258Size of the array (in bytes).4259See <functionlink id="GetObjectSize"/>.4260</description>4261</param>4262<param id="tag_ptr">4263<outptr><jlong/></outptr>4264<description>4265Points to the tag of the array object, or zero if the object is not4266tagged.4267To set the tag value to be associated with the object4268the agent sets the <code>jlong</code> pointed to by the parameter.4269</description>4270</param>4271<param id="element_count">4272<jint/>4273<description>4274The length of the primitive array.4275</description>4276</param>4277<param id="element_type">4278<enum>jvmtiPrimitiveType</enum>4279<description>4280The type of the elements of the array.4281</description>4282</param>4283<param id="elements">4284<vmbuf><void/></vmbuf>4285<description>4286The elements of the array in a packed array of <code>element_count</code>4287items of <code>element_type</code> size each.4288</description>4289</param>4290<param id="user_data">4291<outptr><void/></outptr>4292<description>4293The user supplied data that was passed into the iteration function.4294</description>4295</param>4296</parameters>4297</callback>42984299<callback id="jvmtiStringPrimitiveValueCallback" since="1.1">4300<jint/>4301<synopsis>String Primitive Value Callback</synopsis>4302<description>4303Agent supplied callback function.4304Describes the value of a java.lang.String.4305<p/>4306This function should return a bit vector of the desired4307<datalink id="jvmtiHeapVisitControl">visit control flags</datalink>.4308This will determine if the entire iteration should be aborted4309(the <code>JVMTI_VISIT_OBJECTS</code> flag is ignored).4310<p/>4311See the <internallink id="heapCallbacks">heap callback4312function restrictions</internallink>.4313</description>4314<parameters>4315<param id="class_tag">4316<jlong/>4317<description>4318The tag of the class of the String class (zero if the class is not tagged).4319<issue>Is this needed?</issue>4320</description>4321</param>4322<param id="size">4323<jlong/>4324<description>4325Size of the string (in bytes).4326See <functionlink id="GetObjectSize"/>.4327</description>4328</param>4329<param id="tag_ptr">4330<outptr><jlong/></outptr>4331<description>4332Points to the tag of the String object, or zero if the object is not4333tagged.4334To set the tag value to be associated with the object4335the agent sets the <code>jlong</code> pointed to by the parameter.4336</description>4337</param>4338<param id="value">4339<vmbuf><jchar/></vmbuf>4340<description>4341The value of the String, encoded as a Unicode string.4342</description>4343</param>4344<param id="value_length">4345<jint/>4346<description>4347The length of the string.4348The length is equal to the number of 16-bit Unicode4349characters in the string.4350</description>4351</param>4352<param id="user_data">4353<outptr><void/></outptr>4354<description>4355The user supplied data that was passed into the iteration function.4356</description>4357</param>4358</parameters>4359</callback>436043614362<callback id="jvmtiReservedCallback" since="1.1">4363<jint/>4364<synopsis>reserved for future use Callback</synopsis>4365<description>4366Placeholder -- reserved for future use.4367</description>4368<parameters>4369</parameters>4370</callback>43714372<function id="FollowReferences" num="115" since="1.1">4373<synopsis>Follow References</synopsis>4374<description>4375This function initiates a traversal over the objects that are4376directly and indirectly reachable from the specified object or,4377if <code>initial_object</code> is not specified, all objects4378reachable from the heap roots.4379The heap root are the set of system classes,4380JNI globals, references from thread stacks, and other objects used as roots4381for the purposes of garbage collection.4382<p/>4383This function operates by traversing the reference graph.4384Let <i>A</i>, <i>B</i>, ... represent objects.4385When a reference from <i>A</i> to <i>B</i> is traversed,4386when a reference from a heap root to <i>B</i> is traversed,4387or when <i>B</i> is specified as the <paramlink id="initial_object"/>,4388then <i>B</i> is said to be <i>visited</i>.4389A reference from <i>A</i> to <i>B</i> is not traversed until <i>A</i>4390is visited.4391References are reported in the same order that the references are traversed.4392Object references are reported by invoking the agent supplied4393callback function <functionlink id="jvmtiHeapReferenceCallback"/>.4394In a reference from <i>A</i> to <i>B</i>, <i>A</i> is known4395as the <i>referrer</i> and <i>B</i> as the <i>referree</i>.4396The callback is invoked exactly once for each reference from a referrer;4397this is true even if there are reference cycles or multiple paths to4398the referrer.4399There may be more than one reference between a referrer and a referree,4400each reference is reported.4401These references may be distinguished by examining the4402<datalink4403id="jvmtiHeapReferenceCallback.reference_kind"><code>reference_kind</code></datalink>4404and4405<datalink4406id="jvmtiHeapReferenceCallback.reference_info"><code>reference_info</code></datalink>4407parameters of the <functionlink id="jvmtiHeapReferenceCallback"/> callback.4408<p/>4409This function reports a Java programming language view of object references,4410not a virtual machine implementation view. The following object references4411are reported when they are non-null:4412<ul>4413<li>Instance objects report references to each non-primitive instance fields4414(including inherited fields).</li>4415<li>Instance objects report a reference to the object type (class).</li>4416<li>Classes report a reference to the superclass and directly4417implemented/extended interfaces.</li>4418<li>Classes report a reference to the class loader, protection domain,4419signers, and resolved entries in the constant pool.</li>4420<li>Classes report a reference to each directly declared non-primitive4421static field.</li>4422<li>Arrays report a reference to the array type (class) and each4423array element.</li>4424<li>Primitive arrays report a reference to the array type.</li>4425</ul>4426<p/>4427This function can also be used to examine primitive (non-object) values.4428The primitive value of an array or String4429is reported after the object has been visited;4430it is reported by invoking the agent supplied callback function4431<functionlink id="jvmtiArrayPrimitiveValueCallback"/> or4432<functionlink id="jvmtiStringPrimitiveValueCallback"/>.4433A primitive field4434is reported after the object with that field is visited;4435it is reported by invoking the agent supplied callback function4436<functionlink id="jvmtiPrimitiveFieldCallback"/>.4437<p/>4438Whether a callback is provided or is <code>NULL</code> only determines4439whether the callback will be invoked, it does not influence4440which objects are visited nor does it influence whether other callbacks4441will be invoked.4442However, the4443<datalink id="jvmtiHeapVisitControl">visit control flags</datalink>4444returned by <functionlink id="jvmtiHeapReferenceCallback"/>4445do determine if the objects referenced by the4446current object as visited.4447The <datalink id="jvmtiHeapFilter">heap filter flags</datalink>4448and <paramlink id="klass"/> provided as parameters to this function4449do not control which objects are visited but they do control which4450objects and primitive values are reported by the callbacks.4451For example, if the only callback that was set is4452<fieldlink id="array_primitive_value_callback" struct="jvmtiHeapCallbacks"/> and <code>klass</code>4453is set to the array of bytes class, then only arrays of byte will be4454reported.4455The table below summarizes this:4456<p/>4457<table>4458<tr>4459<th/>4460<th>4461Controls objects visited4462</th>4463<th>4464Controls objects reported4465</th>4466<th>4467Controls primitives reported4468</th>4469</tr>4470<tr>4471<th align="left">4472the4473<datalink id="jvmtiHeapVisitControl">Heap Visit Control Flags</datalink>4474returned by <functionlink id="jvmtiHeapReferenceCallback"/>4475</th>4476<td>4477<b>Yes</b>4478</td>4479<td>4480<b>Yes</b>, since visits are controlled4481</td>4482<td>4483<b>Yes</b>, since visits are controlled4484</td>4485</tr>4486<tr>4487<th align="left">4488<fieldlink id="array_primitive_value_callback" struct="jvmtiHeapCallbacks"/>4489in <paramlink id="callbacks"/> set4490</th>4491<td>4492No4493</td>4494<td>4495<b>Yes</b>4496</td>4497<td>4498No4499</td>4500</tr>4501<tr>4502<th align="left">4503<paramlink id="heap_filter"/>4504</th>4505<td>4506No4507</td>4508<td>4509<b>Yes</b>4510</td>4511<td>4512<b>Yes</b>4513</td>4514</tr>4515<tr>4516<th align="left">4517<paramlink id="klass"/>4518</th>4519<td>4520No4521</td>4522<td>4523<b>Yes</b>4524</td>4525<td>4526<b>Yes</b>4527</td>4528</tr>4529</table>4530<p/>4531During the execution of this function the state of the heap4532does not change: no objects are allocated, no objects are4533garbage collected, and the state of objects (including4534held values) does not change.4535As a result, threads executing Java4536programming language code, threads attempting to resume the4537execution of Java programming language code, and threads4538attempting to execute JNI functions are typically stalled.4539</description>4540<origin>new</origin>4541<capabilities>4542<required id="can_tag_objects"></required>4543</capabilities>4544<parameters>4545<param id="heap_filter">4546<jint/>4547<description>4548This bit vector of4549<datalink id="jvmtiHeapFilter">heap filter flags</datalink>.4550restricts the objects for which the callback function is called.4551This applies to both the object and primitive callbacks.4552</description>4553</param>4554<param id="klass">4555<ptrtype>4556<jclass/>4557<nullok>callbacks are not limited to instances of a particular4558class</nullok>4559</ptrtype>4560<description>4561Callbacks are only reported when the object is an instance of4562this class.4563Objects which are instances of a subclass of <code>klass</code>4564are not reported.4565If <code>klass</code> is an interface, no objects are reported.4566This applies to both the object and primitive callbacks.4567</description>4568</param>4569<param id="initial_object">4570<ptrtype>4571<jobject/>4572<nullok>references are followed from the heap roots</nullok>4573</ptrtype>4574<description>4575The object to follow4576</description>4577</param>4578<param id="callbacks">4579<inptr>4580<struct>jvmtiHeapCallbacks</struct>4581</inptr>4582<description>4583Structure defining the set of callback functions.4584</description>4585</param>4586<param id="user_data">4587<inbuf>4588<void/>4589<nullok><code>NULL</code> is passed as the user supplied data</nullok>4590</inbuf>4591<description>4592User supplied data to be passed to the callback.4593</description>4594</param>4595</parameters>4596<errors>4597<error id="JVMTI_ERROR_INVALID_CLASS">4598<paramlink id="klass"/> is not a valid class.4599</error>4600<error id="JVMTI_ERROR_INVALID_OBJECT">4601<paramlink id="initial_object"/> is not a valid object.4602</error>4603</errors>4604</function>460546064607<function id="IterateThroughHeap" num="116" since="1.1">4608<synopsis>Iterate Through Heap</synopsis>4609<description>4610Initiate an iteration over all objects in the heap.4611This includes both reachable and4612unreachable objects. Objects are visited in no particular order.4613<p/>4614Heap objects are reported by invoking the agent supplied4615callback function <functionlink id="jvmtiHeapIterationCallback"/>.4616References between objects are not reported.4617If only reachable objects are desired, or if object reference information4618is needed, use <functionlink id="FollowReferences"/>.4619<p/>4620This function can also be used to examine primitive (non-object) values.4621The primitive value of an array or String4622is reported after the object has been visited;4623it is reported by invoking the agent supplied callback function4624<functionlink id="jvmtiArrayPrimitiveValueCallback"/> or4625<functionlink id="jvmtiStringPrimitiveValueCallback"/>.4626A primitive field4627is reported after the object with that field is visited;4628it is reported by invoking the agent supplied4629callback function4630<functionlink id="jvmtiPrimitiveFieldCallback"/>.4631<p/>4632Unless the iteration is aborted by the4633<datalink id="jvmtiHeapVisitControl">Heap Visit Control Flags</datalink>4634returned by a callback, all objects in the heap are visited.4635Whether a callback is provided or is <code>NULL</code> only determines4636whether the callback will be invoked, it does not influence4637which objects are visited nor does it influence whether other callbacks4638will be invoked.4639The <datalink id="jvmtiHeapFilter">heap filter flags</datalink>4640and <paramlink id="klass"/> provided as parameters to this function4641do not control which objects are visited but they do control which4642objects and primitive values are reported by the callbacks.4643For example, if the only callback that was set is4644<fieldlink id="array_primitive_value_callback" struct="jvmtiHeapCallbacks"/> and <code>klass</code>4645is set to the array of bytes class, then only arrays of byte will be4646reported. The table below summarizes this (contrast this with4647<functionlink id="FollowReferences"/>):4648<p/>4649<table>4650<tr>4651<th/>4652<th>4653Controls objects visited4654</th>4655<th>4656Controls objects reported4657</th>4658<th>4659Controls primitives reported4660</th>4661</tr>4662<tr>4663<th align="left">4664the4665<datalink id="jvmtiHeapVisitControl">Heap Visit Control Flags</datalink>4666returned by <functionlink id="jvmtiHeapIterationCallback"/>4667</th>4668<td>4669No<br/>(unless they abort the iteration)4670</td>4671<td>4672No<br/>(unless they abort the iteration)4673</td>4674<td>4675No<br/>(unless they abort the iteration)4676</td>4677</tr>4678<tr>4679<th align="left">4680<fieldlink id="array_primitive_value_callback" struct="jvmtiHeapCallbacks"/>4681in <paramlink id="callbacks"/> set4682</th>4683<td>4684No4685</td>4686<td>4687<b>Yes</b>4688</td>4689<td>4690No4691</td>4692</tr>4693<tr>4694<th align="left">4695<paramlink id="heap_filter"/>4696</th>4697<td>4698No4699</td>4700<td>4701<b>Yes</b>4702</td>4703<td>4704<b>Yes</b>4705</td>4706</tr>4707<tr>4708<th align="left">4709<paramlink id="klass"/>4710</th>4711<td>4712No4713</td>4714<td>4715<b>Yes</b>4716</td>4717<td>4718<b>Yes</b>4719</td>4720</tr>4721</table>4722<p/>4723During the execution of this function the state of the heap4724does not change: no objects are allocated, no objects are4725garbage collected, and the state of objects (including4726held values) does not change.4727As a result, threads executing Java4728programming language code, threads attempting to resume the4729execution of Java programming language code, and threads4730attempting to execute JNI functions are typically stalled.4731</description>4732<origin>new</origin>4733<capabilities>4734<required id="can_tag_objects"></required>4735</capabilities>4736<parameters>4737<param id="heap_filter">4738<jint/>4739<description>4740This bit vector of4741<datalink id="jvmtiHeapFilter">heap filter flags</datalink>.4742restricts the objects for which the callback function is called.4743This applies to both the object and primitive callbacks.4744</description>4745</param>4746<param id="klass">4747<ptrtype>4748<jclass/>4749<nullok>callbacks are not limited to instances of a particular class</nullok>4750</ptrtype>4751<description>4752Callbacks are only reported when the object is an instance of4753this class.4754Objects which are instances of a subclass of <code>klass</code>4755are not reported.4756If <code>klass</code> is an interface, no objects are reported.4757This applies to both the object and primitive callbacks.4758</description>4759</param>4760<param id="callbacks">4761<inptr>4762<struct>jvmtiHeapCallbacks</struct>4763</inptr>4764<description>4765Structure defining the set callback functions.4766</description>4767</param>4768<param id="user_data">4769<inbuf>4770<void/>4771<nullok><code>NULL</code> is passed as the user supplied data</nullok>4772</inbuf>4773<description>4774User supplied data to be passed to the callback.4775</description>4776</param>4777</parameters>4778<errors>4779<error id="JVMTI_ERROR_INVALID_CLASS">4780<paramlink id="klass"/> is not a valid class.4781</error>4782</errors>4783</function>47844785<function id="GetTag" phase="start" num="106">4786<synopsis>Get Tag</synopsis>4787<description>4788Retrieve the tag associated with an object.4789The tag is a long value typically used to store a4790unique identifier or pointer to object information.4791The tag is set with4792<functionlink id="SetTag"></functionlink>.4793Objects for which no tags have been set return a4794tag value of zero.4795</description>4796<origin>new</origin>4797<capabilities>4798<required id="can_tag_objects"></required>4799</capabilities>4800<parameters>4801<param id="object">4802<jobject/>4803<description>4804The object whose tag is to be retrieved.4805</description>4806</param>4807<param id="tag_ptr">4808<outptr><jlong/></outptr>4809<description>4810On return, the referenced long is set to the value4811of the tag.4812</description>4813</param>4814</parameters>4815<errors>4816</errors>4817</function>48184819<function id="SetTag" phase="start" num="107">4820<synopsis>Set Tag</synopsis>4821<description>4822Set the tag associated with an object.4823The tag is a long value typically used to store a4824unique identifier or pointer to object information.4825The tag is visible with4826<functionlink id="GetTag"></functionlink>.4827</description>4828<origin>new</origin>4829<capabilities>4830<required id="can_tag_objects"></required>4831</capabilities>4832<parameters>4833<param id="object">4834<jobject/>4835<description>4836The object whose tag is to be set.4837</description>4838</param>4839<param id="tag">4840<jlong/>4841<description>4842The new value of the tag.4843</description>4844</param>4845</parameters>4846<errors>4847</errors>4848</function>48494850<function id="GetObjectsWithTags" num="114">4851<synopsis>Get Objects With Tags</synopsis>4852<description>4853Return objects in the heap with the specified tags.4854The format is parallel arrays of objects and tags.4855</description>4856<origin>new</origin>4857<capabilities>4858<required id="can_tag_objects"></required>4859</capabilities>4860<parameters>4861<param id="tag_count">4862<jint min="0"/>4863<description>4864Number of tags to scan for.4865</description>4866</param>4867<param id="tags">4868<inbuf incount="tag_count">4869<jlong/>4870</inbuf>4871<description>4872Scan for objects with these tags.4873Zero is not permitted in this array.4874</description>4875</param>4876<param id="count_ptr">4877<outptr>4878<jint/>4879</outptr>4880<description>4881Return the number of objects with any of the tags4882in <paramlink id="tags"/>.4883</description>4884</param>4885<param id="object_result_ptr">4886<allocbuf outcount="count_ptr">4887<jobject/>4888<nullok>this information is not returned</nullok>4889</allocbuf>4890<description>4891Returns the array of objects with any of the tags4892in <paramlink id="tags"/>.4893</description>4894</param>4895<param id="tag_result_ptr">4896<allocbuf outcount="count_ptr">4897<jlong/>4898<nullok>this information is not returned</nullok>4899</allocbuf>4900<description>4901For each object in <paramlink id="object_result_ptr"/>,4902return the tag at the corresponding index.4903</description>4904</param>4905</parameters>4906<errors>4907<error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">4908Zero is present in <paramlink id="tags"></paramlink>.4909</error>4910</errors>4911</function>49124913<function id="ForceGarbageCollection" num="108">4914<synopsis>Force Garbage Collection</synopsis>4915<description>4916Force the VM to perform a garbage collection.4917The garbage collection is as complete as possible.4918This function does not cause finalizers to be run.4919This function does not return until the garbage collection4920is finished.4921<p/>4922Although garbage collection is as complete4923as possible there is no guarantee that all4924<eventlink id="ObjectFree"/>4925events will have been4926sent by the time that this function4927returns. In particular, an object may be4928prevented from being freed because it4929is awaiting finalization.4930</description>4931<origin>new</origin>4932<capabilities>4933</capabilities>4934<parameters>4935</parameters>4936<errors>4937</errors>4938</function>493949404941</category>49424943<category id="Heap_1_0" label="Heap (1.0)">4944<intro>4945<b>4946These functions and data types were introduced in the original4947<jvmti/> version 1.0 and have been superseded by more4948</b>4949<internallink id="Heap"><b>powerful and flexible versions</b></internallink>4950<b>4951which:4952</b>4953<ul>4954<li>4955<b>4956Allow access to primitive values (the value of Strings, arrays,4957and primitive fields)4958</b>4959</li>4960<li>4961<b>4962Allow the tag of the referrer to be set, thus enabling more4963efficient localized reference graph building4964</b>4965</li>4966<li>4967<b>4968Provide more extensive filtering abilities4969</b>4970</li>4971<li>4972<b>4973Are extensible, allowing their abilities to grow in future versions of <jvmti/>4974</b>4975</li>4976</ul>4977<p/>4978<b>Please use the </b>4979<internallink id="Heap"><b>current Heap functions</b></internallink>.4980<p/>4981<constants id="jvmtiHeapObjectFilter" label="Heap Object Filter Enumeration" kind="enum">4982<constant id="JVMTI_HEAP_OBJECT_TAGGED" num="1">4983Tagged objects only.4984</constant>4985<constant id="JVMTI_HEAP_OBJECT_UNTAGGED" num="2">4986Untagged objects only.4987</constant>4988<constant id="JVMTI_HEAP_OBJECT_EITHER" num="3">4989Either tagged or untagged objects.4990</constant>4991</constants>49924993<constants id="jvmtiHeapRootKind" label="Heap Root Kind Enumeration" kind="enum">4994<constant id="JVMTI_HEAP_ROOT_JNI_GLOBAL" num="1">4995JNI global reference.4996</constant>4997<constant id="JVMTI_HEAP_ROOT_SYSTEM_CLASS" num="2">4998System class.4999</constant>5000<constant id="JVMTI_HEAP_ROOT_MONITOR" num="3">5001Monitor.5002</constant>5003<constant id="JVMTI_HEAP_ROOT_STACK_LOCAL" num="4">5004Stack local.5005</constant>5006<constant id="JVMTI_HEAP_ROOT_JNI_LOCAL" num="5">5007JNI local reference.5008</constant>5009<constant id="JVMTI_HEAP_ROOT_THREAD" num="6">5010Thread.5011</constant>5012<constant id="JVMTI_HEAP_ROOT_OTHER" num="7">5013Other.5014</constant>5015</constants>50165017<constants id="jvmtiObjectReferenceKind" label="Object Reference Enumeration" kind="enum">5018<constant id="JVMTI_REFERENCE_CLASS" num="1">5019Reference from an object to its class.5020</constant>5021<constant id="JVMTI_REFERENCE_FIELD" num="2">5022Reference from an object to the value of one of its instance fields.5023For references of this kind the <code>referrer_index</code>5024parameter to the <internallink id="jvmtiObjectReferenceCallback">5025jvmtiObjectReferenceCallback</internallink> is the index of the5026the instance field. The index is based on the order of all the5027object's fields. This includes all fields of the directly declared5028static and instance fields in the class, and includes all fields (both5029public and private) fields declared in superclasses and superinterfaces.5030The index is thus calculated by summing the index of the field in the directly5031declared class (see <functionlink id="GetClassFields"/>), with the total5032number of fields (both public and private) declared in all superclasses5033and superinterfaces. The index starts at zero.5034</constant>5035<constant id="JVMTI_REFERENCE_ARRAY_ELEMENT" num="3">5036Reference from an array to one of its elements.5037For references of this kind the <code>referrer_index</code>5038parameter to the <internallink id="jvmtiObjectReferenceCallback">5039jvmtiObjectReferenceCallback</internallink> is the array index.5040</constant>5041<constant id="JVMTI_REFERENCE_CLASS_LOADER" num="4">5042Reference from a class to its class loader.5043</constant>5044<constant id="JVMTI_REFERENCE_SIGNERS" num="5">5045Reference from a class to its signers array.5046</constant>5047<constant id="JVMTI_REFERENCE_PROTECTION_DOMAIN" num="6">5048Reference from a class to its protection domain.5049</constant>5050<constant id="JVMTI_REFERENCE_INTERFACE" num="7">5051Reference from a class to one of its interfaces.5052</constant>5053<constant id="JVMTI_REFERENCE_STATIC_FIELD" num="8">5054Reference from a class to the value of one of its static fields.5055For references of this kind the <code>referrer_index</code>5056parameter to the <internallink id="jvmtiObjectReferenceCallback">5057jvmtiObjectReferenceCallback</internallink> is the index of the5058the static field. The index is based on the order of all the5059object's fields. This includes all fields of the directly declared5060static and instance fields in the class, and includes all fields (both5061public and private) fields declared in superclasses and superinterfaces.5062The index is thus calculated by summing the index of the field in the directly5063declared class (see <functionlink id="GetClassFields"/>), with the total5064number of fields (both public and private) declared in all superclasses5065and superinterfaces. The index starts at zero.5066Note: this definition differs from that in the <jvmti/> 1.0 Specification.5067<rationale>No known implementations used the 1.0 definition.</rationale>5068</constant>5069<constant id="JVMTI_REFERENCE_CONSTANT_POOL" num="9">5070Reference from a class to a resolved entry in the constant pool.5071For references of this kind the <code>referrer_index</code>5072parameter to the <internallink id="jvmtiObjectReferenceCallback">5073jvmtiObjectReferenceCallback</internallink> is the index into5074constant pool table of the class, starting at 1. See5075<vmspec chapter="4.4"/>.5076</constant>5077</constants>50785079<constants id="jvmtiIterationControl" label="Iteration Control Enumeration" kind="enum">5080<constant id="JVMTI_ITERATION_CONTINUE" num="1">5081Continue the iteration.5082If this is a reference iteration, follow the references of this object.5083</constant>5084<constant id="JVMTI_ITERATION_IGNORE" num="2">5085Continue the iteration.5086If this is a reference iteration, ignore the references of this object.5087</constant>5088<constant id="JVMTI_ITERATION_ABORT" num="0">5089Abort the iteration.5090</constant>5091</constants>5092</intro>50935094<callback id="jvmtiHeapObjectCallback">5095<enum>jvmtiIterationControl</enum>5096<synopsis>Heap Object Callback</synopsis>5097<description>5098Agent supplied callback function.5099Describes (but does not pass in) an object in the heap.5100<p/>5101Return value should be <code>JVMTI_ITERATION_CONTINUE</code> to continue iteration,5102or <code>JVMTI_ITERATION_ABORT</code> to stop iteration.5103<p/>5104See the <internallink id="heapCallbacks">heap callback5105function restrictions</internallink>.5106</description>5107<parameters>5108<param id="class_tag">5109<jlong/>5110<description>5111The tag of the class of object (zero if the class is not tagged).5112If the object represents a runtime class,5113the <code>class_tag</code> is the tag5114associated with <code>java.lang.Class</code>5115(zero if <code>java.lang.Class</code> is not tagged).5116</description>5117</param>5118<param id="size">5119<jlong/>5120<description>5121Size of the object (in bytes). See <functionlink id="GetObjectSize"/>.5122</description>5123</param>5124<param id="tag_ptr">5125<outptr><jlong/></outptr>5126<description>5127The object tag value, or zero if the object is not tagged.5128To set the tag value to be associated with the object5129the agent sets the <code>jlong</code> pointed to by the parameter.5130</description>5131</param>5132<param id="user_data">5133<outptr><void/></outptr>5134<description>5135The user supplied data that was passed into the iteration function.5136</description>5137</param>5138</parameters>5139</callback>51405141<callback id="jvmtiHeapRootCallback">5142<enum>jvmtiIterationControl</enum>5143<synopsis>Heap Root Object Callback</synopsis>5144<description>5145Agent supplied callback function.5146Describes (but does not pass in) an object that is a root for the purposes5147of garbage collection.5148<p/>5149Return value should be <code>JVMTI_ITERATION_CONTINUE</code> to continue iteration,5150<code>JVMTI_ITERATION_IGNORE</code> to continue iteration without pursuing5151references from referree object or <code>JVMTI_ITERATION_ABORT</code> to stop iteration.5152<p/>5153See the <internallink id="heapCallbacks">heap callback5154function restrictions</internallink>.5155</description>5156<parameters>5157<param id="root_kind">5158<enum>jvmtiHeapRootKind</enum>5159<description>5160The kind of heap root.5161</description>5162</param>5163<param id="class_tag">5164<jlong/>5165<description>5166The tag of the class of object (zero if the class is not tagged).5167If the object represents a runtime class, the <code>class_tag</code> is the tag5168associated with <code>java.lang.Class</code>5169(zero if <code>java.lang.Class</code> is not tagged).5170</description>5171</param>5172<param id="size">5173<jlong/>5174<description>5175Size of the object (in bytes). See <functionlink id="GetObjectSize"/>.5176</description>5177</param>5178<param id="tag_ptr">5179<outptr><jlong/></outptr>5180<description>5181The object tag value, or zero if the object is not tagged.5182To set the tag value to be associated with the object5183the agent sets the <code>jlong</code> pointed to by the parameter.5184</description>5185</param>5186<param id="user_data">5187<outptr><void/></outptr>5188<description>5189The user supplied data that was passed into the iteration function.5190</description>5191</param>5192</parameters>5193</callback>51945195<callback id="jvmtiStackReferenceCallback">5196<enum>jvmtiIterationControl</enum>5197<synopsis>Stack Reference Object Callback</synopsis>5198<description>5199Agent supplied callback function.5200Describes (but does not pass in) an object on the stack that is a root for5201the purposes of garbage collection.5202<p/>5203Return value should be <code>JVMTI_ITERATION_CONTINUE</code> to continue iteration,5204<code>JVMTI_ITERATION_IGNORE</code> to continue iteration without pursuing5205references from referree object or <code>JVMTI_ITERATION_ABORT</code> to stop iteration.5206<p/>5207See the <internallink id="heapCallbacks">heap callback5208function restrictions</internallink>.5209</description>5210<parameters>5211<param id="root_kind">5212<enum>jvmtiHeapRootKind</enum>5213<description>5214The kind of root (either <code>JVMTI_HEAP_ROOT_STACK_LOCAL</code> or5215<code>JVMTI_HEAP_ROOT_JNI_LOCAL</code>).5216</description>5217</param>5218<param id="class_tag">5219<jlong/>5220<description>5221The tag of the class of object (zero if the class is not tagged).5222If the object represents a runtime class, the <code>class_tag</code> is the tag5223associated with <code>java.lang.Class</code>5224(zero if <code>java.lang.Class</code> is not tagged).5225</description>5226</param>5227<param id="size">5228<jlong/>5229<description>5230Size of the object (in bytes). See <functionlink id="GetObjectSize"/>.5231</description>5232</param>5233<param id="tag_ptr">5234<outptr><jlong/></outptr>5235<description>5236The object tag value, or zero if the object is not tagged.5237To set the tag value to be associated with the object5238the agent sets the <code>jlong</code> pointed to by the parameter.5239</description>5240</param>5241<param id="thread_tag">5242<jlong/>5243<description>5244The tag of the thread corresponding to this stack, zero if not tagged.5245</description>5246</param>5247<param id="depth">5248<jint/>5249<description>5250The depth of the frame.5251</description>5252</param>5253<param id="method">5254<jmethodID/>5255<description>5256The method executing in this frame.5257</description>5258</param>5259<param id="slot">5260<jint/>5261<description>5262The slot number.5263</description>5264</param>5265<param id="user_data">5266<outptr><void/></outptr>5267<description>5268The user supplied data that was passed into the iteration function.5269</description>5270</param>5271</parameters>5272</callback>52735274<callback id="jvmtiObjectReferenceCallback">5275<enum>jvmtiIterationControl</enum>5276<synopsis>Object Reference Callback</synopsis>5277<description>5278Agent supplied callback function.5279Describes a reference from an object (the referrer) to another object5280(the referree).5281<p/>5282Return value should be <code>JVMTI_ITERATION_CONTINUE</code> to continue iteration,5283<code>JVMTI_ITERATION_IGNORE</code> to continue iteration without pursuing5284references from referree object or <code>JVMTI_ITERATION_ABORT</code> to stop iteration.5285<p/>5286See the <internallink id="heapCallbacks">heap callback5287function restrictions</internallink>.5288</description>5289<parameters>5290<param id="reference_kind">5291<enum>jvmtiObjectReferenceKind</enum>5292<description>5293The type of reference.5294</description>5295</param>5296<param id="class_tag">5297<jlong/>5298<description>5299The tag of the class of referree object (zero if the class is not tagged).5300If the referree object represents a runtime class,5301the <code>class_tag</code> is the tag5302associated with <code>java.lang.Class</code>5303(zero if <code>java.lang.Class</code> is not tagged).5304</description>5305</param>5306<param id="size">5307<jlong/>5308<description>5309Size of the referree object (in bytes).5310See <functionlink id="GetObjectSize"/>.5311</description>5312</param>5313<param id="tag_ptr">5314<outptr><jlong/></outptr>5315<description>5316The referree object tag value, or zero if the object is not5317tagged.5318To set the tag value to be associated with the object5319the agent sets the <code>jlong</code> pointed to by the parameter.5320</description>5321</param>5322<param id="referrer_tag">5323<jlong/>5324<description>5325The tag of the referrer object, or zero if the referrer5326object is not tagged.5327</description>5328</param>5329<param id="referrer_index">5330<jint/>5331<description>5332For references of type <code>JVMTI_REFERENCE_FIELD</code> or5333<code>JVMTI_REFERENCE_STATIC_FIELD</code> the index5334of the field in the referrer object. The index is based on the5335order of all the object's fields - see <internallink5336id="JVMTI_REFERENCE_FIELD">JVMTI_REFERENCE_FIELD</internallink>5337or <internallink5338id="JVMTI_REFERENCE_STATIC_FIELD">JVMTI_REFERENCE_STATIC_FIELD5339</internallink> for further description.5340<p/>5341For references of type <code>JVMTI_REFERENCE_ARRAY_ELEMENT</code>5342the array index - see <internallink id="JVMTI_REFERENCE_ARRAY_ELEMENT">5343JVMTI_REFERENCE_ARRAY_ELEMENT</internallink> for further description.5344<p/>5345For references of type <code>JVMTI_REFERENCE_CONSTANT_POOL</code>5346the index into the constant pool of the class - see5347<internallink id="JVMTI_REFERENCE_CONSTANT_POOL">5348JVMTI_REFERENCE_CONSTANT_POOL</internallink> for further5349description.5350<p/>5351For references of other kinds the <code>referrer_index</code> is5352<code>-1</code>.5353</description>5354</param>5355<param id="user_data">5356<outptr><void/></outptr>5357<description>5358The user supplied data that was passed into the iteration function.5359</description>5360</param>5361</parameters>5362</callback>53635364<function id="IterateOverObjectsReachableFromObject" num="109">5365<synopsis>Iterate Over Objects Reachable From Object</synopsis>5366<description>5367This function iterates over all objects that are directly5368and indirectly reachable from the specified object.5369For each object <i>A</i> (known5370as the referrer) with a reference to object <i>B</i> the specified5371callback function is called to describe the object reference.5372The callback is called exactly once for each reference from a referrer;5373this is true even if there are reference cycles or multiple paths to5374the referrer.5375There may be more than one reference between a referrer and a referree,5376These may be distinguished by the5377<datalink id="jvmtiObjectReferenceCallback.reference_kind"></datalink> and5378<datalink id="jvmtiObjectReferenceCallback.referrer_index"></datalink>.5379The callback for an object will always occur after the callback for5380its referrer.5381<p/>5382See <functionlink id="FollowReferences"/> for the object5383references which are reported.5384<p/>5385During the execution of this function the state of the heap5386does not change: no objects are allocated, no objects are5387garbage collected, and the state of objects (including5388held values) does not change.5389As a result, threads executing Java5390programming language code, threads attempting to resume the5391execution of Java programming language code, and threads5392attempting to execute JNI functions are typically stalled.5393</description>5394<origin>new</origin>5395<capabilities>5396<required id="can_tag_objects"></required>5397</capabilities>5398<parameters>5399<param id="object">5400<jobject/>5401<description>5402The object5403</description>5404</param>5405<param id="object_reference_callback">5406<ptrtype>5407<struct>jvmtiObjectReferenceCallback</struct>5408</ptrtype>5409<description>5410The callback to be called to describe each5411object reference.5412</description>5413</param>5414<param id="user_data">5415<inbuf>5416<void/>5417<nullok><code>NULL</code> is passed as the user supplied data</nullok>5418</inbuf>5419<description>5420User supplied data to be passed to the callback.5421</description>5422</param>5423</parameters>5424<errors>5425</errors>5426</function>54275428<function id="IterateOverReachableObjects" num="110">5429<synopsis>Iterate Over Reachable Objects</synopsis>5430<description>5431This function iterates over the root objects and all objects that5432are directly and indirectly reachable from the root objects.5433The root objects comprise the set of system classes,5434JNI globals, references from thread stacks, and other objects used as roots5435for the purposes of garbage collection.5436<p/>5437For each root the <paramlink id="heap_root_callback"></paramlink>5438or <paramlink id="stack_ref_callback"></paramlink> callback is called.5439An object can be a root object for more than one reason and in that case5440the appropriate callback is called for each reason.5441<p/>5442For each object reference the <paramlink id="object_ref_callback"></paramlink>5443callback function is called to describe the object reference.5444The callback is called exactly once for each reference from a referrer;5445this is true even if there are reference cycles or multiple paths to5446the referrer.5447There may be more than one reference between a referrer and a referree,5448These may be distinguished by the5449<datalink id="jvmtiObjectReferenceCallback.reference_kind"></datalink> and5450<datalink id="jvmtiObjectReferenceCallback.referrer_index"></datalink>.5451The callback for an object will always occur after the callback for5452its referrer.5453<p/>5454See <functionlink id="FollowReferences"/> for the object5455references which are reported.5456<p/>5457Roots are always reported to the profiler before any object references5458are reported. In other words, the <paramlink id="object_ref_callback"></paramlink>5459callback will not be called until the appropriate callback has been called5460for all roots. If the <paramlink id="object_ref_callback"></paramlink> callback is5461specified as <code>NULL</code> then this function returns after5462reporting the root objects to the profiler.5463<p/>5464During the execution of this function the state of the heap5465does not change: no objects are allocated, no objects are5466garbage collected, and the state of objects (including5467held values) does not change.5468As a result, threads executing Java5469programming language code, threads attempting to resume the5470execution of Java programming language code, and threads5471attempting to execute JNI functions are typically stalled.5472</description>5473<origin>new</origin>5474<capabilities>5475<required id="can_tag_objects"></required>5476</capabilities>5477<parameters>5478<param id="heap_root_callback">5479<ptrtype>5480<struct>jvmtiHeapRootCallback</struct>5481<nullok>do not report heap roots</nullok>5482</ptrtype>5483<description>5484The callback function to be called for each heap root of type5485<code>JVMTI_HEAP_ROOT_JNI_GLOBAL</code>,5486<code>JVMTI_HEAP_ROOT_SYSTEM_CLASS</code>,5487<code>JVMTI_HEAP_ROOT_MONITOR</code>,5488<code>JVMTI_HEAP_ROOT_THREAD</code>, or5489<code>JVMTI_HEAP_ROOT_OTHER</code>.5490</description>5491</param>5492<param id="stack_ref_callback">5493<ptrtype>5494<struct>jvmtiStackReferenceCallback</struct>5495<nullok>do not report stack references</nullok>5496</ptrtype>5497<description>5498The callback function to be called for each heap root of5499<code>JVMTI_HEAP_ROOT_STACK_LOCAL</code> or5500<code>JVMTI_HEAP_ROOT_JNI_LOCAL</code>.5501</description>5502</param>5503<param id="object_ref_callback">5504<ptrtype>5505<struct>jvmtiObjectReferenceCallback</struct>5506<nullok>do not follow references from the root objects</nullok>5507</ptrtype>5508<description>5509The callback function to be called for each object reference.5510</description>5511</param>5512<param id="user_data">5513<inbuf>5514<void/>5515<nullok><code>NULL</code> is passed as the user supplied data</nullok>5516</inbuf>5517<description>5518User supplied data to be passed to the callback.5519</description>5520</param>5521</parameters>5522<errors>5523</errors>5524</function>55255526<function id="IterateOverHeap" num="111">5527<synopsis>Iterate Over Heap</synopsis>5528<description>5529Iterate over all objects in the heap. This includes both reachable and5530unreachable objects.5531<p/>5532The <paramlink id="object_filter"></paramlink> parameter indicates the5533objects for which the callback function is called. If this parameter5534is <code>JVMTI_HEAP_OBJECT_TAGGED</code> then the callback will only be5535called for every object that is tagged. If the parameter is5536<code>JVMTI_HEAP_OBJECT_UNTAGGED</code> then the callback will only be5537for objects that are not tagged. If the parameter5538is <code>JVMTI_HEAP_OBJECT_EITHER</code> then the callback will be5539called for every object in the heap, irrespective of whether it is5540tagged or not.5541<p/>5542During the execution of this function the state of the heap5543does not change: no objects are allocated, no objects are5544garbage collected, and the state of objects (including5545held values) does not change.5546As a result, threads executing Java5547programming language code, threads attempting to resume the5548execution of Java programming language code, and threads5549attempting to execute JNI functions are typically stalled.5550</description>5551<origin>new</origin>5552<capabilities>5553<required id="can_tag_objects"></required>5554</capabilities>5555<parameters>5556<param id="object_filter">5557<enum>jvmtiHeapObjectFilter</enum>5558<description>5559Indicates the objects for which the callback function is called.5560</description>5561</param>5562<param id="heap_object_callback">5563<ptrtype>5564<struct>jvmtiHeapObjectCallback</struct>5565</ptrtype>5566<description>5567The iterator function to be called for each5568object matching the <paramlink id="object_filter"/>.5569</description>5570</param>5571<param id="user_data">5572<inbuf>5573<void/>5574<nullok><code>NULL</code> is passed as the user supplied data</nullok>5575</inbuf>5576<description>5577User supplied data to be passed to the callback.5578</description>5579</param>5580</parameters>5581<errors>5582</errors>5583</function>55845585<function id="IterateOverInstancesOfClass" num="112">5586<synopsis>Iterate Over Instances Of Class</synopsis>5587<description>5588Iterate over all objects in the heap that are instances of the specified class.5589This includes direct instances of the specified class and5590instances of all subclasses of the specified class.5591This includes both reachable and unreachable objects.5592<p/>5593The <paramlink id="object_filter"></paramlink> parameter indicates the5594objects for which the callback function is called. If this parameter5595is <code>JVMTI_HEAP_OBJECT_TAGGED</code> then the callback will only be5596called for every object that is tagged. If the parameter is5597<code>JVMTI_HEAP_OBJECT_UNTAGGED</code> then the callback will only be5598called for objects that are not tagged. If the parameter5599is <code>JVMTI_HEAP_OBJECT_EITHER</code> then the callback will be5600called for every object in the heap, irrespective of whether it is5601tagged or not.5602<p/>5603During the execution of this function the state of the heap5604does not change: no objects are allocated, no objects are5605garbage collected, and the state of objects (including5606held values) does not change.5607As a result, threads executing Java5608programming language code, threads attempting to resume the5609execution of Java programming language code, and threads5610attempting to execute JNI functions are typically stalled.5611</description>5612<origin>new</origin>5613<capabilities>5614<required id="can_tag_objects"></required>5615</capabilities>5616<parameters>5617<param id="klass">5618<jclass/>5619<description>5620Iterate over objects of this class only.5621</description>5622</param>5623<param id="object_filter">5624<enum>jvmtiHeapObjectFilter</enum>5625<description>5626Indicates the objects for which the callback function is called.5627</description>5628</param>5629<param id="heap_object_callback">5630<ptrtype>5631<struct>jvmtiHeapObjectCallback</struct>5632</ptrtype>5633<description>5634The iterator function to be called for each5635<paramlink id="klass"/> instance matching5636the <paramlink id="object_filter"/>.5637</description>5638</param>5639<param id="user_data">5640<inbuf>5641<void/>5642<nullok><code>NULL</code> is passed as the user supplied data</nullok>5643</inbuf>5644<description>5645User supplied data to be passed to the callback.5646</description>5647</param>5648</parameters>5649<errors>5650</errors>5651</function>56525653</category>56545655<category id="local" label="Local Variable">56565657<intro>5658These functions are used to retrieve or set the value of a local variable.5659The variable is identified by the depth of the frame containing its5660value and the variable's slot number within that frame.5661The mapping of variables to5662slot numbers can be obtained with the function5663<functionlink id="GetLocalVariableTable"></functionlink>.5664</intro>56655666<function id="GetLocalObject" num="21">5667<synopsis>Get Local Variable - Object</synopsis>5668<description>5669This function can be used to retrieve the value of a local5670variable whose type is <code>Object</code> or a subclass of <code>Object</code>.5671</description>5672<origin>jvmdi</origin>5673<capabilities>5674<required id="can_access_local_variables"></required>5675</capabilities>5676<parameters>5677<param id="thread">5678<jthread null="current" frame="frame"/>5679<description>5680The thread of the frame containing the variable's value.5681</description>5682</param>5683<param id="depth">5684<jframeID thread="thread"/>5685<description>5686The depth of the frame containing the variable's value.5687</description>5688</param>5689<param id="slot">5690<jint/>5691<description>5692The variable's slot number.5693</description>5694</param>5695<param id="value_ptr">5696<outptr><jobject/></outptr>5697<description>5698On return, points to the variable's value.5699</description>5700</param>5701</parameters>5702<errors>5703<error id="JVMTI_ERROR_INVALID_SLOT">5704Invalid <code>slot</code>.5705</error>5706<error id="JVMTI_ERROR_TYPE_MISMATCH">5707The variable type is not5708<code>Object</code> or a subclass of <code>Object</code>.5709</error>5710<error id="JVMTI_ERROR_OPAQUE_FRAME">5711Not a visible frame5712</error>5713</errors>5714</function>57155716<function id="GetLocalInstance" num="155" since="1.2">5717<synopsis>Get Local Instance</synopsis>5718<description>5719This function can be used to retrieve the value of the local object5720variable at slot 0 (the "<code>this</code>" object) from non-static5721frames. This function can retrieve the "<code>this</code>" object from5722native method frames, whereas <code>GetLocalObject()</code> would5723return <code>JVMTI_ERROR_OPAQUE_FRAME</code> in those cases.5724</description>5725<origin>new</origin>5726<capabilities>5727<required id="can_access_local_variables"></required>5728</capabilities>5729<parameters>5730<param id="thread">5731<jthread null="current" frame="frame"/>5732<description>5733The thread of the frame containing the variable's value.5734</description>5735</param>5736<param id="depth">5737<jframeID thread="thread"/>5738<description>5739The depth of the frame containing the variable's value.5740</description>5741</param>5742<param id="value_ptr">5743<outptr><jobject/></outptr>5744<description>5745On return, points to the variable's value.5746</description>5747</param>5748</parameters>5749<errors>5750<error id="JVMTI_ERROR_INVALID_SLOT">5751If the specified frame is a static method frame.5752</error>5753</errors>5754</function>5755<function id="GetLocalInt" num="22">5756<synopsis>Get Local Variable - Int</synopsis>5757<description>5758This function can be used to retrieve the value of a local5759variable whose type is <code>int</code>,5760<code>short</code>, <code>char</code>, <code>byte</code>, or5761<code>boolean</code>.5762</description>5763<origin>jvmdi</origin>5764<capabilities>5765<required id="can_access_local_variables"></required>5766</capabilities>5767<parameters>5768<param id="thread">5769<jthread null="current" frame="frame"/>5770<description>5771The thread of the frame containing the variable's value.5772</description>5773</param>5774<param id="depth">5775<jframeID thread="thread"/>5776<description>5777The depth of the frame containing the variable's value.5778</description>5779</param>5780<param id="slot">5781<jint/>5782<description>5783The variable's slot number.5784</description>5785</param>5786<param id="value_ptr">5787<outptr><jint/></outptr>5788<description>5789On return, points to the variable's value.5790</description>5791</param>5792</parameters>5793<errors>5794<error id="JVMTI_ERROR_INVALID_SLOT">5795Invalid <code>slot</code>.5796</error>5797<error id="JVMTI_ERROR_TYPE_MISMATCH">5798The variable type is not5799<code>int</code>, <code>short</code>,5800<code>char</code>, <code>byte</code>, or5801<code>boolean</code>.5802</error>5803<error id="JVMTI_ERROR_OPAQUE_FRAME">5804Not a visible frame5805</error>5806</errors>5807</function>58085809<function id="GetLocalLong" num="23">5810<synopsis>Get Local Variable - Long</synopsis>5811<description>5812This function can be used to retrieve the value of a local5813variable whose type is <code>long</code>.5814</description>5815<origin>jvmdi</origin>5816<capabilities>5817<required id="can_access_local_variables"></required>5818</capabilities>5819<parameters>5820<param id="thread">5821<jthread null="current" frame="frame"/>5822<description>5823The thread of the frame containing the variable's value.5824</description>5825</param>5826<param id="depth">5827<jframeID thread="thread"/>5828<description>5829The depth of the frame containing the variable's value.5830</description>5831</param>5832<param id="slot">5833<jint/>5834<description>5835The variable's slot number.5836</description>5837</param>5838<param id="value_ptr">5839<outptr><jlong/></outptr>5840<description>5841On return, points to the variable's value.5842</description>5843</param>5844</parameters>5845<errors>5846<error id="JVMTI_ERROR_INVALID_SLOT">5847Invalid <code>slot</code>.5848</error>5849<error id="JVMTI_ERROR_TYPE_MISMATCH">5850The variable type is not <code>long</code>.5851</error>5852<error id="JVMTI_ERROR_OPAQUE_FRAME">5853Not a visible frame5854</error>5855</errors>5856</function>58575858<function id="GetLocalFloat" num="24">5859<synopsis>Get Local Variable - Float</synopsis>5860<description>5861This function can be used to retrieve the value of a local5862variable whose type is <code>float</code>.5863</description>5864<origin>jvmdi</origin>5865<capabilities>5866<required id="can_access_local_variables"></required>5867</capabilities>5868<parameters>5869<param id="thread">5870<jthread null="current" frame="frame"/>5871<description>5872The thread of the frame containing the variable's value.5873</description>5874</param>5875<param id="depth">5876<jframeID thread="thread"/>5877<description>5878The depth of the frame containing the variable's value.5879</description>5880</param>5881<param id="slot">5882<jint/>5883<description>5884The variable's slot number.5885</description>5886</param>5887<param id="value_ptr">5888<outptr><jfloat/></outptr>5889<description>5890On return, points to the variable's value.5891</description>5892</param>5893</parameters>5894<errors>5895<error id="JVMTI_ERROR_INVALID_SLOT">5896Invalid <code>slot</code>.5897</error>5898<error id="JVMTI_ERROR_TYPE_MISMATCH">5899The variable type is not <code>float</code>.5900</error>5901<error id="JVMTI_ERROR_OPAQUE_FRAME">5902Not a visible frame5903</error>5904</errors>5905</function>59065907<function id="GetLocalDouble" num="25">5908<synopsis>Get Local Variable - Double</synopsis>5909<description>5910This function can be used to retrieve the value of a local5911variable whose type is <code>long</code>.5912</description>5913<origin>jvmdi</origin>5914<capabilities>5915<required id="can_access_local_variables"></required>5916</capabilities>5917<parameters>5918<param id="thread">5919<jthread null="current" frame="frame"/>5920<description>5921The thread of the frame containing the variable's value.5922</description>5923</param>5924<param id="depth">5925<jframeID thread="thread"/>5926<description>5927The depth of the frame containing the variable's value.5928</description>5929</param>5930<param id="slot">5931<jint/>5932<description>5933The variable's slot number.5934</description>5935</param>5936<param id="value_ptr">5937<outptr><jdouble/></outptr>5938<description>5939On return, points to the variable's value.5940</description>5941</param>5942</parameters>5943<errors>5944<error id="JVMTI_ERROR_INVALID_SLOT">5945Invalid <code>slot</code>.5946</error>5947<error id="JVMTI_ERROR_TYPE_MISMATCH">5948The variable type is not <code>double</code>.5949</error>5950<error id="JVMTI_ERROR_OPAQUE_FRAME">5951Not a visible frame5952</error>5953</errors>5954</function>59555956<function id="SetLocalObject" num="26">5957<synopsis>Set Local Variable - Object</synopsis>5958<description>5959This function can be used to set the value of a local5960variable whose type is <code>Object</code> or a subclass of <code>Object</code>.5961</description>5962<origin>jvmdi</origin>5963<capabilities>5964<required id="can_access_local_variables"></required>5965</capabilities>5966<parameters>5967<param id="thread">5968<jthread null="current" frame="frame"/>5969<description>5970The thread of the frame containing the variable's value.5971</description>5972</param>5973<param id="depth">5974<jframeID thread="thread"/>5975<description>5976The depth of the frame containing the variable's value.5977</description>5978</param>5979<param id="slot">5980<jint/>5981<description>5982The variable's slot number.5983</description>5984</param>5985<param id="value">5986<jobject/>5987<description>5988The new value for the variable.5989</description>5990</param>5991</parameters>5992<errors>5993<error id="JVMTI_ERROR_INVALID_SLOT">5994Invalid <code>slot</code>.5995</error>5996<error id="JVMTI_ERROR_TYPE_MISMATCH">5997The variable type is not5998<code>Object</code> or a subclass of <code>Object</code>.5999</error>6000<error id="JVMTI_ERROR_TYPE_MISMATCH">6001The supplied <paramlink id="value"/> is not compatible6002with the variable type.6003</error>6004<error id="JVMTI_ERROR_OPAQUE_FRAME">6005Not a visible frame6006</error>6007</errors>6008</function>60096010<function id="SetLocalInt" num="27">6011<synopsis>Set Local Variable - Int</synopsis>6012<description>6013This function can be used to set the value of a local6014variable whose type is <code>int</code>,6015<code>short</code>, <code>char</code>, <code>byte</code>, or6016<code>boolean</code>.6017</description>6018<origin>jvmdi</origin>6019<capabilities>6020<required id="can_access_local_variables"></required>6021</capabilities>6022<parameters>6023<param id="thread">6024<jthread null="current" frame="frame"/>6025<description>6026The thread of the frame containing the variable's value.6027</description>6028</param>6029<param id="depth">6030<jframeID thread="thread"/>6031<description>6032The depth of the frame containing the variable's value.6033</description>6034</param>6035<param id="slot">6036<jint/>6037<description>6038The variable's slot number.6039</description>6040</param>6041<param id="value">6042<jint/>6043<description>6044The new value for the variable.6045</description>6046</param>6047</parameters>6048<errors>6049<error id="JVMTI_ERROR_INVALID_SLOT">6050Invalid <code>slot</code>.6051</error>6052<error id="JVMTI_ERROR_TYPE_MISMATCH">6053The variable type is not6054<code>int</code>, <code>short</code>,6055<code>char</code>, <code>byte</code>, or6056<code>boolean</code>.6057</error>6058<error id="JVMTI_ERROR_OPAQUE_FRAME">6059Not a visible frame6060</error>6061</errors>6062</function>60636064<function id="SetLocalLong" num="28">6065<synopsis>Set Local Variable - Long</synopsis>6066<description>6067This function can be used to set the value of a local6068variable whose type is <code>long</code>.6069</description>6070<origin>jvmdi</origin>6071<capabilities>6072<required id="can_access_local_variables"></required>6073</capabilities>6074<parameters>6075<param id="thread">6076<jthread null="current" frame="frame"/>6077<description>6078The thread of the frame containing the variable's value.6079</description>6080</param>6081<param id="depth">6082<jframeID thread="thread"/>6083<description>6084The depth of the frame containing the variable's value.6085</description>6086</param>6087<param id="slot">6088<jint/>6089<description>6090The variable's slot number.6091</description>6092</param>6093<param id="value">6094<jlong/>6095<description>6096The new value for the variable.6097</description>6098</param>6099</parameters>6100<errors>6101<error id="JVMTI_ERROR_INVALID_SLOT">6102Invalid <code>slot</code>.6103</error>6104<error id="JVMTI_ERROR_TYPE_MISMATCH">6105The variable type is not <code>long</code>.6106</error>6107<error id="JVMTI_ERROR_OPAQUE_FRAME">6108Not a visible frame6109</error>6110</errors>6111</function>61126113<function id="SetLocalFloat" num="29">6114<synopsis>Set Local Variable - Float</synopsis>6115<description>6116This function can be used to set the value of a local6117variable whose type is <code>float</code>.6118</description>6119<origin>jvmdi</origin>6120<capabilities>6121<required id="can_access_local_variables"></required>6122</capabilities>6123<parameters>6124<param id="thread">6125<jthread null="current" frame="frame"/>6126<description>6127The thread of the frame containing the variable's value.6128</description>6129</param>6130<param id="depth">6131<jframeID thread="thread"/>6132<description>6133The depth of the frame containing the variable's value.6134</description>6135</param>6136<param id="slot">6137<jint/>6138<description>6139The variable's slot number.6140</description>6141</param>6142<param id="value">6143<jfloat/>6144<description>6145The new value for the variable.6146</description>6147</param>6148</parameters>6149<errors>6150<error id="JVMTI_ERROR_INVALID_SLOT">6151Invalid <code>slot</code>.6152</error>6153<error id="JVMTI_ERROR_TYPE_MISMATCH">6154The variable type is not <code>float</code>.6155</error>6156<error id="JVMTI_ERROR_OPAQUE_FRAME">6157Not a visible frame6158</error>6159</errors>6160</function>61616162<function id="SetLocalDouble" num="30">6163<synopsis>Set Local Variable - Double</synopsis>6164<description>6165This function can be used to set the value of a local6166variable whose type is <code>double</code>.6167</description>6168<origin>jvmdi</origin>6169<capabilities>6170<required id="can_access_local_variables"></required>6171</capabilities>6172<parameters>6173<param id="thread">6174<jthread null="current" frame="frame"/>6175<description>6176The thread of the frame containing the variable's value.6177</description>6178</param>6179<param id="depth">6180<jframeID thread="thread"/>6181<description>6182The depth of the frame containing the variable's value.6183</description>6184</param>6185<param id="slot">6186<jint/>6187<description>6188The variable's slot number.6189</description>6190</param>6191<param id="value">6192<jdouble/>6193<description>6194The new value for the variable.6195</description>6196</param>6197</parameters>6198<errors>6199<error id="JVMTI_ERROR_INVALID_SLOT">6200Invalid <code>slot</code>.6201</error>6202<error id="JVMTI_ERROR_TYPE_MISMATCH">6203The variable type is not <code>double</code>.6204</error>6205<error id="JVMTI_ERROR_OPAQUE_FRAME">6206Not a visible frame6207</error>6208</errors>6209</function>6210</category>62116212<category id="breakpointCategory" label="Breakpoint">62136214<intro>6215</intro>62166217<function id="SetBreakpoint" num="38">6218<synopsis>Set Breakpoint</synopsis>6219<description>6220Set a breakpoint at the instruction indicated by6221<code>method</code> and <code>location</code>.6222An instruction can only have one breakpoint.6223<p/>6224Whenever the designated instruction is about to be executed, a6225<eventlink id="Breakpoint"></eventlink> event is generated.6226</description>6227<origin>jvmdi</origin>6228<capabilities>6229<required id="can_generate_breakpoint_events"></required>6230</capabilities>6231<parameters>6232<param id="klass">6233<jclass method="method"/>6234<description>6235The class in which to set the breakpoint6236</description>6237</param>6238<param id="method">6239<jmethodID class="klass"/>6240<description>6241The method in which to set the breakpoint6242</description>6243</param>6244<param id="location">6245<jlocation/>6246<description>6247the index of the instruction at which to set the breakpoint62486249</description>6250</param>6251</parameters>6252<errors>6253<error id="JVMTI_ERROR_DUPLICATE">6254The designated bytecode already has a breakpoint.6255</error>6256</errors>6257</function>62586259<function id="ClearBreakpoint" num="39">6260<synopsis>Clear Breakpoint</synopsis>6261<description>6262Clear the breakpoint at the bytecode indicated by6263<code>method</code> and <code>location</code>.6264</description>6265<origin>jvmdi</origin>6266<capabilities>6267<required id="can_generate_breakpoint_events"></required>6268</capabilities>6269<parameters>6270<param id="klass">6271<jclass method="method"/>6272<description>6273The class in which to clear the breakpoint6274</description>6275</param>6276<param id="method">6277<jmethodID class="klass"/>6278<description>6279The method in which to clear the breakpoint6280</description>6281</param>6282<param id="location">6283<jlocation/>6284<description>6285the index of the instruction at which to clear the breakpoint6286</description>6287</param>6288</parameters>6289<errors>6290<error id="JVMTI_ERROR_NOT_FOUND">6291There's no breakpoint at the designated bytecode.6292</error>6293</errors>6294</function>62956296</category>62976298<category id="fieldWatch" label="Watched Field">62996300<intro>6301</intro>63026303<function id="SetFieldAccessWatch" num="41">6304<synopsis>Set Field Access Watch</synopsis>6305<description>6306Generate a <eventlink id="FieldAccess"></eventlink> event6307when the field specified6308by <code>klass</code> and6309<code>field</code> is about to be accessed.6310An event will be generated for each access of the field6311until it is canceled with6312<functionlink id="ClearFieldAccessWatch"></functionlink>.6313Field accesses from Java programming language code or from JNI code are watched,6314fields modified by other means are not watched.6315Note that <jvmti/> users should be aware that their own field accesses6316will trigger the watch.6317A field can only have one field access watch set.6318Modification of a field is not considered an access--use6319<functionlink id="SetFieldModificationWatch"></functionlink>6320to monitor modifications.6321</description>6322<origin>jvmdi</origin>6323<capabilities>6324<required id="can_generate_field_access_events"></required>6325</capabilities>6326<parameters>6327<param id="klass">6328<jclass field="field"/>6329<description>6330The class containing the field to watch6331</description>6332</param>6333<param id="field">6334<jfieldID class="klass"/>6335<description>6336The field to watch63376338</description>6339</param>6340</parameters>6341<errors>6342<error id="JVMTI_ERROR_DUPLICATE">6343The designated field is already being watched for accesses.6344</error>6345</errors>6346</function>63476348<function id="ClearFieldAccessWatch" num="42">6349<synopsis>Clear Field Access Watch</synopsis>6350<description>6351Cancel a field access watch previously set by6352<functionlink id="SetFieldAccessWatch"></functionlink>, on the6353field specified6354by <code>klass</code> and6355<code>field</code>.6356</description>6357<origin>jvmdi</origin>6358<capabilities>6359<required id="can_generate_field_access_events"></required>6360</capabilities>6361<parameters>6362<param id="klass">6363<jclass field="field"/>6364<description>6365The class containing the field to watch6366</description>6367</param>6368<param id="field">6369<jfieldID class="klass"/>6370<description>6371The field to watch63726373</description>6374</param>6375</parameters>6376<errors>6377<error id="JVMTI_ERROR_NOT_FOUND">6378The designated field is not being watched for accesses.6379</error>6380</errors>6381</function>63826383<function id="SetFieldModificationWatch" num="43">6384<synopsis>Set Field Modification Watch</synopsis>6385<description>6386Generate a <eventlink id="FieldModification"></eventlink> event6387when the field specified6388by <code>klass</code> and6389<code>field</code> is about to be modified.6390An event will be generated for each modification of the field6391until it is canceled with6392<functionlink id="ClearFieldModificationWatch"></functionlink>.6393Field modifications from Java programming language code or from JNI code are watched,6394fields modified by other means are not watched.6395Note that <jvmti/> users should be aware that their own field modifications6396will trigger the watch.6397A field can only have one field modification watch set.6398</description>6399<origin>jvmdi</origin>6400<capabilities>6401<required id="can_generate_field_modification_events"></required>6402</capabilities>6403<parameters>6404<param id="klass">6405<jclass field="field"/>6406<description>6407The class containing the field to watch6408</description>6409</param>6410<param id="field">6411<jfieldID class="klass"/>6412<description>6413The field to watch64146415</description>6416</param>6417</parameters>6418<errors>6419<error id="JVMTI_ERROR_DUPLICATE">6420The designated field is already being watched for modifications.6421</error>6422</errors>6423</function>64246425<function id="ClearFieldModificationWatch" num="44">6426<synopsis>Clear Field Modification Watch</synopsis>6427<description>64286429Cancel a field modification watch previously set by6430<functionlink id="SetFieldModificationWatch"></functionlink>, on the6431field specified6432by <code>klass</code> and6433<code>field</code>.6434</description>6435<origin>jvmdi</origin>6436<capabilities>6437<required id="can_generate_field_modification_events"></required>6438</capabilities>6439<parameters>6440<param id="klass">6441<jclass field="field"/>6442<description>6443The class containing the field to watch6444</description>6445</param>6446<param id="field">6447<jfieldID class="klass"/>6448<description>6449The field to watch64506451</description>6452</param>6453</parameters>6454<errors>6455<error id="JVMTI_ERROR_NOT_FOUND">6456The designated field is not being watched for modifications.6457</error>6458</errors>6459</function>6460</category>64616462<category id="class" label="Class">64636464<intro>6465</intro>64666467<function id="GetLoadedClasses" jkernel="yes" num="78">6468<synopsis>Get Loaded Classes</synopsis>6469<description>6470Return an array of all classes loaded in the virtual machine.6471The number of classes in the array is returned via6472<code>class_count_ptr</code>, and the array itself via6473<code>classes_ptr</code>.6474<p/>6475Array classes of all types (including arrays of primitive types) are6476included in the returned list. Primitive classes (for example,6477<code>java.lang.Integer.TYPE</code>) are <i>not</i> included in this list.6478</description>6479<origin>jvmdi</origin>6480<capabilities>6481</capabilities>6482<parameters>6483<param id="class_count_ptr">6484<outptr><jint/></outptr>6485<description>6486On return, points to the number of classes.6487</description>6488</param>6489<param id="classes_ptr">6490<allocbuf outcount="class_count_ptr"><jclass/></allocbuf>6491<description>6492On return, points to an array of references, one6493for each class.6494</description>6495</param>6496</parameters>6497<errors>6498</errors>6499</function>65006501<function id="GetClassLoaderClasses" jkernel="yes" num="79">6502<synopsis>Get Classloader Classes</synopsis>6503<description>6504Returns an array of those classes for which this class loader has6505been recorded as an initiating loader. Each6506class in the returned array was created by this class loader,6507either by defining it directly or by delegation to another class loader.6508See <vmspec chapter="5.3"/>.6509<p/>6510For JDK version 1.1 implementations that don't6511recognize the distinction between initiating and defining class loaders,6512this function should return all classes loaded in the virtual machine.6513The number of classes in the array is returned via6514<code>class_count_ptr</code>, and the array itself via6515<code>classes_ptr</code>.6516</description>6517<origin>jvmdi</origin>6518<capabilities>6519</capabilities>6520<parameters>6521<param id="initiating_loader">6522<ptrtype>6523<jobject/>6524<nullok>the classes initiated by the bootstrap loader will be returned</nullok>6525</ptrtype>6526<description>6527An initiating class loader.6528</description>6529</param>6530<param id="class_count_ptr">6531<outptr><jint/></outptr>6532<description>6533On return, points to the number of classes.6534</description>6535</param>6536<param id="classes_ptr">6537<allocbuf outcount="class_count_ptr"><jclass/></allocbuf>6538<description>6539On return, points to an array of references, one6540for each class.6541</description>6542</param>6543</parameters>6544<errors>6545</errors>6546</function>65476548<function id="GetClassSignature" phase="start" num="48">6549<synopsis>Get Class Signature</synopsis>6550<description>6551For the class indicated by <code>klass</code>, return the6552<externallink id="http://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/types.html#wp16432">JNI6553type signature</externallink>6554and the generic signature of the class.6555For example, <code>java.util.List</code> is <code>"Ljava/util/List;"</code>6556and <code>int[]</code> is <code>"[I"</code>6557The returned name for primitive classes6558is the type signature character of the corresponding primitive type.6559For example, <code>java.lang.Integer.TYPE</code> is <code>"I"</code>.6560</description>6561<origin>jvmdiClone</origin>6562<capabilities>6563</capabilities>6564<parameters>6565<param id="klass">6566<jclass/>6567<description>6568The class to query.6569</description>6570</param>6571<param id="signature_ptr">6572<allocbuf>6573<char/>6574<nullok>the signature is not returned</nullok>6575</allocbuf>6576<description>6577On return, points to the JNI type signature of the class, encoded as a6578<internallink id="mUTF">modified UTF-8</internallink> string.6579</description>6580</param>6581<param id="generic_ptr">6582<allocbuf>6583<char/>6584<nullok>the generic signature is not returned</nullok>6585</allocbuf>6586<description>6587On return, points to the generic signature of the class, encoded as a6588<internallink id="mUTF">modified UTF-8</internallink> string.6589If there is no generic signature attribute for the class, then,6590on return, points to <code>NULL</code>.6591</description>6592</param>6593</parameters>6594<errors>6595</errors>6596</function>65976598<function id="GetClassStatus" phase="start" num="49">6599<synopsis>Get Class Status</synopsis>6600<description>6601Get the status of the class. Zero or more of the following bits can be6602set.6603<constants id="jvmtiClassStatus" label="Class Status Flags" kind="bits">6604<constant id="JVMTI_CLASS_STATUS_VERIFIED" num="1">6605Class bytecodes have been verified6606</constant>6607<constant id="JVMTI_CLASS_STATUS_PREPARED" num="2">6608Class preparation is complete6609</constant>6610<constant id="JVMTI_CLASS_STATUS_INITIALIZED" num="4">6611Class initialization is complete. Static initializer has been run.6612</constant>6613<constant id="JVMTI_CLASS_STATUS_ERROR" num="8">6614Error during initialization makes class unusable6615</constant>6616<constant id="JVMTI_CLASS_STATUS_ARRAY" num="16">6617Class is an array. If set, all other bits are zero.6618</constant>6619<constant id="JVMTI_CLASS_STATUS_PRIMITIVE" num="32">6620Class is a primitive class (for example, <code>java.lang.Integer.TYPE</code>).6621If set, all other bits are zero.6622</constant>6623</constants>6624</description>6625<origin>jvmdi</origin>6626<capabilities>6627</capabilities>6628<parameters>6629<param id="klass">6630<jclass/>6631<description>6632The class to query.6633</description>6634</param>6635<param id="status_ptr">6636<outptr><jint/></outptr>6637<description>6638On return, points to the current state of this class as one or6639more of the <internallink id="jvmtiClassStatus">class status flags</internallink>.6640</description>6641</param>6642</parameters>6643<errors>6644</errors>6645</function>66466647<function id="GetSourceFileName" phase="start" num="50">6648<synopsis>Get Source File Name</synopsis>6649<description>6650For the class indicated by <code>klass</code>, return the source file6651name via <code>source_name_ptr</code>. The returned string6652is a file name only and never contains a directory name.6653<p/>6654For primitive classes (for example, <code>java.lang.Integer.TYPE</code>)6655and for arrays this function returns6656<errorlink id="JVMTI_ERROR_ABSENT_INFORMATION"></errorlink>.6657</description>6658<origin>jvmdi</origin>6659<capabilities>6660<required id="can_get_source_file_name"></required>6661</capabilities>6662<parameters>6663<param id="klass">6664<jclass/>6665<description>6666The class to query.6667</description>6668</param>6669<param id="source_name_ptr">6670<allocbuf><char/></allocbuf>6671<description>6672On return, points to the class's source file name, encoded as a6673<internallink id="mUTF">modified UTF-8</internallink> string.6674</description>6675</param>6676</parameters>6677<errors>6678<error id="JVMTI_ERROR_ABSENT_INFORMATION">6679Class information does not include a source file name. This includes6680cases where the class is an array class or primitive class.6681</error>6682</errors>6683</function>66846685<function id="GetClassModifiers" phase="start" num="51">6686<synopsis>Get Class Modifiers</synopsis>6687<description>6688For the class indicated by <code>klass</code>, return the access6689flags6690via <code>modifiers_ptr</code>.6691Access flags are defined in <vmspec chapter="4"/>.6692<p/>6693If the class is an array class, then its public, private, and protected6694modifiers are the same as those of its component type. For arrays of6695primitives, this component type is represented by one of the primitive6696classes (for example, <code>java.lang.Integer.TYPE</code>).6697<p/>6698If the class is a primitive class, its public modifier is always true,6699and its protected and private modifiers are always false.6700<p/>6701If the class is an array class or a primitive class then its final6702modifier is always true and its interface modifier is always false.6703The values of its other modifiers are not determined by this specification.67046705</description>6706<origin>jvmdi</origin>6707<capabilities>6708</capabilities>6709<parameters>6710<param id="klass">6711<jclass/>6712<description>6713The class to query.6714</description>6715</param>6716<param id="modifiers_ptr">6717<outptr><jint/></outptr>6718<description>6719On return, points to the current access flags of this class.67206721</description>6722</param>6723</parameters>6724<errors>6725</errors>6726</function>67276728<function id="GetClassMethods" phase="start" num="52">6729<synopsis>Get Class Methods</synopsis>6730<description>6731For the class indicated by <code>klass</code>, return a count of6732methods via <code>method_count_ptr</code> and a list of6733method IDs via <code>methods_ptr</code>. The method list contains6734constructors and static initializers as well as true methods.6735Only directly declared methods are returned (not inherited methods).6736An empty method list is returned for array classes and primitive classes6737(for example, <code>java.lang.Integer.TYPE</code>).6738</description>6739<origin>jvmdi</origin>6740<capabilities>6741<capability id="can_maintain_original_method_order"/>6742</capabilities>6743<parameters>6744<param id="klass">6745<jclass/>6746<description>6747The class to query.6748</description>6749</param>6750<param id="method_count_ptr">6751<outptr><jint/></outptr>6752<description>6753On return, points to the number of methods declared in this class.6754</description>6755</param>6756<param id="methods_ptr">6757<allocbuf outcount="method_count_ptr"><jmethodID class="klass"/></allocbuf>6758<description>6759On return, points to the method ID array.6760</description>6761</param>6762</parameters>6763<errors>6764<error id="JVMTI_ERROR_CLASS_NOT_PREPARED">6765<paramlink id="klass"></paramlink> is not prepared.6766</error>6767</errors>6768</function>67696770<function id="GetClassFields" phase="start" num="53">6771<synopsis>Get Class Fields</synopsis>6772<description>6773For the class indicated by <code>klass</code>, return a count of fields6774via <code>field_count_ptr</code> and a list of field IDs via6775<code>fields_ptr</code>.6776Only directly declared fields are returned (not inherited fields).6777Fields are returned in the order they occur in the class file.6778An empty field list is returned for array classes and primitive classes6779(for example, <code>java.lang.Integer.TYPE</code>).6780Use JNI to determine the length of an array.6781</description>6782<origin>jvmdi</origin>6783<capabilities>6784</capabilities>6785<parameters>6786<param id="klass">6787<jclass/>6788<description>6789The class to query.6790</description>6791</param>6792<param id="field_count_ptr">6793<outptr><jint/></outptr>6794<description>6795On return, points to the number of fields declared in this class.6796</description>6797</param>6798<param id="fields_ptr">6799<allocbuf outcount="field_count_ptr"><jfieldID/></allocbuf>6800<description>6801On return, points to the field ID array.6802</description>6803</param>6804</parameters>6805<errors>6806<error id="JVMTI_ERROR_CLASS_NOT_PREPARED">6807<paramlink id="klass"></paramlink> is not prepared.6808</error>6809</errors>6810</function>68116812<function id="GetImplementedInterfaces" phase="start" num="54">6813<synopsis>Get Implemented Interfaces</synopsis>6814<description>6815Return the direct super-interfaces of this class. For a class, this6816function returns the interfaces declared in its <code>implements</code>6817clause. For an interface, this function returns the interfaces declared in6818its <code>extends</code> clause.6819An empty interface list is returned for array classes and primitive classes6820(for example, <code>java.lang.Integer.TYPE</code>).6821</description>6822<origin>jvmdi</origin>6823<capabilities>6824</capabilities>6825<parameters>6826<param id="klass">6827<jclass/>6828<description>6829The class to query.6830</description>6831</param>6832<param id="interface_count_ptr">6833<outptr><jint/></outptr>6834<description>6835On return, points to the number of interfaces.6836</description>6837</param>6838<param id="interfaces_ptr">6839<allocbuf outcount="interface_count_ptr"><jclass/></allocbuf>6840<description>6841On return, points to the interface array.6842</description>6843</param>6844</parameters>6845<errors>6846<error id="JVMTI_ERROR_CLASS_NOT_PREPARED">6847<paramlink id="klass"></paramlink> is not prepared.6848</error>6849</errors>6850</function>68516852<function id="GetClassVersionNumbers" phase="start" num="145" since="1.1">6853<synopsis>Get Class Version Numbers</synopsis>6854<description>6855For the class indicated by <code>klass</code>,6856return the minor and major version numbers,6857as defined in6858<vmspec chapter="4"/>.6859</description>6860<origin>new</origin>6861<capabilities>6862</capabilities>6863<parameters>6864<param id="klass">6865<jclass/>6866<description>6867The class to query.6868</description>6869</param>6870<param id="minor_version_ptr">6871<outptr><jint/></outptr>6872<description>6873On return, points to the value of the6874<code>minor_version</code> item of the6875Class File Format.6876Note: to be consistent with the Class File Format,6877the minor version number is the first parameter.6878</description>6879</param>6880<param id="major_version_ptr">6881<outptr><jint/></outptr>6882<description>6883On return, points to the value of the6884<code>major_version</code> item of the6885Class File Format.6886</description>6887</param>6888</parameters>6889<errors>6890<error id="JVMTI_ERROR_ABSENT_INFORMATION">6891The class is a primitive or array class.6892</error>6893</errors>6894</function>68956896<function id="GetConstantPool" phase="start" num="146" since="1.1">6897<synopsis>Get Constant Pool</synopsis>6898<description>6899For the class indicated by <code>klass</code>,6900return the raw bytes of the constant pool in the format of the6901<code>constant_pool</code> item of6902<vmspec chapter="4"/>.6903The format of the constant pool may differ between versions6904of the Class File Format, so, the6905<functionlink id="GetClassVersionNumbers">minor and major6906class version numbers</functionlink> should be checked for6907compatibility.6908<p/>6909The returned constant pool might not have the same layout or6910contents as the constant pool in the defining class file.6911The constant pool returned by GetConstantPool() may have6912more or fewer entries than the defining constant pool.6913Entries may be in a different order.6914The constant pool returned by GetConstantPool() will match the6915constant pool used by6916<functionlink id="GetBytecodes">GetBytecodes()</functionlink>.6917That is, the bytecodes returned by GetBytecodes() will have6918constant pool indices which refer to constant pool entries returned6919by GetConstantPool().6920Note that since <functionlink id="RetransformClasses"/>6921and <functionlink id="RedefineClasses"/> can change6922the constant pool, the constant pool returned by this function6923can change accordingly. Thus, the correspondence between6924GetConstantPool() and GetBytecodes() does not hold if there6925is an intervening class retransformation or redefinition.6926The value of a constant pool entry used by a given bytecode will6927match that of the defining class file (even if the indices don't match).6928Constant pool entries which are not used directly or indirectly by6929bytecodes (for example, UTF-8 strings associated with annotations) are6930not required to exist in the returned constant pool.6931</description>6932<origin>new</origin>6933<capabilities>6934<required id="can_get_constant_pool"></required>6935</capabilities>6936<parameters>6937<param id="klass">6938<jclass/>6939<description>6940The class to query.6941</description>6942</param>6943<param id="constant_pool_count_ptr">6944<outptr><jint/></outptr>6945<description>6946On return, points to the number of entries6947in the constant pool table plus one.6948This corresponds to the <code>constant_pool_count</code>6949item of the Class File Format.6950</description>6951</param>6952<param id="constant_pool_byte_count_ptr">6953<outptr><jint/></outptr>6954<description>6955On return, points to the number of bytes6956in the returned raw constant pool.6957</description>6958</param>6959<param id="constant_pool_bytes_ptr">6960<allocbuf outcount="constant_pool_byte_count_ptr"><uchar/></allocbuf>6961<description>6962On return, points to the raw constant pool, that is the bytes6963defined by the <code>constant_pool</code> item of the6964Class File Format6965</description>6966</param>6967</parameters>6968<errors>6969<error id="JVMTI_ERROR_ABSENT_INFORMATION">6970The class is a primitive or array class.6971</error>6972</errors>6973</function>69746975<function id="IsInterface" phase="start" num="55">6976<synopsis>Is Interface</synopsis>6977<description>6978Determines whether a class object reference represents an interface.6979The <code>jboolean</code> result is6980<code>JNI_TRUE</code> if the "class" is actually an interface,6981<code>JNI_FALSE</code> otherwise.6982</description>6983<origin>jvmdi</origin>6984<capabilities>6985</capabilities>6986<parameters>6987<param id="klass">6988<jclass/>6989<description>6990The class to query.6991</description>6992</param>6993<param id="is_interface_ptr">6994<outptr><jboolean/></outptr>6995<description>6996On return, points to the boolean result of this function.69976998</description>6999</param>7000</parameters>7001<errors>7002</errors>7003</function>70047005<function id="IsArrayClass" phase="start" num="56">7006<synopsis>Is Array Class</synopsis>7007<description>7008Determines whether a class object reference represents an array.7009The <code>jboolean</code> result is7010<code>JNI_TRUE</code> if the class is an array,7011<code>JNI_FALSE</code> otherwise.7012</description>7013<origin>jvmdi</origin>7014<capabilities>7015</capabilities>7016<parameters>7017<param id="klass">7018<jclass/>7019<description>7020The class to query.7021</description>7022</param>7023<param id="is_array_class_ptr">7024<outptr><jboolean/></outptr>7025<description>7026On return, points to the boolean result of this function.70277028</description>7029</param>7030</parameters>7031<errors>7032</errors>7033</function>70347035<function id="IsModifiableClass" jkernel="yes" phase="start" num="45" since="1.1">7036<synopsis>Is Modifiable Class</synopsis>7037<description>7038Determines whether a class is modifiable.7039If a class is modifiable (<paramlink id="is_modifiable_class_ptr"/>7040returns <code>JNI_TRUE</code>) the class can be7041redefined with <functionlink id="RedefineClasses"/> (assuming7042the agent possesses the7043<fieldlink id="can_redefine_classes" struct="jvmtiCapabilities"/>7044capability) or7045retransformed with <functionlink id="RetransformClasses"/> (assuming7046the agent possesses the7047<fieldlink id="can_retransform_classes" struct="jvmtiCapabilities"/>7048capability).7049If a class is not modifiable (<paramlink id="is_modifiable_class_ptr"/>7050returns <code>JNI_FALSE</code>) the class can be neither7051redefined nor retransformed.7052<p/>7053Primitive classes (for example, <code>java.lang.Integer.TYPE</code>)7054and array classes are never modifiable.7055<p/>7056</description>7057<origin>new</origin>7058<capabilities>7059<capability id="can_redefine_any_class">7060If possessed then all classes (except primitive and array classes)7061are modifiable.7062</capability>7063<capability id="can_redefine_classes">7064No effect on the result of the function.7065But must additionally be possessed to modify the class with7066<functionlink id="RedefineClasses"/>.7067</capability>7068<capability id="can_retransform_classes">7069No effect on the result of the function.7070But must additionally be possessed to modify the class with7071<functionlink id="RetransformClasses"/>.7072</capability>7073</capabilities>7074<parameters>7075<param id="klass">7076<jclass/>7077<description>7078The class to query.7079</description>7080</param>7081<param id="is_modifiable_class_ptr">7082<outptr><jboolean/></outptr>7083<description>7084On return, points to the boolean result of this function.7085</description>7086</param>7087</parameters>7088<errors>7089</errors>7090</function>70917092<function id="GetClassLoader" phase="start" num="57">7093<synopsis>Get Class Loader</synopsis>7094<description>7095For the class indicated by <code>klass</code>, return via7096<code>classloader_ptr</code> a reference to the class loader for the7097class.7098</description>7099<origin>jvmdi</origin>7100<capabilities>7101</capabilities>7102<parameters>7103<param id="klass">7104<jclass/>7105<description>7106The class to query.7107</description>7108</param>7109<param id="classloader_ptr">7110<outptr><jobject/></outptr>7111<description>7112On return, points to the class loader that loaded7113this class.7114If the class was not created by a class loader7115or if the class loader is the bootstrap class loader,7116points to <code>NULL</code>.7117</description>7118</param>7119</parameters>7120<errors>7121</errors>71227123</function>71247125<function id="GetSourceDebugExtension" phase="start" num="90">7126<synopsis>Get Source Debug Extension</synopsis>7127<description>7128For the class indicated by <code>klass</code>, return the debug7129extension via <code>source_debug_extension_ptr</code>.7130The returned string7131contains exactly the debug extension information present in the7132class file of <code>klass</code>.7133</description>7134<origin>jvmdi</origin>7135<capabilities>7136<required id="can_get_source_debug_extension"></required>7137</capabilities>7138<parameters>7139<param id="klass">7140<jclass/>7141<description>7142The class to query.7143</description>7144</param>7145<param id="source_debug_extension_ptr">7146<allocbuf><char/></allocbuf>7147<description>7148On return, points to the class's debug extension, encoded as a7149<internallink id="mUTF">modified UTF-8</internallink> string.7150</description>7151</param>7152</parameters>7153<errors>7154<error id="JVMTI_ERROR_ABSENT_INFORMATION">7155Class information does not include a debug extension.7156</error>7157</errors>7158</function>71597160<function id="RetransformClasses" jkernel="yes" num="152" since="1.1">7161<synopsis>Retransform Classes</synopsis>7162<description>7163This function facilitates the7164<internallink id="bci">bytecode instrumentation</internallink>7165of already loaded classes.7166To replace the class definition without reference to the existing7167bytecodes, as one might do when recompiling from source for7168fix-and-continue debugging, <functionlink id="RedefineClasses"/>7169function should be used instead.7170<p/>7171When classes are initially loaded or when they are7172<functionlink id="RedefineClasses">redefined</functionlink>,7173the initial class file bytes can be transformed with the7174<eventlink id="ClassFileLoadHook"/> event.7175This function reruns the transformation process7176(whether or not a transformation has previously occurred).7177This retransformation follows these steps:7178<ul>7179<li>starting from the initial class file bytes7180</li>7181<li>for each <fieldlink id="can_retransform_classes"7182struct="jvmtiCapabilities">retransformation7183incapable</fieldlink>7184agent which received a7185<code>ClassFileLoadHook</code> event during the previous7186load or redefine, the bytes it returned7187(via the <code>new_class_data</code> parameter)7188are reused as the output of the transformation;7189note that this is equivalent to reapplying7190the previous transformation, unaltered. except that7191the <code>ClassFileLoadHook</code> event7192is <b>not</b> sent to these agents7193</li>7194<li>for each <fieldlink id="can_retransform_classes"7195struct="jvmtiCapabilities">retransformation7196capable</fieldlink>7197agent, the <code>ClassFileLoadHook</code> event is sent,7198allowing a new transformation to be applied7199</li>7200<li>the transformed class file bytes are installed as the new7201definition of the class7202</li>7203</ul>7204See the <eventlink id="ClassFileLoadHook"/> event for more details.7205<p/>7206The initial class file bytes represent the bytes passed to7207<code>ClassLoader.defineClass</code>7208or <code>RedefineClasses</code> (before any transformations7209were applied), however they may not exactly match them.7210The constant pool may differ in ways described in7211<functionlink id="GetConstantPool"/>.7212Constant pool indices in the bytecodes of methods will correspond.7213Some attributes may not be present.7214Where order is not meaningful, for example the order of methods,7215order may not be preserved.7216<p/>7217Retransformation can cause new versions of methods to be installed.7218Old method versions may become7219<internallink id="obsoleteMethods">obsolete</internallink>7220The new method version will be used on new invokes.7221If a method has active stack frames, those active frames continue to7222run the bytecodes of the original method version.7223<p/>7224This function does not cause any initialization except that which7225would occur under the customary JVM semantics.7226In other words, retransforming a class does not cause its initializers to be7227run. The values of static fields will remain as they were7228prior to the call.7229<p/>7230Threads need not be suspended.7231<p/>7232All breakpoints in the class are cleared.7233<p/>7234All attributes are updated.7235<p/>7236Instances of the retransformed class are not affected -- fields retain their7237previous values.7238<functionlink id="GetTag">Tags</functionlink> on the instances are7239also unaffected.7240<p/>7241In response to this call, no events other than the7242<eventlink id="ClassFileLoadHook"/> event7243will be sent.7244<p/>7245The retransformation may change method bodies, the constant pool and attributes.7246The retransformation must not add, remove or rename fields or methods, change the7247signatures of methods, change modifiers, or change inheritance.7248These restrictions may be lifted in future versions.7249See the error return description below for information on error codes7250returned if an unsupported retransformation is attempted.7251The class file bytes are not verified or installed until they have passed7252through the chain of <eventlink id="ClassFileLoadHook"/> events, thus the7253returned error code reflects the result of the transformations.7254If any error code is returned other than <code>JVMTI_ERROR_NONE</code>,7255none of the classes to be retransformed will have a new definition installed.7256When this function returns (with the error code of <code>JVMTI_ERROR_NONE</code>)7257all of the classes to be retransformed will have their new definitions installed.7258</description>7259<origin>new</origin>7260<capabilities>7261<required id="can_retransform_classes"></required>7262<capability id="can_retransform_any_class"></capability>7263</capabilities>7264<parameters>7265<param id="class_count">7266<jint min="0"/>7267<description>7268The number of classes to be retransformed.7269</description>7270</param>7271<param id="classes">7272<inbuf incount="class_count"><jclass/></inbuf>7273<description>7274The array of classes to be retransformed.7275</description>7276</param>7277</parameters>7278<errors>7279<error id="JVMTI_ERROR_UNMODIFIABLE_CLASS">7280One of the <paramlink id="classes"/> cannot be modified.7281See <functionlink id="IsModifiableClass"/>.7282</error>7283<error id="JVMTI_ERROR_INVALID_CLASS">7284One of the <paramlink id="classes"/> is not a valid class.7285</error>7286<error id="JVMTI_ERROR_UNSUPPORTED_VERSION">7287A retransformed class file has a version number not supported by this VM.7288</error>7289<error id="JVMTI_ERROR_INVALID_CLASS_FORMAT">7290A retransformed class file is malformed (The VM would return a <code>ClassFormatError</code>).7291</error>7292<error id="JVMTI_ERROR_CIRCULAR_CLASS_DEFINITION">7293The retransformed class file definitions would lead to a circular definition7294(the VM would return a <code>ClassCircularityError</code>).7295</error>7296<error id="JVMTI_ERROR_FAILS_VERIFICATION">7297The retransformed class file bytes fail verification.7298</error>7299<error id="JVMTI_ERROR_NAMES_DONT_MATCH">7300The class name defined in a retransformed class file is7301different from the name in the old class object.7302</error>7303<error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_ADDED">7304A retransformed class file would require adding a method.7305</error>7306<error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED">7307A retransformed class file changes a field.7308</error>7309<error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED">7310A direct superclass is different for a retransformed class file,7311or the set of directly implemented7312interfaces is different.7313</error>7314<error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_DELETED">7315A retransformed class file does not declare a method7316declared in the old class version.7317</error>7318<error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED">7319A retransformed class file has different class modifiers.7320</error>7321<error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED">7322A method in the retransformed class file has different modifiers7323than its counterpart in the old class version.7324</error>7325</errors>7326</function>73277328<function id="RedefineClasses" jkernel="yes" num="87">7329<synopsis>Redefine Classes</synopsis>7330<typedef id="jvmtiClassDefinition" label="Class redefinition description">7331<field id="klass">7332<jclass/>7333<description>7334Class object for this class7335</description>7336</field>7337<field id="class_byte_count">7338<jint/>7339<description>7340Number of bytes defining class (below)7341</description>7342</field>7343<field id="class_bytes">7344<inbuf incount="class_byte_count"><uchar/></inbuf>7345<description>7346Bytes defining class (in <vmspec chapter="4"/>)7347</description>7348</field>7349</typedef>7350<description>7351All classes given are redefined according to the definitions7352supplied.7353This function is used to replace the definition of a class7354with a new definition, as might be needed in fix-and-continue7355debugging.7356Where the existing class file bytes are to be transformed, for7357example in7358<internallink id="bci">bytecode instrumentation</internallink>,7359<functionlink id="RetransformClasses"/> should be used.7360<p/>7361Redefinition can cause new versions of methods to be installed.7362Old method versions may become7363<internallink id="obsoleteMethods">obsolete</internallink>7364The new method version will be used on new invokes.7365If a method has active stack frames, those active frames continue to7366run the bytecodes of the original method version.7367If resetting of stack frames is desired, use7368<functionlink id="PopFrame"></functionlink>7369to pop frames with obsolete method versions.7370<p/>7371This function does not cause any initialization except that which7372would occur under the customary JVM semantics.7373In other words, redefining a class does not cause its initializers to be7374run. The values of static fields will remain as they were7375prior to the call.7376<p/>7377Threads need not be suspended.7378<p/>7379All breakpoints in the class are cleared.7380<p/>7381All attributes are updated.7382<p/>7383Instances of the redefined class are not affected -- fields retain their7384previous values.7385<functionlink id="GetTag">Tags</functionlink> on the instances are7386also unaffected.7387<p/>7388In response to this call, the <jvmti/> event7389<eventlink id="ClassFileLoadHook">Class File Load Hook</eventlink>7390will be sent (if enabled), but no other <jvmti/> events will be sent.7391<p/>7392The redefinition may change method bodies, the constant pool and attributes.7393The redefinition must not add, remove or rename fields or methods, change the7394signatures of methods, change modifiers, or change inheritance.7395These restrictions may be lifted in future versions.7396See the error return description below for information on error codes7397returned if an unsupported redefinition is attempted.7398The class file bytes are not verified or installed until they have passed7399through the chain of <eventlink id="ClassFileLoadHook"/> events, thus the7400returned error code reflects the result of the transformations applied7401to the bytes passed into <paramlink id="class_definitions"/>.7402If any error code is returned other than <code>JVMTI_ERROR_NONE</code>,7403none of the classes to be redefined will have a new definition installed.7404When this function returns (with the error code of <code>JVMTI_ERROR_NONE</code>)7405all of the classes to be redefined will have their new definitions installed.7406</description>7407<origin>jvmdi</origin>7408<capabilities>7409<required id="can_redefine_classes"></required>7410<capability id="can_redefine_any_class"></capability>7411</capabilities>7412<parameters>7413<param id="class_count">7414<jint min="0"/>7415<description>7416The number of classes specified in <code>class_definitions</code>7417</description>7418</param>7419<param id="class_definitions">7420<inbuf incount="class_count"><struct>jvmtiClassDefinition</struct></inbuf>7421<description>7422The array of new class definitions7423</description>7424</param>7425</parameters>7426<errors>7427<error id="JVMTI_ERROR_NULL_POINTER">7428One of <code>class_bytes</code> is <code>NULL</code>.7429</error>7430<error id="JVMTI_ERROR_UNMODIFIABLE_CLASS">7431An element of <code>class_definitions</code> cannot be modified.7432See <functionlink id="IsModifiableClass"/>.7433</error>7434<error id="JVMTI_ERROR_INVALID_CLASS">7435An element of <code>class_definitions</code> is not a valid class.7436</error>7437<error id="JVMTI_ERROR_UNSUPPORTED_VERSION">7438A new class file has a version number not supported by this VM.7439</error>7440<error id="JVMTI_ERROR_INVALID_CLASS_FORMAT">7441A new class file is malformed (The VM would return a <code>ClassFormatError</code>).7442</error>7443<error id="JVMTI_ERROR_CIRCULAR_CLASS_DEFINITION">7444The new class file definitions would lead to a circular definition7445(the VM would return a <code>ClassCircularityError</code>).7446</error>7447<error id="JVMTI_ERROR_FAILS_VERIFICATION">7448The class bytes fail verification.7449</error>7450<error id="JVMTI_ERROR_NAMES_DONT_MATCH">7451The class name defined in a new class file is7452different from the name in the old class object.7453</error>7454<error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_ADDED">7455A new class file would require adding a method.7456</error>7457<error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED">7458A new class version changes a field.7459</error>7460<error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED">7461A direct superclass is different for a new class7462version, or the set of directly implemented7463interfaces is different.7464</error>7465<error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_DELETED">7466A new class version does not declare a method7467declared in the old class version.7468</error>7469<error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED">7470A new class version has different modifiers.7471</error>7472<error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED">7473A method in the new class version has different modifiers7474than its counterpart in the old class version.7475</error>7476</errors>7477</function>74787479</category>74807481<category id="object" label="Object">74827483<function id="GetObjectSize" jkernel="yes" phase="start" num="154">7484<synopsis>Get Object Size</synopsis>7485<description>7486For the object indicated by <code>object</code>,7487return via <code>size_ptr</code> the size of the object.7488This size is an implementation-specific approximation of7489the amount of storage consumed by this object.7490It may include some or all of the object's overhead, and thus7491is useful for comparison within an implementation but not7492between implementations.7493The estimate may change during a single invocation of the JVM.7494</description>7495<origin>new</origin>7496<capabilities>7497</capabilities>7498<parameters>7499<param id="object">7500<jobject/>7501<description>7502The object to query.7503</description>7504</param>7505<param id="size_ptr">7506<outptr><jlong/></outptr>7507<description>7508On return, points to the object's size in bytes.7509</description>7510</param>7511</parameters>7512<errors>7513</errors>7514</function>75157516<function id="GetObjectHashCode" phase="start" num="58">7517<synopsis>Get Object Hash Code</synopsis>7518<description>7519For the object indicated by <code>object</code>,7520return via <code>hash_code_ptr</code> a hash code.7521This hash code could be used to maintain a hash table of object references,7522however, on some implementations this can cause significant performance7523impacts--in most cases7524<internallink id="Heap">tags</internallink>7525will be a more efficient means of associating information with objects.7526This function guarantees7527the same hash code value for a particular object throughout its life7528</description>7529<origin>jvmdi</origin>7530<capabilities>7531</capabilities>7532<parameters>7533<param id="object">7534<jobject/>7535<description>7536The object to query.7537</description>7538</param>7539<param id="hash_code_ptr">7540<outptr><jint/></outptr>7541<description>7542On return, points to the object's hash code.7543</description>7544</param>7545</parameters>7546<errors>7547</errors>7548</function>75497550<function id="GetObjectMonitorUsage" num="59">7551<synopsis>Get Object Monitor Usage</synopsis>7552<typedef id="jvmtiMonitorUsage" label="Object monitor usage information">7553<field id="owner">7554<jthread/>7555<description>7556The thread owning this monitor, or <code>NULL</code> if unused7557</description>7558</field>7559<field id="entry_count">7560<jint/>7561<description>7562The number of times the owning thread has entered the monitor7563</description>7564</field>7565<field id="waiter_count">7566<jint/>7567<description>7568The number of threads waiting to own this monitor7569</description>7570</field>7571<field id="waiters">7572<allocfieldbuf><jthread/></allocfieldbuf>7573<description>7574The <code>waiter_count</code> waiting threads7575</description>7576</field>7577<field id="notify_waiter_count">7578<jint/>7579<description>7580The number of threads waiting to be notified by this monitor7581</description>7582</field>7583<field id="notify_waiters">7584<allocfieldbuf><jthread/></allocfieldbuf>7585<description>7586The <code>notify_waiter_count</code> threads waiting to be notified7587</description>7588</field>7589</typedef>7590<description>7591Get information about the object's monitor.7592The fields of the <functionlink id="jvmtiMonitorUsage"></functionlink> structure7593are filled in with information about usage of the monitor.7594<todo>7595Decide and then clarify suspend requirements.7596</todo>7597</description>7598<origin>jvmdi</origin>7599<capabilities>7600<required id="can_get_monitor_info"></required>7601</capabilities>7602<parameters>7603<param id="object">7604<jobject/>7605<description>7606The object to query.7607</description>7608</param>7609<param id="info_ptr">7610<outptr><struct>jvmtiMonitorUsage</struct></outptr>7611<description>7612On return, filled with monitor information for the7613specified object.7614</description>7615</param>7616</parameters>7617<errors>7618</errors>7619</function>76207621<elide>7622<function id="GetObjectMonitors" num="116">7623<synopsis>Get Object Monitors</synopsis>7624<description>7625Return the list of object monitors.7626<p/>7627Note: details about each monitor can be examined with7628<functionlink id="GetObjectMonitorUsage"></functionlink>.7629</description>7630<origin>new</origin>7631<capabilities>7632<required id="can_get_monitor_info"></required>7633</capabilities>7634<parameters>7635<param id="monitorCnt">7636<outptr><jint/></outptr>7637<description>7638On return, pointer to the number7639of monitors returned in <code>monitors_ptr</code>.7640</description>7641</param>7642<param id="monitors_ptr">7643<allocbuf outcount="monitorCnt"><jobject/></allocbuf>7644<description>7645On return, pointer to the monitor list.7646</description>7647</param>7648</parameters>7649<errors>7650</errors>7651</function>7652</elide>76537654</category>76557656<category id="fieldCategory" label="Field">76577658<intro>7659</intro>76607661<function id="GetFieldName" phase="start" num="60">7662<synopsis>Get Field Name (and Signature)</synopsis>7663<description>7664For the field indicated by <paramlink id="klass"/> and <paramlink id="field"/>,7665return the field name via <paramlink id="name_ptr"/> and field signature via7666<paramlink id="signature_ptr"/>.7667<p/>7668Field signatures are defined in the JNI Specification and7669are referred to as <code>field descriptors</code> in7670<vmspec chapter="4.3.2"/>.7671</description>7672<origin>jvmdiClone</origin>7673<capabilities>7674</capabilities>7675<parameters>7676<param id="klass">7677<jclass field="field"/>7678<description>7679The class of the field to query.7680</description>7681</param>7682<param id="field">7683<jfieldID class="klass"/>7684<description>7685The field to query.7686</description>7687</param>7688<param id="name_ptr">7689<allocbuf>7690<char/>7691<nullok>the name is not returned</nullok>7692</allocbuf>7693<description>7694On return, points to the field name, encoded as a7695<internallink id="mUTF">modified UTF-8</internallink> string.7696</description>7697</param>7698<param id="signature_ptr">7699<allocbuf>7700<char/>7701<nullok>the signature is not returned</nullok>7702</allocbuf>7703<description>7704On return, points to the field signature, encoded as a7705<internallink id="mUTF">modified UTF-8</internallink> string.7706</description>7707</param>7708<param id="generic_ptr">7709<allocbuf>7710<char/>7711<nullok>the generic signature is not returned</nullok>7712</allocbuf>7713<description>7714On return, points to the generic signature of the field, encoded as a7715<internallink id="mUTF">modified UTF-8</internallink> string.7716If there is no generic signature attribute for the field, then,7717on return, points to <code>NULL</code>.7718</description>7719</param>7720</parameters>7721<errors>7722</errors>7723</function>77247725<function id="GetFieldDeclaringClass" phase="start" num="61">7726<synopsis>Get Field Declaring Class</synopsis>7727<description>7728For the field indicated by <code>klass</code> and <code>field</code>7729return the class that defined it via <code>declaring_class_ptr</code>.7730The declaring class will either be <code>klass</code>, a superclass, or7731an implemented interface.7732</description>7733<origin>jvmdi</origin>7734<capabilities>7735</capabilities>7736<parameters>7737<param id="klass">7738<jclass field="field"/>7739<description>7740The class to query.7741</description>7742</param>7743<param id="field">7744<jfieldID class="klass"/>7745<description>7746The field to query.7747</description>7748</param>7749<param id="declaring_class_ptr">7750<outptr><jclass/></outptr>7751<description>7752On return, points to the declaring class7753</description>7754</param>7755</parameters>7756<errors>7757</errors>7758</function>77597760<function id="GetFieldModifiers" phase="start" num="62">7761<synopsis>Get Field Modifiers</synopsis>7762<description>7763For the field indicated by <code>klass</code> and <code>field</code>7764return the access flags via <code>modifiers_ptr</code>.7765Access flags are defined in <vmspec chapter="4"/>.7766</description>7767<origin>jvmdi</origin>7768<capabilities>7769</capabilities>7770<parameters>7771<param id="klass">7772<jclass field="field"/>7773<description>7774The class to query.7775</description>7776</param>7777<param id="field">7778<jfieldID class="klass"/>7779<description>7780The field to query.7781</description>7782</param>7783<param id="modifiers_ptr">7784<outptr><jint/></outptr>7785<description>7786On return, points to the access flags.7787</description>7788</param>7789</parameters>7790<errors>7791</errors>7792</function>77937794<function id="IsFieldSynthetic" phase="start" num="63">7795<synopsis>Is Field Synthetic</synopsis>7796<description>7797For the field indicated by <code>klass</code> and <code>field</code>, return a7798value indicating whether the field is synthetic via <code>is_synthetic_ptr</code>.7799Synthetic fields are generated by the compiler but not present in the7800original source code.7801</description>7802<origin>jvmdi</origin>7803<capabilities>7804<required id="can_get_synthetic_attribute"></required>7805</capabilities>7806<parameters>7807<param id="klass">7808<jclass field="field"/>7809<description>7810The class of the field to query.7811</description>7812</param>7813<param id="field">7814<jfieldID class="klass"/>7815<description>7816The field to query.7817</description>7818</param>7819<param id="is_synthetic_ptr">7820<outptr><jboolean/></outptr>7821<description>7822On return, points to the boolean result of this function.7823</description>7824</param>7825</parameters>7826<errors>7827</errors>7828</function>78297830</category>78317832<category id="method" label="Method">78337834<intro>7835These functions provide information about a method (represented as a7836<typelink id="jmethodID"/>) and set how methods are processed.7837</intro>78387839<intro id="obsoleteMethods" label="Obsolete Methods">7840The functions <functionlink id="RetransformClasses"/> and7841<functionlink id="RedefineClasses"/> can cause new versions7842of methods to be installed.7843An original version of a method is considered equivalent7844to the new version if:7845<ul>7846<li>their bytecodes are the same except for indices into the7847constant pool and </li>7848<li>the referenced constants are equal.</li>7849</ul>7850An original method version which is not equivalent to the7851new method version is called obsolete and is assigned a new method ID;7852the original method ID now refers to the new method version.7853A method ID can be tested for obsolescence with7854<functionlink id="IsMethodObsolete"/>.7855</intro>78567857<function id="GetMethodName" phase="start" num="64">7858<synopsis>Get Method Name (and Signature)</synopsis>7859<description>7860For the method indicated by <code>method</code>,7861return the method name via <code>name_ptr</code> and method signature via7862<code>signature_ptr</code>.7863<p/>7864Method signatures are defined in the JNI Specification and are7865referred to as <code>method descriptors</code> in7866<vmspec chapter="4.3.3"/>.7867Note this is different7868than method signatures as defined in the <i>Java Language Specification</i>.7869</description>7870<origin>jvmdiClone</origin>7871<capabilities>7872</capabilities>7873<parameters>7874<param id="method">7875<jmethodID/>7876<description>7877The method to query.7878</description>7879</param>7880<param id="name_ptr">7881<allocbuf>7882<char/>7883<nullok>the name is not returned</nullok>7884</allocbuf>7885<description>7886On return, points to the method name, encoded as a7887<internallink id="mUTF">modified UTF-8</internallink> string.7888</description>7889</param>7890<param id="signature_ptr">7891<allocbuf>7892<char/>7893<nullok>the signature is not returned</nullok>7894</allocbuf>7895<description>7896On return, points to the method signature, encoded as a7897<internallink id="mUTF">modified UTF-8</internallink> string.7898</description>7899</param>7900<param id="generic_ptr">7901<allocbuf>7902<char/>7903<nullok>the generic signature is not returned</nullok>7904</allocbuf>7905<description>7906On return, points to the generic signature of the method, encoded as a7907<internallink id="mUTF">modified UTF-8</internallink> string.7908If there is no generic signature attribute for the method, then,7909on return, points to <code>NULL</code>.7910</description>7911</param>7912</parameters>7913<errors>7914</errors>7915</function>79167917<function id="GetMethodDeclaringClass" phase="start" num="65">7918<synopsis>Get Method Declaring Class</synopsis>7919<description>7920For the method indicated by <code>method</code>,7921return the class that defined it via <code>declaring_class_ptr</code>.7922</description>7923<origin>jvmdi</origin>7924<capabilities>7925</capabilities>7926<parameters>7927<param id="klass">7928<jclass method="method"/>7929<description>7930The class to query.7931</description>7932</param>7933<param id="method">7934<jmethodID class="klass"/>7935<description>7936The method to query.7937</description>7938</param>7939<param id="declaring_class_ptr">7940<outptr><jclass/></outptr>7941<description>7942On return, points to the declaring class7943</description>7944</param>7945</parameters>7946<errors>7947</errors>7948</function>79497950<function id="GetMethodModifiers" phase="start" num="66">7951<synopsis>Get Method Modifiers</synopsis>7952<description>7953For the method indicated by <code>method</code>,7954return the access flags via <code>modifiers_ptr</code>.7955Access flags are defined in <vmspec chapter="4"/>.7956</description>7957<origin>jvmdi</origin>7958<capabilities>7959</capabilities>7960<parameters>7961<param id="klass">7962<jclass method="method"/>7963<description>7964The class to query.7965</description>7966</param>7967<param id="method">7968<jmethodID class="klass"/>7969<description>7970The method to query.7971</description>7972</param>7973<param id="modifiers_ptr">7974<outptr><jint/></outptr>7975<description>7976On return, points to the access flags.7977</description>7978</param>7979</parameters>7980<errors>7981</errors>7982</function>79837984<function id="GetMaxLocals" phase="start" num="68">7985<synopsis>Get Max Locals</synopsis>7986<description>7987For the method indicated by <code>method</code>,7988return the number of local variable slots used by the method,7989including the local variables used to pass parameters to the7990method on its invocation.7991<p/>7992See <code>max_locals</code> in <vmspec chapter="4.7.3"/>.7993</description>7994<origin>jvmdi</origin>7995<capabilities>7996</capabilities>7997<parameters>7998<param id="klass">7999<jclass method="method"/>8000<description>8001The class to query.8002</description>8003</param>8004<param id="method">8005<jmethodID class="klass" native="error"/>8006<description>8007The method to query.8008</description>8009</param>8010<param id="max_ptr">8011<outptr><jint/></outptr>8012<description>8013On return, points to the maximum number of local slots8014</description>8015</param>8016</parameters>8017<errors>8018</errors>8019</function>80208021<function id="GetArgumentsSize" phase="start" num="69">8022<synopsis>Get Arguments Size</synopsis>8023<description>8024For the method indicated by <code>method</code>,8025return via <code>max_ptr</code> the number of local variable slots used8026by the method's arguments.8027Note that two-word arguments use two slots.8028</description>8029<origin>jvmdi</origin>8030<capabilities>8031</capabilities>8032<parameters>8033<param id="klass">8034<jclass method="method"/>8035<description>8036The class to query.8037</description>8038</param>8039<param id="method">8040<jmethodID class="klass" native="error"/>8041<description>8042The method to query.8043</description>8044</param>8045<param id="size_ptr">8046<outptr><jint/></outptr>8047<description>8048On return, points to the number of argument slots8049</description>8050</param>8051</parameters>8052<errors>8053</errors>8054</function>80558056<function id="GetLineNumberTable" phase="start" num="70">8057<synopsis>Get Line Number Table</synopsis>8058<typedef id="jvmtiLineNumberEntry" label="Line number table entry">8059<field id="start_location">8060<jlocation/>8061<description>8062the <datalink id="jlocation"></datalink> where the line begins8063</description>8064</field>8065<field id="line_number">8066<jint/>8067<description>8068the line number8069</description>8070</field>8071</typedef>8072<description>8073For the method indicated by <code>method</code>,8074return a table of source line number entries. The size of the table is8075returned via <code>entry_count_ptr</code> and the table itself is8076returned via <code>table_ptr</code>.8077</description>8078<origin>jvmdi</origin>8079<capabilities>8080<required id="can_get_line_numbers"></required>8081</capabilities>8082<parameters>8083<param id="klass">8084<jclass method="method"/>8085<description>8086The class to query.8087</description>8088</param>8089<param id="method">8090<jmethodID class="klass" native="error"/>8091<description>8092The method to query.8093</description>8094</param>8095<param id="entry_count_ptr">8096<outptr><jint/></outptr>8097<description>8098On return, points to the number of entries in the table8099</description>8100</param>8101<param id="table_ptr">8102<allocbuf outcount="entry_count_ptr"><struct>jvmtiLineNumberEntry</struct></allocbuf>8103<description>8104On return, points to the line number table pointer.8105</description>8106</param>8107</parameters>8108<errors>8109<error id="JVMTI_ERROR_ABSENT_INFORMATION">8110Class information does not include line numbers.8111</error>8112</errors>8113</function>81148115<function id="GetMethodLocation" phase="start" num="71">8116<synopsis>Get Method Location</synopsis>8117<description>8118For the method indicated by <code>method</code>,8119return the beginning and ending addresses through8120<code>start_location_ptr</code> and <code>end_location_ptr</code>. In a8121conventional byte code indexing scheme,8122<code>start_location_ptr</code> will always point to zero8123and <code>end_location_ptr</code>8124will always point to the byte code count minus one.8125</description>8126<origin>jvmdi</origin>8127<capabilities>8128</capabilities>8129<parameters>8130<param id="klass">8131<jclass method="method"/>8132<description>8133The class to query.8134</description>8135</param>8136<param id="method">8137<jmethodID class="klass" native="error"/>8138<description>8139The method to query.8140</description>8141</param>8142<param id="start_location_ptr">8143<outptr><jlocation/></outptr>8144<description>8145On return, points to the first location, or8146<code>-1</code> if location information is not available.8147If the information is available and8148<functionlink id="GetJLocationFormat"></functionlink>8149returns <datalink id="JVMTI_JLOCATION_JVMBCI"></datalink>8150then this will always be zero.8151</description>8152</param>8153<param id="end_location_ptr">8154<outptr><jlocation/></outptr>8155<description>8156On return, points to the last location,8157or <code>-1</code> if location information is not available.8158</description>8159</param>8160</parameters>8161<errors>8162<error id="JVMTI_ERROR_ABSENT_INFORMATION">8163Class information does not include method sizes.8164</error>8165</errors>8166</function>81678168<function id="GetLocalVariableTable" num="72">8169<synopsis>Get Local Variable Table</synopsis>8170<typedef id="jvmtiLocalVariableEntry" label="Local variable table entry">8171<field id="start_location">8172<jlocation/>8173<description>8174The code array index where the local variable is first valid8175(that is, where it must have a value).8176</description>8177</field>8178<field id="length">8179<jint/>8180<description>8181The length of the valid section for this local variable.8182The last code array index where the local variable is valid8183is <code>start_location + length</code>.8184</description>8185</field>8186<field id="name">8187<allocfieldbuf><char/></allocfieldbuf>8188<description>8189The local variable name, encoded as a8190<internallink id="mUTF">modified UTF-8</internallink> string.8191</description>8192</field>8193<field id="signature">8194<allocfieldbuf><char/></allocfieldbuf>8195<description>8196The local variable's type signature, encoded as a8197<internallink id="mUTF">modified UTF-8</internallink> string.8198The signature format is the same as that defined in8199<vmspec chapter="4.3.2"/>.8200</description>8201</field>8202<field id="generic_signature">8203<allocfieldbuf><char/></allocfieldbuf>8204<description>8205The local variable's generic signature, encoded as a8206<internallink id="mUTF">modified UTF-8</internallink> string.8207The value of this field will be <code>NULL</code> for any local8208variable which does not have a generic type.8209</description>8210</field>8211<field id="slot">8212<jint/>8213<description>8214The local variable's slot. See <internallink id="local">Local Variables</internallink>.8215</description>8216</field>8217</typedef>8218<description>8219Return local variable information.8220</description>8221<origin>jvmdiClone</origin>8222<capabilities>8223<required id="can_access_local_variables"></required>8224</capabilities>8225<parameters>8226<param id="method">8227<jmethodID native="error"/>8228<description>8229The method to query.8230</description>8231</param>8232<param id="entry_count_ptr">8233<outptr><jint/></outptr>8234<description>8235On return, points to the number of entries in the table8236</description>8237</param>8238<param id="table_ptr">8239<allocbuf outcount="entry_count_ptr"><struct>jvmtiLocalVariableEntry</struct></allocbuf>8240<description>8241On return, points to an array of local variable table entries.8242</description>8243</param>8244</parameters>8245<errors>8246<error id="JVMTI_ERROR_ABSENT_INFORMATION">8247Class information does not include local variable8248information.8249</error>8250</errors>8251</function>82528253<function id="GetBytecodes" phase="start" num="75">8254<synopsis>Get Bytecodes</synopsis>8255<description>8256For the method indicated by <code>method</code>,8257return the byte codes that implement the method. The number of8258bytecodes is returned via <code>bytecode_count_ptr</code>. The byte codes8259themselves are returned via <code>bytecodes_ptr</code>.8260</description>8261<origin>jvmdi</origin>8262<capabilities>8263<required id="can_get_bytecodes"></required>8264</capabilities>8265<parameters>8266<param id="klass">8267<jclass method="method"/>8268<description>8269The class to query.8270</description>8271</param>8272<param id="method">8273<jmethodID class="klass" native="error"/>8274<description>8275The method to query.8276</description>8277</param>8278<param id="bytecode_count_ptr">8279<outptr><jint/></outptr>8280<description>8281On return, points to the length of the byte code array8282</description>8283</param>8284<param id="bytecodes_ptr">8285<allocbuf outcount="bytecode_count_ptr"><uchar/></allocbuf>8286<description>8287On return, points to the pointer to the byte code array8288</description>8289</param>8290</parameters>8291<errors>8292</errors>8293</function>82948295<function id="IsMethodNative" phase="start" num="76">8296<synopsis>Is Method Native</synopsis>8297<description>8298For the method indicated by <code>method</code>, return a8299value indicating whether the method is native via <code>is_native_ptr</code>8300</description>8301<origin>jvmdi</origin>8302<capabilities>8303</capabilities>8304<parameters>8305<param id="klass">8306<jclass method="method"/>8307<description>8308The class to query.8309</description>8310</param>8311<param id="method">8312<jmethodID class="klass"/>8313<description>8314The method to query.8315</description>8316</param>8317<param id="is_native_ptr">8318<outptr><jboolean/></outptr>8319<description>8320On return, points to the boolean result of this function.8321</description>8322</param>8323</parameters>8324<errors>8325</errors>8326</function>83278328<function id="IsMethodSynthetic" phase="start" num="77">8329<synopsis>Is Method Synthetic</synopsis>8330<description>8331For the method indicated by <code>method</code>, return a8332value indicating whether the method is synthetic via <code>is_synthetic_ptr</code>.8333Synthetic methods are generated by the compiler but not present in the8334original source code.8335</description>8336<origin>jvmdi</origin>8337<capabilities>8338<required id="can_get_synthetic_attribute"></required>8339</capabilities>8340<parameters>8341<param id="klass">8342<jclass method="method"/>8343<description>8344The class to query.8345</description>8346</param>8347<param id="method">8348<jmethodID class="klass"/>8349<description>8350The method to query.8351</description>8352</param>8353<param id="is_synthetic_ptr">8354<outptr><jboolean/></outptr>8355<description>8356On return, points to the boolean result of this function.8357</description>8358</param>8359</parameters>8360<errors>8361</errors>8362</function>83638364<function id="IsMethodObsolete" phase="start" num="91">8365<synopsis>Is Method Obsolete</synopsis>8366<description>8367Determine if a method ID refers to an8368<internallink id="obsoleteMethods">obsolete</internallink>8369method version.8370</description>8371<origin>jvmdi</origin>8372<capabilities>8373</capabilities>8374<parameters>8375<param id="klass">8376<jclass method="method"/>8377<description>8378The class to query.8379</description>8380</param>8381<param id="method">8382<jmethodID class="klass"/>8383<description>8384The method ID to query.8385</description>8386</param>8387<param id="is_obsolete_ptr">8388<outptr><jboolean/></outptr>8389<description>8390On return, points to the boolean result of this function.8391</description>8392</param>8393</parameters>8394<errors>8395</errors>8396</function>83978398<function id="SetNativeMethodPrefix" jkernel="yes" phase="any" num="73" since="1.1">8399<synopsis>Set Native Method Prefix</synopsis>8400<description>8401This function modifies the failure handling of8402native method resolution by allowing retry8403with a prefix applied to the name.8404When used with the8405<eventlink id="ClassFileLoadHook">ClassFileLoadHook8406event</eventlink>, it enables native methods to be8407<internallink id="bci">instrumented</internallink>.8408<p/>8409Since native methods cannot be directly instrumented8410(they have no bytecodes), they must be wrapped with8411a non-native method which can be instrumented.8412For example, if we had:8413<example>8414native boolean foo(int x);</example>8415<p/>8416We could transform the class file (with the8417ClassFileLoadHook event) so that this becomes:8418<example>8419boolean foo(int x) {8420<i>... record entry to foo ...</i>8421return wrapped_foo(x);8422}84238424native boolean wrapped_foo(int x);</example>8425<p/>8426Where foo becomes a wrapper for the actual native method8427with the appended prefix "wrapped_". Note that8428"wrapped_" would be a poor choice of prefix since it8429might conceivably form the name of an existing method8430thus something like "$$$MyAgentWrapped$$$_" would be8431better but would make these examples less readable.8432<p/>8433The wrapper will allow data to be collected on the native8434method call, but now the problem becomes linking up the8435wrapped method with the native implementation.8436That is, the method <code>wrapped_foo</code> needs to be8437resolved to the native implementation of <code>foo</code>,8438which might be:8439<example>8440Java_somePackage_someClass_foo(JNIEnv* env, jint x)</example>8441<p/>8442This function allows the prefix to be specified and the8443proper resolution to occur.8444Specifically, when the standard resolution fails, the8445resolution is retried taking the prefix into consideration.8446There are two ways that resolution occurs, explicit8447resolution with the JNI function <code>RegisterNatives</code>8448and the normal automatic resolution. For8449<code>RegisterNatives</code>, the VM will attempt this8450association:8451<example>8452method(foo) -> nativeImplementation(foo)</example>8453<p/>8454When this fails, the resolution will be retried with8455the specified prefix prepended to the method name,8456yielding the correct resolution:8457<example>8458method(wrapped_foo) -> nativeImplementation(foo)</example>8459<p/>8460For automatic resolution, the VM will attempt:8461<example>8462method(wrapped_foo) -> nativeImplementation(wrapped_foo)</example>8463<p/>8464When this fails, the resolution will be retried with8465the specified prefix deleted from the implementation name,8466yielding the correct resolution:8467<example>8468method(wrapped_foo) -> nativeImplementation(foo)</example>8469<p/>8470Note that since the prefix is only used when standard8471resolution fails, native methods can be wrapped selectively.8472<p/>8473Since each <jvmti/> environment is independent and8474can do its own transformation of the bytecodes, more8475than one layer of wrappers may be applied. Thus each8476environment needs its own prefix. Since transformations8477are applied in order, the prefixes, if applied, will8478be applied in the same order.8479The order of transformation application is described in8480the <eventlink id="ClassFileLoadHook"/> event.8481Thus if three environments applied8482wrappers, <code>foo</code> might become8483<code>$env3_$env2_$env1_foo</code>. But if, say,8484the second environment did not apply a wrapper to8485<code>foo</code> it would be just8486<code>$env3_$env1_foo</code>. To be able to8487efficiently determine the sequence of prefixes,8488an intermediate prefix is only applied if its non-native8489wrapper exists. Thus, in the last example, even though8490<code>$env1_foo</code> is not a native method, the8491<code>$env1_</code> prefix is applied since8492<code>$env1_foo</code> exists.8493<p/>8494Since the prefixes are used at resolution time8495and since resolution may be arbitrarily delayed, a8496native method prefix must remain set as long as there8497are corresponding prefixed native methods.8498</description>8499<origin>new</origin>8500<capabilities>8501<required id="can_set_native_method_prefix"></required>8502</capabilities>8503<parameters>8504<param id="prefix">8505<inbuf>8506<char/>8507<nullok>8508any existing prefix in this environment is cancelled8509</nullok>8510</inbuf>8511<description>8512The prefix to apply, encoded as a8513<internallink id="mUTF">modified UTF-8</internallink> string.8514</description>8515</param>8516</parameters>8517<errors>8518</errors>8519</function>85208521<function id="SetNativeMethodPrefixes" jkernel="yes" phase="any" num="74" since="1.1">8522<synopsis>Set Native Method Prefixes</synopsis>8523<description>8524For a normal agent, <functionlink id="SetNativeMethodPrefix"/>8525will provide all needed native method prefixing.8526For a meta-agent that performs multiple independent class8527file transformations (for example as a proxy for another8528layer of agents) this function allows each transformation8529to have its own prefix.8530The prefixes are applied in the order supplied and are8531processed in the same manor as described for the8532application of prefixes from multiple <jvmti/> environments8533in <functionlink id="SetNativeMethodPrefix"/>.8534<p/>8535Any previous prefixes are replaced. Thus, calling this8536function with a <paramlink id="prefix_count"/> of <code>0</code>8537disables prefixing in this environment.8538<p/>8539<functionlink id="SetNativeMethodPrefix"/> and this function8540are the two ways to set the prefixes.8541Calling <code>SetNativeMethodPrefix</code> with8542a prefix is the same as calling this function with8543<paramlink id="prefix_count"/> of <code>1</code>.8544Calling <code>SetNativeMethodPrefix</code> with8545<code>NULL</code> is the same as calling this function with8546<paramlink id="prefix_count"/> of <code>0</code>.8547</description>8548<origin>new</origin>8549<capabilities>8550<required id="can_set_native_method_prefix"></required>8551</capabilities>8552<parameters>8553<param id="prefix_count">8554<jint min="0"/>8555<description>8556The number of prefixes to apply.8557</description>8558</param>8559<param id="prefixes">8560<agentbuf>8561<char/>8562</agentbuf>8563<description>8564The prefixes to apply for this environment, each encoded as a8565<internallink id="mUTF">modified UTF-8</internallink> string.8566</description>8567</param>8568</parameters>8569<errors>8570</errors>8571</function>85728573</category>85748575<category id="RawMonitors" label="Raw Monitor">85768577<function id="CreateRawMonitor" phase="onload" callbacksafe="safe" num="31">8578<synopsis>Create Raw Monitor</synopsis>8579<description>8580Create a raw monitor.8581</description>8582<origin>jvmdi</origin>8583<capabilities>8584</capabilities>8585<parameters>8586<param id="name">8587<inbuf><char/></inbuf>8588<description>8589A name to identify the monitor, encoded as a8590<internallink id="mUTF">modified UTF-8</internallink> string.8591</description>8592</param>8593<param id="monitor_ptr">8594<outptr><jrawMonitorID/></outptr>8595<description>8596On return, points to the created monitor.8597</description>8598</param>8599</parameters>8600<errors>8601</errors>8602</function>86038604<function id="DestroyRawMonitor" phase="onload" callbacksafe="safe" num="32">8605<synopsis>Destroy Raw Monitor</synopsis>8606<description>8607Destroy the raw monitor.8608If the monitor being destroyed has been entered by this thread, it will be8609exited before it is destroyed.8610If the monitor being destroyed has been entered by another thread,8611an error will be returned and the monitor will not be destroyed.8612</description>8613<origin>jvmdi</origin>8614<capabilities>8615</capabilities>8616<parameters>8617<param id="monitor">8618<jrawMonitorID/>8619<description>8620The monitor8621</description>8622</param>8623</parameters>8624<errors>8625<error id="JVMTI_ERROR_NOT_MONITOR_OWNER">8626Not monitor owner8627</error>8628</errors>8629</function>86308631<function id="RawMonitorEnter" phase="any" callbacksafe="safe" impl="innative notrace" num="33">8632<synopsis>Raw Monitor Enter</synopsis>8633<description>8634Gain exclusive ownership of a raw monitor.8635The same thread may enter a monitor more then once.8636The thread must8637<functionlink id="RawMonitorExit">exit</functionlink>8638the monitor the same number of times as it is entered.8639If a monitor is entered during <code>OnLoad</code> (before attached threads exist)8640and has not exited when attached threads come into existence, the enter8641is considered to have occurred on the main thread.8642</description>8643<origin>jvmdi</origin>8644<capabilities>8645</capabilities>8646<parameters>8647<param id="monitor">8648<jrawMonitorID/>8649<description>8650The monitor8651</description>8652</param>8653</parameters>8654<errors>8655</errors>8656</function>86578658<function id="RawMonitorExit" phase="any" callbacksafe="safe" impl="innative notrace" num="34">8659<synopsis>Raw Monitor Exit</synopsis>8660<description>8661Release exclusive ownership of a raw monitor.8662</description>8663<origin>jvmdi</origin>8664<capabilities>8665</capabilities>8666<parameters>8667<param id="monitor">8668<jrawMonitorID/>8669<description>8670The monitor8671</description>8672</param>8673</parameters>8674<errors>8675<error id="JVMTI_ERROR_NOT_MONITOR_OWNER">8676Not monitor owner8677</error>8678</errors>8679</function>86808681<function id="RawMonitorWait" phase="any" callbacksafe="safe" impl="innative notrace" num="35">8682<synopsis>Raw Monitor Wait</synopsis>8683<description>8684Wait for notification of the raw monitor.8685<p/>8686Causes the current thread to wait until either another thread calls8687<functionlink id="RawMonitorNotify"/> or8688<functionlink id="RawMonitorNotifyAll"/>8689for the specified raw monitor, or the specified8690<paramlink id="millis">timeout</paramlink>8691has elapsed.8692</description>8693<origin>jvmdi</origin>8694<capabilities>8695</capabilities>8696<parameters>8697<param id="monitor">8698<jrawMonitorID/>8699<description>8700The monitor8701</description>8702</param>8703<param id="millis">8704<jlong/>8705<description>8706The timeout, in milliseconds. If the timeout is8707zero, then real time is not taken into consideration8708and the thread simply waits until notified.8709</description>8710</param>8711</parameters>8712<errors>8713<error id="JVMTI_ERROR_NOT_MONITOR_OWNER">8714Not monitor owner8715</error>8716<error id="JVMTI_ERROR_INTERRUPT">8717Wait was interrupted, try again8718</error>8719</errors>8720</function>87218722<function id="RawMonitorNotify" phase="any" callbacksafe="safe" impl="notrace" num="36">8723<synopsis>Raw Monitor Notify</synopsis>8724<description>8725Notify a single thread waiting on the raw monitor.8726</description>8727<origin>jvmdi</origin>8728<capabilities>8729</capabilities>8730<parameters>8731<param id="monitor">8732<jrawMonitorID/>8733<description>8734The monitor8735</description>8736</param>8737</parameters>8738<errors>8739<error id="JVMTI_ERROR_NOT_MONITOR_OWNER">8740Not monitor owner8741</error>8742</errors>8743</function>87448745<function id="RawMonitorNotifyAll" phase="any" callbacksafe="safe" impl="notrace" num="37">8746<synopsis>Raw Monitor Notify All</synopsis>8747<description>8748Notify all threads waiting on the raw monitor.8749</description>8750<origin>jvmdi</origin>8751<capabilities>8752</capabilities>8753<parameters>8754<param id="monitor">8755<jrawMonitorID/>8756<description>8757The monitor8758</description>8759</param>8760</parameters>8761<errors>8762<error id="JVMTI_ERROR_NOT_MONITOR_OWNER">8763Not monitor owner8764</error>8765</errors>8766</function>87678768<elide>8769<function id="GetRawMonitorUse" num="118">8770<synopsis>Get Raw Monitor Use</synopsis>8771<description>8772The fields of the <functionlink id="jvmtiMonitorUsage"></functionlink> structure8773are filled in with information about usage of the raw monitor.8774</description>8775<origin>new</origin>8776<capabilities>8777<required id="can_get_raw_monitor_usage"></required>8778</capabilities>8779<parameters>8780<param id="monitor">8781<jrawMonitorID/>8782<description>8783the raw monitor to query.8784</description>8785</param>8786<param id="info_ptr">8787<outptr><struct>jvmtiMonitorUsage</struct></outptr>8788<description>8789On return, filled with monitor information for the8790specified raw monitor.8791</description>8792</param>8793</parameters>8794<errors>8795</errors>8796</function>87978798<function id="GetRawMonitors" num="119">8799<synopsis>Get Raw Monitors</synopsis>8800<description>8801Return the list of raw monitors.8802<p/>8803Note: details about each monitor can be examined with8804<functionlink id="GetRawMonitorUse"></functionlink>.8805</description>8806<origin>new</origin>8807<capabilities>8808<required id="can_get_raw_monitor_usage"></required>8809</capabilities>8810<parameters>8811<param id="monitorCnt">8812<outptr><jint/></outptr>8813<description>8814On return, pointer to the number8815of monitors returned in <code>monitors_ptr</code>.8816</description>8817</param>8818<param id="monitors_ptr">8819<allocbuf outcount="monitorCnt"><jrawMonitorID/></allocbuf>8820<description>8821On return, pointer to the monitor list.8822</description>8823</param>8824</parameters>8825<errors>8826</errors>8827</function>8828</elide>8829</category>88308831<category id="jniIntercept" label="JNI Function Interception">88328833<intro>8834Provides the ability to intercept and resend8835Java Native Interface (JNI) function calls8836by manipulating the JNI function table.8837See <externallink id="http://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/functions.html">JNI8838Functions</externallink> in the <i>Java Native Interface Specification</i>.8839<p/>8840The following example illustrates intercepting the8841<code>NewGlobalRef</code> JNI call in order to count reference8842creation.8843<example>8844JNIEnv original_jni_Functions;8845JNIEnv redirected_jni_Functions;8846int my_global_ref_count = 0;88478848jobject8849MyNewGlobalRef(JNIEnv *jni_env, jobject lobj) {8850++my_global_ref_count;8851return originalJNIFunctions->NewGlobalRef(env, lobj);8852}88538854void8855myInit() {8856jvmtiError err;88578858err = (*jvmti_env)->GetJNIFunctionTable(jvmti_env, &original_jni_Functions);8859if (err != JVMTI_ERROR_NONE) {8860die();8861}8862err = (*jvmti_env)->GetJNIFunctionTable(jvmti_env, &redirected_jni_Functions);8863if (err != JVMTI_ERROR_NONE) {8864die();8865}8866redirectedJNIFunctions->NewGlobalRef = MyNewGlobalRef;8867err = (*jvmti_env)->SetJNIFunctionTable(jvmti_env, redirected_jni_Functions);8868if (err != JVMTI_ERROR_NONE) {8869die();8870}8871}8872</example>8873Sometime after <code>myInit</code> is called the user's JNI8874code is executed which makes the call to create a new global8875reference. Instead of going to the normal JNI implementation8876the call goes to <code>myNewGlobalRef</code>. Note that a8877copy of the original function table is kept so that the normal8878JNI function can be called after the data is collected.8879Note also that any JNI functions which are not overwritten8880will behave normally.8881<todo>8882check that the example compiles and executes.8883</todo>8884</intro>88858886<function id="SetJNIFunctionTable" phase="start" num="120">8887<synopsis>Set JNI Function Table</synopsis>8888<description>8889Set the JNI function table8890in all current and future JNI environments.8891As a result, all future JNI calls are directed to the specified functions.8892Use <functionlink id="GetJNIFunctionTable"></functionlink> to get the8893function table to pass to this function.8894For this function to take effect the the updated table entries must be8895used by the JNI clients.8896Since the table is defined <code>const</code> some compilers may optimize8897away the access to the table, thus preventing this function from taking8898effect.8899The table is copied--changes to the local copy of the8900table have no effect.8901This function affects only the function table, all other aspects of the environment are8902unaffected.8903See the examples <internallink id="jniIntercept">above</internallink>.8904</description>8905<origin>new</origin>8906<capabilities>8907</capabilities>8908<parameters>8909<param id="function_table">8910<inptr>8911<struct>jniNativeInterface</struct>8912</inptr>8913<description>8914Points to the new JNI function table.8915</description>8916</param>8917</parameters>8918<errors>8919</errors>8920</function>89218922<function id="GetJNIFunctionTable" phase="start" num="121">8923<synopsis>Get JNI Function Table</synopsis>8924<description>8925Get the JNI function table.8926The JNI function table is copied into allocated memory.8927If <functionlink id="SetJNIFunctionTable"></functionlink>8928has been called, the modified (not the original) function8929table is returned.8930Only the function table is copied, no other aspects of the environment8931are copied.8932See the examples <internallink id="jniIntercept">above</internallink>.8933</description>8934<origin>new</origin>8935<capabilities>8936</capabilities>8937<parameters>8938<param id="function_table">8939<allocbuf>8940<struct>jniNativeInterface</struct>8941</allocbuf>8942<description>8943On return, <code>*function_table</code>8944points a newly allocated copy of the JNI function table.8945</description>8946</param>8947</parameters>8948<errors>8949</errors>8950</function>89518952</category>89538954<category id="eventManagement" label="Event Management">89558956<function id="SetEventCallbacks" jkernel="yes" phase="onload" num="122">8957<synopsis>Set Event Callbacks</synopsis>8958<description>8959Set the functions to be called for each event.8960The callbacks are specified by supplying a replacement function table.8961The function table is copied--changes to the local copy of the8962table have no effect.8963This is an atomic action, all callbacks are set at once.8964No events are sent before this function is called.8965When an entry is <code>NULL</code> or when the event is beyond8966<paramlink id="size_of_callbacks"></paramlink> no event is sent.8967Details on events are8968described <internallink id="EventSection">later</internallink> in this document.8969An event must be enabled and have a callback in order to be8970sent--the order in which this function and8971<functionlink id="SetEventNotificationMode"></functionlink>8972are called does not affect the result.8973</description>8974<origin>new</origin>8975<capabilities>8976</capabilities>8977<parameters>8978<param id="callbacks">8979<inptr>8980<struct>jvmtiEventCallbacks</struct>8981<nullok>remove the existing callbacks</nullok>8982</inptr>8983<description>8984The new event callbacks.8985</description>8986</param>8987<param id="size_of_callbacks">8988<jint min="0"/>8989<description>8990<code>sizeof(jvmtiEventCallbacks)</code>--for version8991compatibility.8992</description>8993</param>8994</parameters>8995<errors>8996</errors>8997</function>89988999<function id="SetEventNotificationMode" jkernel="yes" phase="onload" num="2">9000<synopsis>Set Event Notification Mode</synopsis>9001<description>9002Control the generation of events.9003<constants id="jvmtiEventMode" label="Event Enable/Disable" kind="enum">9004<constant id="JVMTI_ENABLE" num="1">9005If <paramlink id="mode"></paramlink> is <code>JVMTI_ENABLE</code>,9006the event <paramlink id="event_type"></paramlink> will be enabled9007</constant>9008<constant id="JVMTI_DISABLE" num="0">9009If <paramlink id="mode"></paramlink> is <code>JVMTI_DISABLE</code>,9010the event <paramlink id="event_type"></paramlink> will be disabled9011</constant>9012</constants>9013If <code>thread</code> is <code>NULL</code>,9014the event is enabled or disabled globally; otherwise, it is9015enabled or disabled for a particular thread.9016An event is generated for9017a particular thread if it is enabled either at the thread or global9018levels.9019<p/>9020See <internallink id="EventIndex">below</internallink> for information on specific events.9021<p/>9022The following events cannot be controlled at the thread9023level through this function.9024<ul>9025<li><eventlink id="VMInit"></eventlink></li>9026<li><eventlink id="VMStart"></eventlink></li>9027<li><eventlink id="VMDeath"></eventlink></li>9028<li><eventlink id="ThreadStart"></eventlink></li>9029<li><eventlink id="CompiledMethodLoad"></eventlink></li>9030<li><eventlink id="CompiledMethodUnload"></eventlink></li>9031<li><eventlink id="DynamicCodeGenerated"></eventlink></li>9032<li><eventlink id="DataDumpRequest"></eventlink></li>9033</ul>9034<p/>9035Initially, no events are enabled at either the thread level9036or the global level.9037<p/>9038Any needed capabilities (see Event Enabling Capabilities below) must be possessed9039before calling this function.9040<p/>9041Details on events are9042described <internallink id="EventSection">below</internallink>.9043</description>9044<origin>jvmdiClone</origin>9045<eventcapabilities></eventcapabilities>9046<parameters>9047<param id="mode">9048<enum>jvmtiEventMode</enum>9049<description>9050<code>JVMTI_ENABLE</code> or <code>JVMTI_DISABLE</code>9051</description>9052</param>9053<param id="event_type">9054<enum>jvmtiEvent</enum>9055<description>9056the event to control9057</description>9058</param>9059<param id="event_thread">9060<ptrtype>9061<jthread impl="noconvert"/>9062<nullok>event is controlled at the global level</nullok>9063</ptrtype>9064<description>9065The thread to control9066</description>9067</param>9068<param id="...">9069<varargs/>9070<description>9071for future expansion9072</description>9073</param>9074</parameters>9075<errors>9076<error id="JVMTI_ERROR_INVALID_THREAD">9077<paramlink id="event_thread"/> is non-<code>NULL</code> and is not a valid thread.9078</error>9079<error id="JVMTI_ERROR_THREAD_NOT_ALIVE">9080<paramlink id="event_thread"/> is non-<code>NULL</code> and is not live (has not been started or is now dead).9081</error>9082<error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">9083thread level control was attempted on events which do not9084permit thread level control.9085</error>9086<error id="JVMTI_ERROR_MUST_POSSESS_CAPABILITY">9087The Required Event Enabling Capability is not possessed.9088</error>9089</errors>9090</function>90919092<function id="GenerateEvents" num="123">9093<synopsis>Generate Events</synopsis>9094<description>9095Generate events to represent the current state of the VM.9096For example, if <paramlink id="event_type"/> is9097<code>JVMTI_EVENT_COMPILED_METHOD_LOAD</code>,9098a <eventlink id="CompiledMethodLoad"></eventlink> event will be9099sent for each currently compiled method.9100Methods that were loaded and now have been unloaded are not sent.9101The history of what events have previously been sent does not9102effect what events are sent by this function--for example,9103all currently compiled methods9104will be sent each time this function is called.9105<p/>9106This function is useful when9107events may have been missed due to the agent attaching after program9108execution begins; this function generates the missed events.9109<p/>9110Attempts to execute Java programming language code or9111JNI functions may be paused until this function returns -9112so neither should be called from the thread sending the event.9113This function returns only after the missed events have been9114sent, processed and have returned.9115The event may be sent on a different thread than the thread9116on which the event occurred.9117The callback for the event must be set with9118<functionlink id="SetEventCallbacks"></functionlink>9119and the event must be enabled with9120<functionlink id="SetEventNotificationMode"></functionlink>9121or the events will not occur.9122If the VM no longer has the information to generate some or9123all of the requested events, the events are simply not sent -9124no error is returned.9125<p/>9126Only the following events are supported:9127<ul>9128<li><eventlink id="CompiledMethodLoad"></eventlink></li>9129<li><eventlink id="DynamicCodeGenerated"></eventlink></li>9130</ul>9131</description>9132<origin>new</origin>9133<capabilities>9134<capability id="can_generate_compiled_method_load_events"></capability>9135</capabilities>9136<parameters>9137<param id="event_type">9138<enum>jvmtiEvent</enum>9139<description>9140The type of event to generate. Must be one of these:9141<ul>9142<li><eventlink id="CompiledMethodLoad"><code>JVMTI_EVENT_COMPILED_METHOD_LOAD</code></eventlink></li>9143<li><eventlink id="DynamicCodeGenerated"><code>JVMTI_EVENT_DYNAMIC_CODE_GENERATED</code></eventlink></li>9144</ul>9145</description>9146</param>9147</parameters>9148<errors>9149<error id="JVMTI_ERROR_MUST_POSSESS_CAPABILITY">9150<paramlink id="event_type"/> is9151<eventlink id="CompiledMethodLoad"><code>JVMTI_EVENT_COMPILED_METHOD_LOAD</code></eventlink>9152and <fieldlink id="can_generate_compiled_method_load_events" struct="jvmtiCapabilities"></fieldlink>9153is <code>false</code>.9154</error>9155<error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">9156<paramlink id="event_type"/> is other than9157<eventlink id="CompiledMethodLoad"><code>JVMTI_EVENT_COMPILED_METHOD_LOAD</code></eventlink>9158or <eventlink id="DynamicCodeGenerated"><code>JVMTI_EVENT_DYNAMIC_CODE_GENERATED</code></eventlink>.9159</error>9160</errors>9161</function>91629163</category>91649165<category id="extension" label="Extension Mechanism">91669167<intro>9168These functions9169allow a <jvmti/> implementation to provide functions and events9170beyond those defined in this specification.9171<p/>9172Both extension functions and extension events have parameters9173each of which has a 'type' and 'kind' chosen from the following tables:91749175<constants id="jvmtiParamTypes" label="Extension Function/Event Parameter Types" kind="enum">9176<constant id="JVMTI_TYPE_JBYTE" num="101">9177Java programming language primitive type - <code>byte</code>.9178JNI type <code>jbyte</code>.9179</constant>9180<constant id="JVMTI_TYPE_JCHAR" num="102">9181Java programming language primitive type - <code>char</code>.9182JNI type <code>jchar</code>.9183</constant>9184<constant id="JVMTI_TYPE_JSHORT" num="103">9185Java programming language primitive type - <code>short</code>.9186JNI type <code>jshort</code>.9187</constant>9188<constant id="JVMTI_TYPE_JINT" num="104">9189Java programming language primitive type - <code>int</code>.9190JNI type <datalink id="jint"></datalink>.9191</constant>9192<constant id="JVMTI_TYPE_JLONG" num="105">9193Java programming language primitive type - <code>long</code>.9194JNI type <datalink id="jlong"></datalink>.9195</constant>9196<constant id="JVMTI_TYPE_JFLOAT" num="106">9197Java programming language primitive type - <code>float</code>.9198JNI type <datalink id="jfloat"></datalink>.9199</constant>9200<constant id="JVMTI_TYPE_JDOUBLE" num="107">9201Java programming language primitive type - <code>double</code>.9202JNI type <datalink id="jdouble"></datalink>.9203</constant>9204<constant id="JVMTI_TYPE_JBOOLEAN" num="108">9205Java programming language primitive type - <code>boolean</code>.9206JNI type <datalink id="jboolean"></datalink>.9207</constant>9208<constant id="JVMTI_TYPE_JOBJECT" num="109">9209Java programming language object type - <code>java.lang.Object</code>.9210JNI type <datalink id="jobject"></datalink>.9211Returned values are JNI local references and must be managed.9212</constant>9213<constant id="JVMTI_TYPE_JTHREAD" num="110">9214Java programming language object type - <code>java.lang.Thread</code>.9215<jvmti/> type <datalink id="jthread"></datalink>.9216Returned values are JNI local references and must be managed.9217</constant>9218<constant id="JVMTI_TYPE_JCLASS" num="111">9219Java programming language object type - <code>java.lang.Class</code>.9220JNI type <datalink id="jclass"></datalink>.9221Returned values are JNI local references and must be managed.9222</constant>9223<constant id="JVMTI_TYPE_JVALUE" num="112">9224Union of all Java programming language primitive and object types -9225JNI type <datalink id="jvalue"></datalink>.9226Returned values which represent object types are JNI local references and must be managed.9227</constant>9228<constant id="JVMTI_TYPE_JFIELDID" num="113">9229Java programming language field identifier -9230JNI type <datalink id="jfieldID"></datalink>.9231</constant>9232<constant id="JVMTI_TYPE_JMETHODID" num="114">9233Java programming language method identifier -9234JNI type <datalink id="jmethodID"></datalink>.9235</constant>9236<constant id="JVMTI_TYPE_CCHAR" num="115">9237C programming language type - <code>char</code>.9238</constant>9239<constant id="JVMTI_TYPE_CVOID" num="116">9240C programming language type - <code>void</code>.9241</constant>9242<constant id="JVMTI_TYPE_JNIENV" num="117">9243JNI environment - <code>JNIEnv</code>.9244Should be used with the correct <datalink id="jvmtiParamKind"/> to make it a pointer type.9245</constant>9246</constants>92479248<constants id="jvmtiParamKind" label="Extension Function/Event Parameter Kinds" kind="enum">9249<constant id="JVMTI_KIND_IN" num="91">9250Ingoing argument - <code>foo</code>.9251</constant>9252<constant id="JVMTI_KIND_IN_PTR" num="92">9253Ingoing pointer argument - <code>const foo*</code>.9254</constant>9255<constant id="JVMTI_KIND_IN_BUF" num="93">9256Ingoing array argument - <code>const foo*</code>.9257</constant>9258<constant id="JVMTI_KIND_ALLOC_BUF" num="94">9259Outgoing allocated array argument - <code>foo**</code>.9260Free with <code>Deallocate</code>.9261</constant>9262<constant id="JVMTI_KIND_ALLOC_ALLOC_BUF" num="95">9263Outgoing allocated array of allocated arrays argument - <code>foo***</code>.9264Free with <code>Deallocate</code>.9265</constant>9266<constant id="JVMTI_KIND_OUT" num="96">9267Outgoing argument - <code>foo*</code>.9268</constant>9269<constant id="JVMTI_KIND_OUT_BUF" num="97">9270Outgoing array argument (pre-allocated by agent) - <code>foo*</code>.9271Do not <code>Deallocate</code>.9272</constant>9273</constants>92749275</intro>92769277<typedef id="jvmtiParamInfo" label="Extension Function/Event Parameter Info">9278<field id="name">9279<allocfieldbuf><char/></allocfieldbuf>9280<description>9281The parameter name, encoded as a9282<internallink id="mUTF">modified UTF-8</internallink> string9283</description>9284</field>9285<field id="kind">9286<enum>jvmtiParamKind</enum>9287<description>9288The kind of the parameter - type modifiers9289</description>9290</field>9291<field id="base_type">9292<enum>jvmtiParamTypes</enum>9293<description>9294The base type of the parameter - modified by <code>kind</code>9295</description>9296</field>9297<field id="null_ok">9298<jboolean/>9299<description>9300Is a <code>NULL</code> argument permitted? Applies only to pointer and object types.9301</description>9302</field>9303</typedef>93049305<callback id="jvmtiExtensionFunction">9306<enum>jvmtiError</enum>9307<synopsis>Extension Function</synopsis>9308<description>9309This is the implementation-specific extension function.9310</description>9311<parameters>9312<param id="jvmti_env">9313<outptr>9314<struct>jvmtiEnv</struct>9315</outptr>9316<description>9317The <jvmti/> environment is the only fixed parameter for extension functions.9318</description>9319</param>9320<param id="...">9321<varargs/>9322<description>9323The extension function-specific parameters9324</description>9325</param>9326</parameters>9327</callback>93289329<function id="GetExtensionFunctions" phase="onload" num="124">9330<synopsis>Get Extension Functions</synopsis>93319332<typedef id="jvmtiExtensionFunctionInfo" label="Extension Function Info">9333<field id="func">9334<ptrtype>9335<struct>jvmtiExtensionFunction</struct>9336</ptrtype>9337<description>9338The actual function to call9339</description>9340</field>9341<field id="id">9342<allocfieldbuf><char/></allocfieldbuf>9343<description>9344The identifier for the extension function, encoded as a9345<internallink id="mUTF">modified UTF-8</internallink> string.9346Uses package name conventions.9347For example, <code>com.sun.hotspot.bar</code>9348</description>9349</field>9350<field id="short_description">9351<allocfieldbuf><char/></allocfieldbuf>9352<description>9353A one sentence description of the function, encoded as a9354<internallink id="mUTF">modified UTF-8</internallink> string.9355</description>9356</field>9357<field id="param_count">9358<jint/>9359<description>9360The number of parameters excluding <code>jvmtiEnv *jvmti_env</code>9361</description>9362</field>9363<field id="params">9364<allocfieldbuf outcount="param_count">9365<struct>jvmtiParamInfo</struct>9366</allocfieldbuf>9367<description>9368Array of9369<fieldlink id="param_count" struct="jvmtiExtensionFunctionInfo"></fieldlink>9370parameters (<code>jvmtiEnv *jvmti_env</code> excluded)9371</description>9372</field>9373<field id="error_count">9374<jint/>9375<description>9376The number of possible error returns (excluding universal errors)9377</description>9378</field>9379<field id="errors">9380<allocfieldbuf outcount="error_count">9381<enum>jvmtiError</enum>9382</allocfieldbuf>9383<description>9384Array of <fieldlink id="error_count" struct="jvmtiExtensionFunctionInfo"></fieldlink>9385possible errors9386</description>9387</field>9388</typedef>93899390<description>9391Returns the set of extension functions.9392</description>9393<origin>new</origin>9394<capabilities>9395</capabilities>9396<parameters>9397<param id="extension_count_ptr">9398<outptr><jint/></outptr>9399<description>9400On return, points to the number of extension functions9401</description>9402</param>9403<param id="extensions">9404<allocbuf outcount="extension_count_ptr"><struct>jvmtiExtensionFunctionInfo</struct></allocbuf>9405<description>9406Returns an array of extension function info, one per function9407</description>9408</param>9409</parameters>9410<errors>9411</errors>9412</function>94139414<function id="GetExtensionEvents" phase="onload" num="125">9415<synopsis>Get Extension Events</synopsis>94169417<typedef id="jvmtiExtensionEventInfo" label="Extension Event Info">9418<field id="extension_event_index">9419<jint/>9420<description>9421The identifying index of the event9422</description>9423</field>9424<field id="id">9425<allocfieldbuf><char/></allocfieldbuf>9426<description>9427The identifier for the extension event, encoded as a9428<internallink id="mUTF">modified UTF-8</internallink> string.9429Uses package name conventions.9430For example, <code>com.sun.hotspot.bar</code>9431</description>9432</field>9433<field id="short_description">9434<allocfieldbuf><char/></allocfieldbuf>9435<description>9436A one sentence description of the event, encoded as a9437<internallink id="mUTF">modified UTF-8</internallink> string.9438</description>9439</field>9440<field id="param_count">9441<jint/>9442<description>9443The number of parameters excluding <code>jvmtiEnv *jvmti_env</code>9444</description>9445</field>9446<field id="params">9447<allocfieldbuf outcount="param_count">9448<struct>jvmtiParamInfo</struct>9449</allocfieldbuf>9450<description>9451Array of9452<fieldlink id="param_count" struct="jvmtiExtensionEventInfo"></fieldlink>9453parameters (<code>jvmtiEnv *jvmti_env</code> excluded)9454</description>9455</field>9456</typedef>94579458<description>9459Returns the set of extension events.9460</description>9461<origin>new</origin>9462<capabilities>9463</capabilities>9464<parameters>9465<param id="extension_count_ptr">9466<outptr><jint/></outptr>9467<description>9468On return, points to the number of extension events9469</description>9470</param>9471<param id="extensions">9472<allocbuf outcount="extension_count_ptr"><struct>jvmtiExtensionEventInfo</struct></allocbuf>9473<description>9474Returns an array of extension event info, one per event9475</description>9476</param>9477</parameters>9478<errors>9479</errors>9480</function>94819482<callback id="jvmtiExtensionEvent">9483<void/>9484<synopsis>Extension Event</synopsis>9485<description>9486This is the implementation-specific event.9487The event handler is set with9488<functionlink id="SetExtensionEventCallback"/>.9489<p/>9490Event handlers for extension events must be declared varargs to match this definition.9491Failure to do so could result in calling convention mismatch and undefined behavior9492on some platforms.9493<p/>9494For example, if the <code>jvmtiParamInfo</code>9495returned by <functionlink id="GetExtensionEvents"/> indicates that9496there is a <code>jint</code> parameter, the event handler should be9497declared:9498<example>9499void JNICALL myHandler(jvmtiEnv* jvmti_env, jint myInt, ...)9500</example>9501Note the terminal "<code>...</code>" which indicates varargs.9502</description>9503<parameters>9504<param id="jvmti_env">9505<outptr>9506<struct>jvmtiEnv</struct>9507</outptr>9508<description>9509The <jvmti/> environment is the only fixed parameter for extension events.9510</description>9511</param>9512<param id="...">9513<varargs/>9514<description>9515The extension event-specific parameters9516</description>9517</param>9518</parameters>9519</callback>95209521<function id="SetExtensionEventCallback" phase="onload" num="126">9522<synopsis>Set Extension Event Callback</synopsis>95239524<description>9525Sets the callback function for an extension event and9526enables the event. Or, if the callback is <code>NULL</code>, disables9527the event. Note that unlike standard events, setting9528the callback and enabling the event are a single operation.9529</description>9530<origin>new</origin>9531<capabilities>9532</capabilities>9533<parameters>9534<param id="extension_event_index">9535<jint/>9536<description>9537Identifies which callback to set.9538This index is the9539<fieldlink id="extension_event_index" struct="jvmtiExtensionEventInfo"></fieldlink>9540field of9541<datalink id="jvmtiExtensionEventInfo"/>.9542</description>9543</param>9544<param id="callback">9545<ptrtype>9546<struct>jvmtiExtensionEvent</struct>9547<nullok>disable the event</nullok>9548</ptrtype>9549<description>9550If <code>callback</code> is non-<code>NULL</code>,9551set <code>callback</code> to be the event callback function9552and enable the event.9553</description>9554</param>9555</parameters>9556<errors>9557<error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">9558<paramlink id="extension_event_index"/> is not an9559<fieldlink id="extension_event_index"9560struct="jvmtiExtensionEventInfo"/>9561returned by9562<functionlink id="GetExtensionEvents"/>9563</error>9564</errors>9565</function>95669567</category>95689569<category id="capability" label="Capability">95709571<intro>9572The capabilities functions allow you to change the9573functionality available to <jvmti/>--that is,9574which <jvmti/>9575functions can be called, what events can be generated,9576and what functionality these events and functions can9577provide.9578<p/>9579The "Capabilities" section of each function and event describe which9580capabilities, if any, they are associated with. "Required Functionality"9581means it is available for use and no capabilities must be added to use it.9582"Optional Functionality" means the agent must possess the capability9583before it can be used.9584To possess a capability, the agent must9585<functionlink id="AddCapabilities">add the capability</functionlink>.9586"Optional Features" describe capabilities which,9587if added, extend the feature set.9588<p/>9589The potentially available capabilities of each <jvmti/> implementation are different.9590Depending on the implementation, a capability:9591<ul>9592<li>may never be added</li>9593<li>may be added in either the <code>OnLoad</code> or live phase in any environment</li>9594<li>may be added only during the <code>OnLoad</code> phase</li>9595<li>may be possessed by only one environment at a time</li>9596<li>may be possessed by only one environment at a time,9597and only during the <code>OnLoad</code> phase</li>9598<li>and so on ...</li>9599</ul>9600Frequently, the addition of a capability may incur a cost in execution speed, start up9601time, and/or memory footprint. Note that the overhead of using a capability9602is completely different than the overhead of possessing a capability.9603Take single stepping as an example. When single stepping is on (that9604is, when the event is enabled and thus actively sending events)9605the overhead of sending and processing an event9606on each instruction is huge in any implementation.9607However, the overhead of possessing the capability may be small or large,9608depending on the implementation. Also, when and if a capability is potentially9609available depends on the implementation. Some examples:9610<ul>9611<li>One VM might perform all execution by compiling bytecodes into9612native code and be unable to generate single step instructions.9613In this implementation the capability can not be added.</li>9614<li>Another VM may be able to switch execution to a single stepping9615interpreter at any time. In this implementation, having the capability has no9616overhead and could be added at any time.</li>9617<li>Yet another VM might be able to choose a bytecode compiling or single stepping capable interpreted9618execution engine at start up, but be unable to switch between them.9619In this implementation the capability would need to be added9620during the <code>OnLoad</code> phase (before bytecode9621execution begins) and would have a large impact on execution speed9622even if single stepping was never used.</li>9623<li>Still another VM might be able to add an "is single stepping on" check9624into compiled bytecodes or a generated interpreter. Again in this implementation9625the capability would need to be added during the <code>OnLoad</code> phase but the overhead (a test9626and branch on each instruction) would be considerably less.</li>9627</ul>9628<p/>9629Each <jvmti/> <internallink id="environments">environment</internallink>9630has its own set of capabilities.9631Initially, that set is empty.9632Any desired capability must be added.9633If possible, capabilities should be added during the <code>OnLoad</code> phase. For most9634virtual machines certain capabilities require special set up for9635the virtual machine and this set up must happen9636during the <code>OnLoad</code> phase, before the virtual machine begins execution.9637Once a capability is added, it can9638only be removed if explicitly relinquished by the environment.9639<p/>9640The agent can,9641<functionlink id="GetPotentialCapabilities">determine what9642capabilities this VM can potentially provide</functionlink>,9643<functionlink id="AddCapabilities">add the capabilities9644to be used</functionlink>,9645<functionlink id="RelinquishCapabilities">release capabilities9646which are no longer needed</functionlink>, and9647<functionlink id="GetCapabilities">examine the currently available9648capabilities</functionlink>.9649</intro>96509651<intro id="capabilityExamples" label="Capability Examples">9652For example, a freshly started agent (in the <code>OnLoad</code> function)9653wants to enable all possible capabilities.9654Note that, in general, this is not advisable as the agent may suffer9655a performance penalty for functionality it is not using.9656The code might look like this in C:9657<example>9658jvmtiCapabilities capa;9659jvmtiError err;96609661err = (*jvmti)->GetPotentialCapabilities(jvmti, &capa);9662if (err == JVMTI_ERROR_NONE) {9663err = (*jvmti)->AddCapabilities(jvmti, &capa);9664</example>9665For example, if an agent wants to check if it can get9666the bytecodes of a method (that is, it wants to check9667if it previously added this capability and has not9668relinquished it), the code might9669look like this in C:9670<example>9671jvmtiCapabilities capa;9672jvmtiError err;96739674err = (*jvmti)->GetCapabilities(jvmti, &capa);9675if (err == JVMTI_ERROR_NONE) {9676if (capa.can_get_bytecodes) { ... } }9677</example>9678</intro>96799680<capabilitiestypedef id="jvmtiCapabilities" label="The Capabilities Structure">9681<description>9682The functions in this category use this capabilities structure9683which contains boolean flags corresponding to each capability:9684</description>9685<capabilityfield id="can_tag_objects">9686<description>9687Can set and get tags, as described in the9688<internallink id="Heap">Heap category</internallink>.9689</description>9690</capabilityfield>9691<capabilityfield id="can_generate_field_modification_events">9692<description>9693Can set watchpoints on field modification -9694<functionlink id="SetFieldModificationWatch"></functionlink>9695</description>9696</capabilityfield>9697<capabilityfield id="can_generate_field_access_events">9698<description>9699Can set watchpoints on field access -9700<functionlink id="SetFieldAccessWatch"></functionlink>9701</description>9702</capabilityfield>9703<capabilityfield id="can_get_bytecodes">9704<description>9705Can get bytecodes of a method <functionlink id="GetBytecodes"></functionlink>9706</description>9707</capabilityfield>9708<capabilityfield id="can_get_synthetic_attribute">9709<description>9710Can test if a field or method is synthetic -9711<functionlink id="IsFieldSynthetic"></functionlink> and9712<functionlink id="IsMethodSynthetic"></functionlink>9713</description>9714</capabilityfield>9715<capabilityfield id="can_get_owned_monitor_info">9716<description>9717Can get information about ownership of monitors -9718<functionlink id="GetOwnedMonitorInfo"></functionlink>9719</description>9720</capabilityfield>9721<capabilityfield id="can_get_current_contended_monitor">9722<description>9723Can <functionlink id="GetCurrentContendedMonitor"></functionlink>9724</description>9725</capabilityfield>9726<capabilityfield id="can_get_monitor_info">9727<description>9728Can <functionlink id="GetObjectMonitorUsage"></functionlink>9729</description>9730</capabilityfield>9731<capabilityfield id="can_pop_frame">9732<description>9733Can pop frames off the stack - <functionlink id="PopFrame"></functionlink>9734</description>9735</capabilityfield>9736<capabilityfield id="can_redefine_classes">9737<description>9738Can redefine classes with <functionlink id="RedefineClasses"/>.9739</description>9740</capabilityfield>9741<capabilityfield id="can_signal_thread">9742<description>9743Can send stop or interrupt to threads9744</description>9745</capabilityfield>9746<capabilityfield id="can_get_source_file_name">9747<description>9748Can get the source file name of a class9749</description>9750</capabilityfield>9751<capabilityfield id="can_get_line_numbers">9752<description>9753Can get the line number table of a method9754</description>9755</capabilityfield>9756<capabilityfield id="can_get_source_debug_extension">9757<description>9758Can get the source debug extension of a class9759</description>9760</capabilityfield>9761<capabilityfield id="can_access_local_variables">9762<description>9763Can set and get local variables9764</description>9765</capabilityfield>9766<capabilityfield id="can_maintain_original_method_order">9767<description>9768Can return methods in the order they occur in the class file9769</description>9770</capabilityfield>9771<capabilityfield id="can_generate_single_step_events">9772<description>9773Can get <eventlink id="SingleStep">single step</eventlink> events9774</description>9775</capabilityfield>9776<capabilityfield id="can_generate_exception_events">9777<description>9778Can get <eventlink id="Exception">exception thrown</eventlink> and9779<eventlink id="ExceptionCatch">exception catch</eventlink> events9780</description>9781</capabilityfield>9782<capabilityfield id="can_generate_frame_pop_events">9783<description>9784Can <functionlink id="NotifyFramePop">set</functionlink> and thus get9785<eventlink id="FramePop"></eventlink> events9786</description>9787</capabilityfield>9788<capabilityfield id="can_generate_breakpoint_events">9789<description>9790Can <functionlink id="SetBreakpoint">set</functionlink> and thus get9791<eventlink id="Breakpoint"></eventlink> events9792</description>9793</capabilityfield>9794<capabilityfield id="can_suspend">9795<description>9796Can suspend and resume threads9797</description>9798</capabilityfield>9799<capabilityfield id="can_redefine_any_class">9800<description>9801Can modify (retransform or redefine) any non-primitive non-array class.9802See <functionlink id="IsModifiableClass"/>.9803</description>9804</capabilityfield>9805<capabilityfield id="can_get_current_thread_cpu_time">9806<description>9807Can <functionlink id="GetCurrentThreadCpuTime">get</functionlink>9808current thread CPU time9809</description>9810</capabilityfield>9811<capabilityfield id="can_get_thread_cpu_time">9812<description>9813Can <functionlink id="GetThreadCpuTime">get</functionlink>9814thread CPU time9815</description>9816</capabilityfield>9817<capabilityfield id="can_generate_method_entry_events"9818disp1="can_generate" disp2="_method_entry_events"9819>9820<description>9821Can generate method entry events on entering a method9822</description>9823</capabilityfield>9824<capabilityfield id="can_generate_method_exit_events"9825disp1="can_generate" disp2="_method_exit_events"9826>9827<description>9828Can generate method exit events on leaving a method9829</description>9830</capabilityfield>9831<capabilityfield id="can_generate_all_class_hook_events"9832disp1="can_generate" disp2="_all_class_hook_events"9833>9834<description>9835Can generate ClassFileLoadHook events for every loaded class.9836</description>9837</capabilityfield>9838<capabilityfield id="can_generate_compiled_method_load_events"9839disp1="can_generate" disp2="_compiled_method_load_events"9840>9841<description>9842Can generate events when a method is compiled or unloaded9843</description>9844</capabilityfield>9845<capabilityfield id="can_generate_monitor_events"9846disp1="can_generate" disp2="_monitor_events"9847>9848<description>9849Can generate events on monitor activity9850</description>9851</capabilityfield>9852<capabilityfield id="can_generate_vm_object_alloc_events"9853disp1="can_generate" disp2="_vm_object_alloc_events"9854>9855<description>9856Can generate events on VM allocation of an object9857</description>9858</capabilityfield>9859<capabilityfield id="can_generate_native_method_bind_events"9860disp1="can_generate" disp2="_native_method_bind_events"9861>9862<description>9863Can generate events when a native method is bound to its9864implementation9865</description>9866</capabilityfield>9867<capabilityfield id="can_generate_garbage_collection_events"9868disp1="can_generate" disp2="_garbage_collection_events"9869>9870<description>9871Can generate events when garbage collection begins or ends9872</description>9873</capabilityfield>9874<capabilityfield id="can_generate_object_free_events"9875disp1="can_generate" disp2="_object_free_events"9876>9877<description>9878Can generate events when the garbage collector frees an object9879</description>9880</capabilityfield>9881<capabilityfield id="can_force_early_return" since="1.1">9882<description>9883Can return early from a method, as described in the9884<internallink id="ForceEarlyReturn">Force Early Return category</internallink>.9885</description>9886</capabilityfield>9887<capabilityfield id="can_get_owned_monitor_stack_depth_info" since="1.1">9888<description>9889Can get information about owned monitors with stack depth -9890<functionlink id="GetOwnedMonitorStackDepthInfo"></functionlink>9891</description>9892</capabilityfield>9893<capabilityfield id="can_get_constant_pool" since="1.1">9894<description>9895Can get the constant pool of a class -9896<functionlink id="GetConstantPool"></functionlink>9897</description>9898</capabilityfield>9899<capabilityfield id="can_set_native_method_prefix" since="1.1">9900<description>9901Can set prefix to be applied when native method cannot be resolved -9902<functionlink id="SetNativeMethodPrefix"/> and9903<functionlink id="SetNativeMethodPrefixes"/>9904</description>9905</capabilityfield>9906<capabilityfield id="can_retransform_classes" since="1.1">9907<description>9908Can retransform classes with <functionlink id="RetransformClasses"/>.9909In addition to the restrictions imposed by the specific9910implementation on this capability (see the9911<internallink id="capability">Capability</internallink> section),9912this capability must be set before the9913<eventlink id="ClassFileLoadHook"/> event is enabled for the9914first time in this environment.9915An environment that possesses this capability at the time that9916<code>ClassFileLoadHook</code> is enabled for the first time is9917said to be <i>retransformation capable</i>.9918An environment that does not possess this capability at the time that9919<code>ClassFileLoadHook</code> is enabled for the first time is9920said to be <i>retransformation incapable</i>.9921</description>9922</capabilityfield>9923<capabilityfield id="can_retransform_any_class" since="1.1">9924<description>9925<functionlink id="RetransformClasses"/> can be called on any class9926(<fieldlink id="can_retransform_classes" struct="jvmtiCapabilities"/>9927must also be set)9928</description>9929</capabilityfield>9930<capabilityfield id="can_generate_resource_exhaustion_heap_events" since="1.1">9931<description>9932Can generate events when the VM is unable to allocate memory from9933the <tm>Java</tm> platform heap.9934See <eventlink id="ResourceExhausted"/>.9935</description>9936</capabilityfield>9937<capabilityfield id="can_generate_resource_exhaustion_threads_events" since="1.1">9938<description>9939Can generate events when the VM is unable to create a thread.9940See <eventlink id="ResourceExhausted"/>.9941</description>9942</capabilityfield>9943</capabilitiestypedef>99449945<function id="GetPotentialCapabilities" jkernel="yes" phase="onload" num="140">9946<synopsis>Get Potential Capabilities</synopsis>9947<description>9948Returns via <paramlink id="capabilities_ptr"></paramlink> the <jvmti/>9949features that can potentially be possessed by this environment9950at this time.9951The returned capabilities differ from the complete set of capabilities9952implemented by the VM in two cases: another environment possesses9953capabilities that can only be possessed by one environment, or the9954current <functionlink id="GetPhase">phase</functionlink> is live,9955and certain capabilities can only be added during the <code>OnLoad</code> phase.9956The <functionlink id="AddCapabilities"></functionlink> function9957may be used to set any or all or these capabilities.9958Currently possessed capabilities are included.9959<p/>9960Typically this function is used in the <code>OnLoad</code> function.9961Some virtual machines may allow a limited set of capabilities to be9962added in the live phase.9963In this case, the set of potentially available capabilities9964will likely differ from the <code>OnLoad</code> phase set.9965<p/>9966See the9967<internallink id="capabilityExamples">Capability Examples</internallink>.9968</description>9969<origin>new</origin>9970<capabilities>9971</capabilities>9972<parameters>9973<param id="capabilities_ptr">9974<outptr><struct>jvmtiCapabilities</struct></outptr>9975<description>9976On return, points to the <jvmti/> capabilities that may be added.9977</description>9978</param>9979</parameters>9980<errors>9981</errors>9982</function>99839984<elide>9985<function id="EstimateCostOfCapabilities" phase="onload" num="141">9986<synopsis>Estimate Cost Of Capabilities</synopsis>9987<description>9988<issue>There is strong opposition to this function. The concern is9989that it would be difficult or impossible to provide meaningful9990numbers, as the amount of impact is conditional on many factors9991that a single number could not represent. There is doubt that9992conditional implementations would be used or are even a good idea.9993The thought is that release documentation for the implementation9994would be the best means of exposing this information.9995Unless new arguments are presented, I intend to remove this9996function in the next revision.9997</issue>9998<p/>9999Return via the <paramlink id="time_impact_ptr"></paramlink> and10000<paramlink id="space_impact_ptr"></paramlink> an estimate of the impact10001of adding the capabilities pointed to by10002<paramlink id="capabilities_ptr"></paramlink>.10003The returned estimates are in percentage of additional overhead, thus10004a time impact of 100 mean the application might run10005at half the speed.10006The estimates are very rough approximations and are not guaranteed.10007Note also, that the estimates are of the impact of having the10008capability available--when and if it is used the impact may be10009much greater.10010Estimates can be for a single capability or for a set of10011capabilities. Note that the costs are not necessarily additive,10012adding support for one capability might make another available10013for free or conversely having two capabilities at once may10014have multiplicative impact.10015Estimates are relative to the current set of capabilities -10016that is, how much more impact given the currently possessed capabilities.10017<p/>10018Typically this function is used in the OnLoad function,10019some virtual machines may allow a limited set of capabilities to be10020added in the live phase.10021In this case, the set of potentially available capabilities10022will likely differ from the OnLoad phase set.10023<p/>10024See the10025<internallink id="capabilityExamples">Capability Examples</internallink>.10026</description>10027<origin>new</origin>10028<capabilities>10029</capabilities>10030<parameters>10031<param id="capabilities_ptr">10032<inptr><struct>jvmtiCapabilities</struct></inptr>10033<description>10034points to the <jvmti/> capabilities to evaluate.10035</description>10036</param>10037<param id="time_impact_ptr">10038<outptr><jint/></outptr>10039<description>10040On return, points to the estimated percentage increase in10041run time if this capability was added.10042</description>10043</param>10044<param id="space_impact_ptr">10045<outptr><jint/></outptr>10046<description>10047On return, points to the estimated percentage increase in10048memory space used if this capability was added.10049</description>10050</param>10051</parameters>10052<errors>10053<error id="JVMTI_ERROR_NOT_AVAILABLE">10054The desired capabilities are not even potentially available.10055</error>10056</errors>10057</function>10058</elide>1005910060<function id="AddCapabilities" jkernel="yes" phase="onload" num="142">10061<synopsis>Add Capabilities</synopsis>10062<description>10063Set new capabilities by adding the capabilities10064whose values are set to one (<code>1</code>) in10065<code>*</code><paramlink id="capabilities_ptr"></paramlink>.10066All previous capabilities are retained.10067Typically this function is used in the <code>OnLoad</code> function.10068Some virtual machines may allow a limited set of capabilities to be10069added in the live phase.10070<p/>10071See the10072<internallink id="capabilityExamples">Capability Examples</internallink>.10073</description>10074<origin>new</origin>10075<capabilities>10076</capabilities>10077<parameters>10078<param id="capabilities_ptr">10079<inptr><struct>jvmtiCapabilities</struct></inptr>10080<description>10081Points to the <jvmti/> capabilities to add.10082</description>10083</param>10084</parameters>10085<errors>10086<error id="JVMTI_ERROR_NOT_AVAILABLE">10087The desired capabilities are not even potentially available.10088</error>10089</errors>10090</function>100911009210093<function id="RelinquishCapabilities" phase="onload" num="143">10094<synopsis>Relinquish Capabilities</synopsis>10095<description>10096Relinquish the capabilities10097whose values are set to one (<code>1</code>) in10098<code>*</code><paramlink id="capabilities_ptr"></paramlink>.10099Some implementations may allow only one environment to have a capability10100(see the <internallink id="capability">capability introduction</internallink>).10101This function releases capabilities10102so that they may be used by other agents.10103All other capabilities are retained.10104The capability will no longer be present in <functionlink id="GetCapabilities"></functionlink>.10105Attempting to relinquish a capability that the agent does not possess is not an error.10106<issue>10107It is possible for the agent to be actively using capabilities10108which are being relinquished. For example, a thread is currently10109suspended and can_suspend is being relinquished or an event is currently10110enabled and can_generate_whatever is being relinquished.10111There are three possible ways we could spec this:10112<ul>10113<li>relinquish automatically releases them</li>10114<li>relinquish checks and returns some error code if held</li>10115<li>it is the agent's responsibility and it is not checked</li>10116</ul>10117One of these should be chosen.10118</issue>10119</description>10120<origin>new</origin>10121<capabilities>10122</capabilities>10123<parameters>10124<param id="capabilities_ptr">10125<inptr><struct>jvmtiCapabilities</struct></inptr>10126<description>10127Points to the <jvmti/> capabilities to relinquish.10128</description>10129</param>10130</parameters>10131<errors>10132</errors>10133</function>10134101351013610137<function id="GetCapabilities" jkernel="yes" phase="any" num="89">10138<synopsis>Get Capabilities</synopsis>10139<description>10140Returns via <paramlink id="capabilities_ptr"></paramlink> the optional <jvmti/>10141features which this environment currently possesses.10142Each possessed capability is indicated by a one (<code>1</code>) in the10143corresponding field of the <internallink id="jvmtiCapabilities">capabilities10144structure</internallink>.10145An environment does not possess a capability unless it has been successfully added with10146<functionlink id="AddCapabilities"/>.10147An environment only loses possession of a capability if it has been relinquished with10148<functionlink id="RelinquishCapabilities"/>. Thus, this function returns the net result10149of the <code>AddCapabilities</code> and <code>RelinquishCapabilities</code> calls which10150have been made.10151<p/>10152See the10153<internallink id="capabilityExamples">Capability Examples</internallink>.10154</description>10155<origin>jvmdiClone</origin>10156<capabilities>10157</capabilities>10158<parameters>10159<param id="capabilities_ptr">10160<outptr><struct>jvmtiCapabilities</struct></outptr>10161<description>10162On return, points to the <jvmti/> capabilities.10163</description>10164</param>10165</parameters>10166<errors>10167</errors>10168</function>1016910170</category>101711017210173<category id="timers" label="Timers">1017410175<intro>10176These functions provide timing information.10177The resolution at which the time is updated is not specified.10178They provides nanosecond precision, but not necessarily nanosecond accuracy.10179Details about the timers, such as their maximum values, can be accessed with10180the timer information functions.10181</intro>1018210183<typedef id="jvmtiTimerInfo" label="Timer Info">10184<description>10185The information function for each timer returns this data structure.10186</description>10187<field id="max_value">10188<jlong/>10189<description>10190The maximum value the timer can reach.10191After this value is reached the timer wraps back to zero.10192This is an unsigned value. If tested or printed as a jlong (signed value)10193it may appear to be a negative number.10194</description>10195</field>10196<field id="may_skip_forward">10197<jboolean/>10198<description>10199If true, the timer can be externally adjusted and as a result skip forward.10200If false, the timer value will never increase faster than real time.10201</description>10202</field>10203<field id="may_skip_backward">10204<jboolean/>10205<description>10206If true, the timer can be externally adjusted and as a result skip backward.10207If false, the timer value will be monotonically increasing.10208</description>10209</field>10210<field id="kind">10211<enum>jvmtiTimerKind</enum>10212<description>10213The kind of timer.10214On a platform that does not distinguish between user and system time, <datalink10215id="JVMTI_TIMER_TOTAL_CPU"><code>JVMTI_TIMER_TOTAL_CPU</code></datalink>10216is returned.10217</description>10218</field>10219<field id="reserved1">10220<jlong/>10221<description>10222Reserved for future use.10223</description>10224</field>10225<field id="reserved2">10226<jlong/>10227<description>10228Reserved for future use.10229</description>10230</field>10231</typedef>1023210233<intro>10234Where the timer kind is --1023510236<constants id="jvmtiTimerKind" label="Timer Kinds" kind="enum">10237<constant id="JVMTI_TIMER_USER_CPU" num="30">10238CPU time that a thread is in user mode.10239</constant>10240<constant id="JVMTI_TIMER_TOTAL_CPU" num="31">10241CPU time that a thread is in user or system mode.10242</constant>10243<constant id="JVMTI_TIMER_ELAPSED" num="32">10244Elapsed time.10245</constant>10246</constants>10247</intro>1024810249<function id="GetCurrentThreadCpuTimerInfo" callbacksafe="safe" impl="innative notrace" phase="start" num="134">10250<synopsis>Get Current Thread CPU Timer Information</synopsis>10251<description>10252Get information about the10253<functionlink id="GetCurrentThreadCpuTime"/> timer.10254The fields of the <datalink id="jvmtiTimerInfo"/> structure10255are filled in with details about the timer.10256This information is specific to the platform and the implementation of10257<functionlink id="GetCurrentThreadCpuTime"/> and thus10258does not vary by thread nor does it vary10259during a particular invocation of the VM.10260<p/>10261Note that the implementations of <functionlink id="GetCurrentThreadCpuTime"/>10262and <functionlink id="GetThreadCpuTime"/> may differ, and thus the values10263returned by <code>GetCurrentThreadCpuTimerInfo</code>10264and <functionlink id="GetThreadCpuTimerInfo"/>10265may differ -- see <functionlink id="GetCurrentThreadCpuTime"/> for more information.10266</description>10267<origin>new</origin>10268<capabilities>10269<required id="can_get_current_thread_cpu_time">10270Can get current thread CPU time.10271</required>10272</capabilities>10273<parameters>10274<param id="info_ptr">10275<outptr><struct>jvmtiTimerInfo</struct></outptr>10276<description>10277On return, filled with information describing the time10278returned by <functionlink id="GetCurrentThreadCpuTime"/>.10279</description>10280</param>10281</parameters>10282<errors>10283</errors>10284</function>1028510286<function id="GetCurrentThreadCpuTime" callbacksafe="safe" impl="innative notrace" phase="start" num="135">10287<synopsis>Get Current Thread CPU Time</synopsis>10288<description>10289Return the CPU time utilized by the current thread.10290<p/>10291Note that the <functionlink id="GetThreadCpuTime"/>10292function provides CPU time for any thread, including10293the current thread. <code>GetCurrentThreadCpuTime</code>10294exists to support platforms which cannot10295supply CPU time for threads other than the current10296thread or which have more accurate information for10297the current thread (see10298<functionlink id="GetCurrentThreadCpuTimerInfo"/> vs10299<functionlink id="GetThreadCpuTimerInfo"/>).10300On many platforms this call will be equivalent to:10301<example>10302GetThreadCpuTime(env, NULL, nanos_ptr)10303</example>10304</description>10305<origin>new</origin>10306<capabilities>10307<required id="can_get_current_thread_cpu_time">10308Can get current thread CPU time.10309<p/>10310If this capability is enabled after threads have started,10311the implementation may choose any time up10312to and including the time that the capability is enabled10313as the point where CPU time collection starts.10314<p/>10315This capability must be potentially available on any10316platform where10317<internallink id="jvmtiCapabilities.can_get_thread_cpu_time"><code>can_get_thread_cpu_time</code></internallink>10318is potentially available.10319</required>10320</capabilities>10321<parameters>10322<param id="nanos_ptr">10323<outptr><jlong/></outptr>10324<description>10325On return, points to the CPU time used by this thread10326in nanoseconds.10327This is an unsigned value. If tested or printed as a jlong (signed value)10328it may appear to be a negative number.10329</description>10330</param>10331</parameters>10332<errors>10333</errors>10334</function>1033510336<function id="GetThreadCpuTimerInfo" num="136">10337<synopsis>Get Thread CPU Timer Information</synopsis>10338<description>10339Get information about the10340<functionlink id="GetThreadCpuTime"/> timer.10341The fields of the <datalink id="jvmtiTimerInfo"/> structure10342are filled in with details about the timer.10343This information is specific to the platform and the implementation of10344<functionlink id="GetThreadCpuTime"/> and thus10345does not vary by thread nor does it vary10346during a particular invocation of the VM.10347<p/>10348Note that the implementations of <functionlink id="GetCurrentThreadCpuTime"/>10349and <functionlink id="GetThreadCpuTime"/> may differ, and thus the values10350returned by <functionlink id="GetCurrentThreadCpuTimerInfo"/>10351and <code>GetThreadCpuTimerInfo</code>10352may differ -- see <functionlink id="GetCurrentThreadCpuTime"/> for more information.10353</description>10354<origin>new</origin>10355<capabilities>10356<required id="can_get_thread_cpu_time">10357Can get thread CPU time.10358</required>10359</capabilities>10360<parameters>10361<param id="info_ptr">10362<outptr><struct>jvmtiTimerInfo</struct></outptr>10363<description>10364On return, filled with information describing the time10365returned by <functionlink id="GetThreadCpuTime"/>.10366</description>10367</param>10368</parameters>10369<errors>10370</errors>10371</function>1037210373<function id="GetThreadCpuTime" num="137">10374<synopsis>Get Thread CPU Time</synopsis>10375<description>10376Return the CPU time utilized by the specified thread.10377<p/>10378Get information about this timer with10379<functionlink id="GetThreadCpuTimerInfo"/>.10380</description>10381<origin>new</origin>10382<capabilities>10383<required id="can_get_thread_cpu_time">10384Can get thread CPU time.10385<p/>10386If this capability is enabled after threads have started,10387the implementation may choose any time up10388to and including the time that the capability is enabled10389as the point where CPU time collection starts.10390</required>10391</capabilities>10392<parameters>10393<param id="thread">10394<jthread null="current"/>10395<description>10396The thread to query.10397</description>10398</param>10399<param id="nanos_ptr">10400<outptr><jlong/></outptr>10401<description>10402On return, points to the CPU time used by the specified thread10403in nanoseconds.10404This is an unsigned value. If tested or printed as a jlong (signed value)10405it may appear to be a negative number.10406</description>10407</param>10408</parameters>10409<errors>10410</errors>10411</function>1041210413<function id="GetTimerInfo" phase="any" callbacksafe="safe" num="138">10414<synopsis>Get Timer Information</synopsis>10415<description>10416Get information about the10417<functionlink id="GetTime"/> timer.10418The fields of the <datalink id="jvmtiTimerInfo"/> structure10419are filled in with details about the timer.10420This information will not change during a particular invocation of the VM.10421</description>10422<origin>new</origin>10423<capabilities>10424</capabilities>10425<parameters>10426<param id="info_ptr">10427<outptr><struct>jvmtiTimerInfo</struct></outptr>10428<description>10429On return, filled with information describing the time10430returned by <functionlink id="GetTime"/>.10431</description>10432</param>10433</parameters>10434<errors>10435</errors>10436</function>1043710438<function id="GetTime" phase="any" callbacksafe="safe" num="139">10439<synopsis>Get Time</synopsis>10440<description>10441Return the current value of the system timer, in nanoseconds.10442<p/>10443The value returned represents nanoseconds since some fixed but10444arbitrary time (perhaps in the future, so values may be10445negative). This function provides nanosecond precision, but not10446necessarily nanosecond accuracy. No guarantees are made about10447how frequently values change.10448<p/>10449Get information about this timer with10450<functionlink id="GetTimerInfo"/>.10451</description>10452<origin>new</origin>10453<capabilities>10454</capabilities>10455<parameters>10456<param id="nanos_ptr">10457<outptr><jlong/></outptr>10458<description>10459On return, points to the time in nanoseconds.10460This is an unsigned value. If tested or printed as a jlong (signed value)10461it may appear to be a negative number.10462</description>10463</param>10464</parameters>10465<errors>10466</errors>10467</function>1046810469<function id="GetAvailableProcessors" phase="any" num="144">10470<synopsis>Get Available Processors</synopsis>10471<description>10472Returns the number of processors available to the Java virtual machine.10473<p/>10474This value may change during a particular invocation of the virtual machine.10475Applications that are sensitive to the number of available processors should10476therefore occasionally poll this property.10477</description>10478<origin>new</origin>10479<capabilities>10480</capabilities>10481<parameters>10482<param id="processor_count_ptr">10483<outptr><jint/></outptr>10484<description>10485On return, points to the maximum number of processors available to the10486virtual machine; never smaller than one.10487</description>10488</param>10489</parameters>10490<errors>10491</errors>10492</function>1049310494</category>104951049610497<category id="classLoaderSearch" label="Class Loader Search">1049810499<intro>10500These functions allow the agent to add to the locations that a class loader searches for a class.10501This is useful for installing instrumentation under the correct class loader.10502</intro>1050310504<function id="AddToBootstrapClassLoaderSearch" jkernel="yes" phase="onload" num="149">10505<synopsis>Add To Bootstrap Class Loader Search</synopsis>10506<description>10507This function can be used to cause instrumentation classes to be defined by the10508bootstrap class loader. See <vmspec chapter="5.3.1"/>.10509After the bootstrap10510class loader unsuccessfully searches for a class, the specified platform-dependent10511search path <paramlink id="segment"/> will be searched as well. Only one segment may be specified in10512the <paramlink id="segment"/>. This function may be called multiple times to add multiple segments,10513the segments will be searched in the order that this function was called.10514<p/>10515In the <code>OnLoad</code> phase the function may be used to specify any platform-dependent10516search path segment to be searched after the bootstrap class loader unsuccessfully searches10517for a class. The segment is typically a directory or JAR file.10518<p/>10519In the live phase the <paramlink id="segment"/> may be used to specify any platform-dependent10520path to a <externallink id="http://docs.oracle.com/javase/7/docs/technotes/guides/jar/jar.html">10521JAR file</externallink>. The agent should take care that the JAR file does not10522contain any classes or resources other than those to be defined by the bootstrap10523class loader for the purposes of instrumentation.10524<p/>10525<vmspec/> specifies that a subsequent attempt to resolve a symbolic10526reference that the Java virtual machine has previously unsuccessfully attempted10527to resolve always fails with the same error that was thrown as a result of the10528initial resolution attempt. Consequently, if the JAR file contains an entry10529that corresponds to a class for which the Java virtual machine has10530unsuccessfully attempted to resolve a reference, then subsequent attempts to10531resolve that reference will fail with the same error as the initial attempt.10532</description>10533<origin>new</origin>10534<capabilities>10535</capabilities>10536<parameters>10537<param id="segment">10538<inbuf><char/></inbuf>10539<description>10540The platform-dependent search path segment, encoded as a10541<internallink id="mUTF">modified UTF-8</internallink> string.10542</description>10543</param>10544</parameters>10545<errors>10546<error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">10547<paramlink id="segment"/> is an invalid path. In the live phase, anything other than an10548existing JAR file is an invalid path.10549</error>10550</errors>10551</function>1055210553<function id="AddToSystemClassLoaderSearch" jkernel="yes" phase="onload" num="151" since="1.1">10554<synopsis>Add To System Class Loader Search</synopsis>10555<description>10556This function can be used to cause instrumentation classes to be10557defined by the system class loader. See <vmspec chapter="5.3.2"/>.10558After the class loader unsuccessfully searches for a class, the specified platform-dependent search10559path <paramlink id="segment"/> will be searched as well. Only one segment may be specified in the10560<paramlink id="segment"/>. This function may be called multiple times to add multiple segments, the10561segments will be searched in the order that this function was called.10562<p/>10563In the <code>OnLoad</code> phase the function may be used to specify any platform-dependent10564search path segment to be searched after the system class loader unsuccessfully searches10565for a class. The segment is typically a directory or JAR file.10566<p/>10567In the live phase the <paramlink id="segment"/> is a platform-dependent path to a <externallink10568id="http://docs.oracle.com/javase/7/docs/technotes/guides/jar/jar.html">JAR file</externallink> to be10569searched after the system class loader unsuccessfully searches for a class. The agent should10570take care that the JAR file does not contain any classes or resources other than those to be10571defined by the system class loader for the purposes of instrumentation.10572<p/>10573In the live phase the system class loader supports adding a JAR file to be searched if10574the system class loader implements a method name <code>appendToClassPathForInstrumentation</code>10575which takes a single parameter of type <code>java.lang.String</code>. The method is not required10576to have <code>public</code> access.10577<p/>10578<vmspec/> specifies that a subsequent attempt to resolve a symbolic10579reference that the Java virtual machine has previously unsuccessfully attempted10580to resolve always fails with the same error that was thrown as a result of the10581initial resolution attempt. Consequently, if the JAR file contains an entry10582that corresponds to a class for which the Java virtual machine has10583unsuccessfully attempted to resolve a reference, then subsequent attempts to10584resolve that reference will fail with the same error as the initial attempt.10585</description>10586<origin>new</origin>10587<capabilities>10588</capabilities>10589<parameters>10590<param id="segment">10591<inbuf><char/></inbuf>10592<description>10593The platform-dependent search path segment, encoded as a10594<internallink id="mUTF">modified UTF-8</internallink> string.10595</description>10596</param>10597</parameters>10598<errors>10599<error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">10600<paramlink id="segment"/> is an invalid path. In the live phase, anything other than an10601existing JAR file is an invalid path.10602</error>10603<error id="JVMTI_ERROR_CLASS_LOADER_UNSUPPORTED">10604Operation not supported by the system class loader.10605</error>10606</errors>10607</function>1060810609</category>106101061110612<category id="props" label="System Properties">1061310614<intro>10615These functions get and set system properties.10616</intro>1061710618<function id="GetSystemProperties" phase="onload" num="130">10619<synopsis>Get System Properties</synopsis>10620<description>10621The list of VM system property keys which may be used with10622<functionlink id="GetSystemProperty"/> is returned.10623It is strongly recommended that virtual machines provide the10624following property keys:10625<ul>10626<li><code>java.vm.vendor</code></li>10627<li><code>java.vm.version</code></li>10628<li><code>java.vm.name</code></li>10629<li><code>java.vm.info</code></li>10630<li><code>java.library.path</code></li>10631<li><code>java.class.path</code></li>10632</ul>10633Provides access to system properties defined by and used10634by the VM.10635Properties set on the command-line are included.10636This allows getting and setting of these properties10637before the VM even begins executing bytecodes.10638Since this is a VM view of system properties, the set of available10639properties will usually be different than that10640in <code>java.lang.System.getProperties</code>.10641JNI method invocation may be used to access10642<code>java.lang.System.getProperties</code>.10643<p/>10644The set of properties may grow during execution.10645</description>10646<origin>new</origin>10647<capabilities>10648</capabilities>10649<parameters>10650<param id="count_ptr">10651<outptr><jint/></outptr>10652<description>10653On return, points to the number of property keys returned.10654</description>10655</param>10656<param id="property_ptr">10657<allocallocbuf outcount="count_ptr"><char/></allocallocbuf>10658<description>10659On return, points to an array of property keys, encoded as10660<internallink id="mUTF">modified UTF-8</internallink> strings.10661</description>10662</param>10663</parameters>10664<errors>10665</errors>10666</function>1066710668<function id="GetSystemProperty" phase="onload" num="131">10669<synopsis>Get System Property</synopsis>10670<description>10671Return a VM system property value given the property key.10672<p/>10673The function <functionlink id="GetSystemProperties"/>10674returns the set of property keys which may be used.10675The properties which can be retrieved may grow during10676execution.10677<p/>10678Since this is a VM view of system properties, the values10679of properties may differ from that returned by10680<code>java.lang.System.getProperty(String)</code>.10681A typical VM might copy the values of the VM system10682properties into the <code>Properties</code> held by10683<code>java.lang.System</code> during the initialization10684of that class. Thereafter any changes to the VM system10685properties (with <functionlink id="SetSystemProperty"/>)10686or the <code>java.lang.System</code> system properties10687(with <code>java.lang.System.setProperty(String,String)</code>)10688would cause the values to diverge.10689JNI method invocation may be used to access10690<code>java.lang.System.getProperty(String)</code>.10691</description>10692<origin>new</origin>10693<capabilities>10694</capabilities>10695<parameters>10696<param id="property">10697<inbuf><char/></inbuf>10698<description>10699The key of the property to retrieve, encoded as a10700<internallink id="mUTF">modified UTF-8</internallink> string.10701</description>10702</param>10703<param id="value_ptr">10704<allocbuf><char/></allocbuf>10705<description>10706On return, points to the property value, encoded as a10707<internallink id="mUTF">modified UTF-8</internallink> string.10708</description>10709</param>10710</parameters>10711<errors>10712<error id="JVMTI_ERROR_NOT_AVAILABLE">10713This property is not available.10714Use <functionlink id="GetSystemProperties"/> to find available properties.10715</error>10716</errors>10717</function>1071810719<function id="SetSystemProperty" phase="onloadOnly" num="132">10720<synopsis>Set System Property</synopsis>10721<description>10722Set a VM system property value.10723<p/>10724The function <functionlink id="GetSystemProperties"/>10725returns the set of property keys, some of these may be settable.10726See <functionlink id="GetSystemProperty"/>.10727</description>10728<origin>new</origin>10729<capabilities>10730</capabilities>10731<parameters>10732<param id="property">10733<inbuf><char/></inbuf>10734<description>10735The key of the property, encoded as a10736<internallink id="mUTF">modified UTF-8</internallink> string.10737</description>10738</param>10739<param id="value_ptr">10740<inbuf>10741<char/>10742<nullok>10743do not set the value, but return <errorlink id="JVMTI_ERROR_NOT_AVAILABLE"/>10744if the property is not writeable10745</nullok>10746</inbuf>10747<description>10748The property value to set, encoded as a10749<internallink id="mUTF">modified UTF-8</internallink> string.10750</description>10751</param>10752</parameters>10753<errors>10754<error id="JVMTI_ERROR_NOT_AVAILABLE">10755This property is not available or is not writeable.10756</error>10757</errors>10758</function>1075910760</category>1076110762<category id="general" label="General">1076310764<intro>10765</intro>1076610767<function id="GetPhase" jkernel="yes" phase="any" num="133">10768<synopsis>Get Phase</synopsis>10769<description>10770Return the current phase of VM execution.10771The phases proceed in sequence:10772<constants id="jvmtiPhase" label="Phases of execution" kind="enum">10773<constant id="JVMTI_PHASE_ONLOAD" num="1">10774<code>OnLoad</code> phase: while in the10775<internallink id="onload"><code>Agent_OnLoad</code></internallink>10776or, for statically linked agents, the <internallink id="onload">10777<code>Agent_OnLoad_<agent-lib-name>10778</code></internallink> function.10779</constant>10780<constant id="JVMTI_PHASE_PRIMORDIAL" num="2">10781Primordial phase: between return from <code>Agent_OnLoad</code>10782or <code>Agent_OnLoad_<agent-lib-name></code> and the10783<code>VMStart</code> event.10784</constant>10785<constant id="JVMTI_PHASE_START" num="6">10786Start phase: when the <eventlink id="VMStart"><code>VMStart</code></eventlink> event10787is sent and until the <code>VMInit</code> event is sent.10788</constant>10789<constant id="JVMTI_PHASE_LIVE" num="4">10790Live phase: when the <eventlink id="VMInit"><code>VMInit</code></eventlink> event is sent10791and until the <eventlink id="VMDeath"></eventlink> event returns.10792</constant>10793<constant id="JVMTI_PHASE_DEAD" num="8">10794Dead phase: after the <eventlink id="VMDeath"></eventlink> event returns or after10795start-up failure.10796</constant>10797</constants>10798In the case of start-up failure the VM will proceed directly to the dead10799phase skipping intermediate phases and neither a <code>VMInit</code> nor10800<code>VMDeath</code> event will be sent.10801<p/>10802Most <jvmti/> functions operate only in the live phase.10803The following functions operate in either the <code>OnLoad</code> or live phases:10804<functionphaselist phase="onload"/>10805The following functions operate in only the <code>OnLoad</code> phase:10806<functionphaselist phase="onloadOnly"/>10807The following functions operate in the start or live phases:10808<functionphaselist phase="start"/>10809The following functions operate in any phase:10810<functionphaselist phase="any"/>10811JNI functions (except the Invocation API) must only be used in the start or live phases.10812<p/>10813Most <jvmti/> events are sent only in the live phase.10814The following events operate in others phases:10815<eventphaselist phase="start"/>10816<eventphaselist phase="any"/>10817</description>10818<origin>new</origin>10819<capabilities>10820</capabilities>10821<parameters>10822<param id="phase_ptr">10823<outptr><enum>jvmtiPhase</enum></outptr>10824<description>10825On return, points to the phase.10826</description>10827</param>10828</parameters>10829<errors>10830</errors>10831</function>1083210833<function id="DisposeEnvironment" jkernel="yes" phase="any" num="127">10834<synopsis>Dispose Environment</synopsis>10835<description>10836Shutdown a <jvmti/> connection created with JNI <code>GetEnv</code>10837(see <internallink id="environments"><jvmti/> Environments</internallink>).10838Dispose of any resources held by the environment.10839<issue>10840What resources are reclaimed? What is undone?10841Breakpoints,watchpoints removed?10842</issue>10843Threads suspended by this environment are not resumed by this call,10844this must be done explicitly by the agent.10845Memory allocated by this environment via calls to <jvmti/> functions10846is not released, this can be done explicitly by the agent10847by calling <functionlink id="Deallocate"/>.10848Raw monitors created by this environment are not destroyed,10849this can be done explicitly by the agent10850by calling <functionlink id="DestroyRawMonitor"/>.10851The state of threads waiting on raw monitors created by this environment10852are not affected.10853<p/>10854Any <functionlink id="SetNativeMethodPrefix">native method10855prefixes</functionlink> for this environment will be unset;10856the agent must remove any prefixed native methods before10857dispose is called.10858<p/>10859Any <internallink id="capability">capabilities</internallink>10860held by this environment are relinquished.10861<p/>10862Events enabled by this environment will no longer be sent, however10863event handlers currently running will continue to run. Caution must10864be exercised in the design of event handlers whose environment may10865be disposed and thus become invalid during their execution.10866<p/>10867This environment may not be used after this call.10868This call returns to the caller.10869</description>10870<origin>new</origin>10871<capabilities>10872</capabilities>10873<parameters>10874</parameters>10875<errors>10876</errors>10877</function>1087810879<function id="SetEnvironmentLocalStorage" jkernel="yes" phase="any" callbacksafe="safe" impl="innative notrace" num="148">10880<synopsis>Set Environment Local Storage</synopsis>10881<description>10882The VM stores a pointer value associated with each environment.10883This pointer value is called <i>environment-local storage</i>.10884This value is <code>NULL</code> unless set with this function.10885Agents can allocate memory in which they store environment specific10886information. By setting environment-local storage it can then be10887accessed with10888<functionlink id="GetEnvironmentLocalStorage"></functionlink>.10889<p/>10890Called by the agent to set the value of the <jvmti/>10891environment-local storage. <jvmti/> supplies to the agent a pointer-size10892environment-local storage that can be used to record per-environment10893information.10894</description>10895<origin>new</origin>10896<capabilities>10897</capabilities>10898<parameters>10899<param id="data">10900<inbuf>10901<void/>10902<nullok>value is set to <code>NULL</code></nullok>10903</inbuf>10904<description>10905The value to be entered into the environment-local storage.10906</description>10907</param>10908</parameters>10909<errors>10910</errors>10911</function>1091210913<function id="GetEnvironmentLocalStorage" jkernel="yes" phase="any" callbacksafe="safe" impl="innative notrace" num="147">10914<synopsis>Get Environment Local Storage</synopsis>10915<description>10916Called by the agent to get the value of the <jvmti/> environment-local10917storage.10918</description>10919<origin>new</origin>10920<capabilities>10921</capabilities>10922<parameters>10923<param id="data_ptr">10924<agentbuf><void/></agentbuf>10925<description>10926Pointer through which the value of the environment local10927storage is returned.10928If environment-local storage has not been set with10929<functionlink id="SetEnvironmentLocalStorage"></functionlink> returned10930pointer is <code>NULL</code>.10931</description>10932</param>10933</parameters>10934<errors>10935</errors>10936</function>1093710938<function id="GetVersionNumber" jkernel="yes" phase="any" num="88">10939<synopsis>Get Version Number</synopsis>10940<description>10941Return the <jvmti/> version via <code>version_ptr</code>.10942The return value is the version identifier.10943The version identifier includes major, minor and micro10944version as well as the interface type.10945<constants id="jvmtiVersionInterfaceTypes" label="Version Interface Types" kind="bits">10946<constant id="JVMTI_VERSION_INTERFACE_JNI" num="0x00000000">10947Value of <code>JVMTI_VERSION_MASK_INTERFACE_TYPE</code> for JNI.10948</constant>10949<constant id="JVMTI_VERSION_INTERFACE_JVMTI" num="0x30000000">10950Value of <code>JVMTI_VERSION_MASK_INTERFACE_TYPE</code> for <jvmti/>.10951</constant>10952</constants>10953<constants id="jvmtiVersionMasks" label="Version Masks" kind="bits">10954<constant id="JVMTI_VERSION_MASK_INTERFACE_TYPE" num="0x70000000">10955Mask to extract interface type.10956The value of the version returned by this function masked with10957<code>JVMTI_VERSION_MASK_INTERFACE_TYPE</code> is always10958<code>JVMTI_VERSION_INTERFACE_JVMTI</code>10959since this is a <jvmti/> function.10960</constant>10961<constant id="JVMTI_VERSION_MASK_MAJOR" num="0x0FFF0000">10962Mask to extract major version number.10963</constant>10964<constant id="JVMTI_VERSION_MASK_MINOR" num="0x0000FF00">10965Mask to extract minor version number.10966</constant>10967<constant id="JVMTI_VERSION_MASK_MICRO" num="0x000000FF">10968Mask to extract micro version number.10969</constant>10970</constants>10971<constants id="jvmtiVersionShifts" label="Version Shifts" kind="bits">10972<constant id="JVMTI_VERSION_SHIFT_MAJOR" num="16">10973Shift to extract major version number.10974</constant>10975<constant id="JVMTI_VERSION_SHIFT_MINOR" num="8">10976Shift to extract minor version number.10977</constant>10978<constant id="JVMTI_VERSION_SHIFT_MICRO" num="0">10979Shift to extract micro version number.10980</constant>10981</constants>10982</description>10983<origin>jvmdi</origin>10984<capabilities>10985</capabilities>10986<parameters>10987<param id="version_ptr">10988<outptr><jint/></outptr>10989<description>10990On return, points to the <jvmti/> version.10991</description>10992</param>10993</parameters>10994<errors>10995</errors>10996</function>109971099810999<function id="GetErrorName" phase="any" num="128">11000<synopsis>Get Error Name</synopsis>11001<description>11002Return the symbolic name for an11003<internallink id="ErrorSection">error code</internallink>.11004<p/>11005For example11006<code>GetErrorName(env, JVMTI_ERROR_NONE, &err_name)</code>11007would return in <code>err_name</code> the string11008<code>"JVMTI_ERROR_NONE"</code>.11009</description>11010<origin>new</origin>11011<capabilities>11012</capabilities>11013<parameters>11014<param id="error">11015<enum>jvmtiError</enum>11016<description>11017The error code.11018</description>11019</param>11020<param id="name_ptr">11021<allocbuf><char/></allocbuf>11022<description>11023On return, points to the error name.11024The name is encoded as a11025<internallink id="mUTF">modified UTF-8</internallink> string,11026but is restricted to the ASCII subset.11027</description>11028</param>11029</parameters>11030<errors>11031</errors>11032</function>1103311034<function id="SetVerboseFlag" phase="any" num="150">11035<synopsis>Set Verbose Flag</synopsis>11036<description>11037<constants id="jvmtiVerboseFlag" label="Verbose Flag Enumeration" kind="enum">11038<constant id="JVMTI_VERBOSE_OTHER" num="0">11039Verbose output other than the below.11040</constant>11041<constant id="JVMTI_VERBOSE_GC" num="1">11042Verbose garbage collector output, like that specified with <code>-verbose:gc</code>.11043</constant>11044<constant id="JVMTI_VERBOSE_CLASS" num="2">11045Verbose class loading output, like that specified with <code>-verbose:class</code>.11046</constant>11047<constant id="JVMTI_VERBOSE_JNI" num="4">11048Verbose JNI output, like that specified with <code>-verbose:jni</code>.11049</constant>11050</constants>11051Control verbose output.11052This is the output which typically is sent to <code>stderr</code>.11053</description>11054<origin>new</origin>11055<capabilities>11056</capabilities>11057<parameters>11058<param id="flag">11059<enum>jvmtiVerboseFlag</enum>11060<description>11061Which verbose flag to set.11062</description>11063</param>11064<param id="value">11065<jboolean/>11066<description>11067New value of the flag.11068</description>11069</param>11070</parameters>11071<errors>11072</errors>11073</function>110741107511076<function id="GetJLocationFormat" phase="any" num="129">11077<synopsis>Get JLocation Format</synopsis>11078<description>11079Although the greatest functionality is achieved with location information11080referencing the virtual machine bytecode index, the definition of11081<code>jlocation</code> has intentionally been left unconstrained to allow VM11082implementations that do not have this information.11083<p/>11084This function describes the representation of <code>jlocation</code> used in this VM.11085If the returned format is <datalink id="JVMTI_JLOCATION_JVMBCI"></datalink>,11086<code>jlocation</code>s can11087be used as in indices into the array returned by11088<functionlink id="GetBytecodes"></functionlink>.11089<constants id="jvmtiJlocationFormat" label="JLocation Format Enumeration" kind="enum">11090<constant id="JVMTI_JLOCATION_JVMBCI" num="1">11091<code>jlocation</code> values represent virtual machine11092bytecode indices--that is, offsets into the11093virtual machine code for a method.11094</constant>11095<constant id="JVMTI_JLOCATION_MACHINEPC" num="2">11096<code>jlocation</code> values represent native machine11097program counter values.11098</constant>11099<constant id="JVMTI_JLOCATION_OTHER" num="0">11100<code>jlocation</code> values have some other representation.11101</constant>11102</constants>11103</description>11104<origin>new</origin>11105<capabilities>11106</capabilities>11107<parameters>11108<param id="format_ptr">11109<outptr><enum>jvmtiJlocationFormat</enum></outptr>11110<description>11111On return, points to the format identifier for <code>jlocation</code> values.11112</description>11113</param>11114</parameters>11115<errors>11116</errors>11117</function>1111811119</category>1112011121</functionsection>1112211123<errorsection label="Error Reference">11124<intro>11125Every <jvmti/> function returns a <b><code>jvmtiError</code></b> error code.11126<p/>11127It is the responsibility of the agent to call <jvmti/> functions with11128valid parameters and in the proper context (calling thread is attached,11129phase is correct, etc.).11130Detecting some error conditions may be difficult, inefficient, or11131impossible for an implementation.11132The errors listed in11133<internallink id="reqerrors">Function Specific Required Errors</internallink>11134must be detected by the implementation.11135All other errors represent the recommended response to the error11136condition.11137</intro>1113811139<errorcategory id="universal-error" label="Universal Errors">11140<intro>11141The following errors may be returned by any function11142</intro>1114311144<errorid id="JVMTI_ERROR_NONE" num="0">11145No error has occurred. This is the error code that is returned11146on successful completion of the function.11147</errorid>11148<errorid id="JVMTI_ERROR_NULL_POINTER" num="100">11149Pointer is unexpectedly <code>NULL</code>.11150</errorid>11151<errorid id="JVMTI_ERROR_OUT_OF_MEMORY" num="110">11152The function attempted to allocate memory and no more memory was11153available for allocation.11154</errorid>11155<errorid id="JVMTI_ERROR_ACCESS_DENIED" num="111">11156The desired functionality has not been enabled in this virtual machine.11157</errorid>11158<errorid id="JVMTI_ERROR_UNATTACHED_THREAD" num="115">11159The thread being used to call this function is not attached11160to the virtual machine. Calls must be made from attached threads.11161See <code>AttachCurrentThread</code> in the JNI invocation API.11162</errorid>11163<errorid id="JVMTI_ERROR_INVALID_ENVIRONMENT" num="116">11164The <jvmti/> environment provided is no longer connected or is11165not an environment.11166</errorid>11167<errorid id="JVMTI_ERROR_WRONG_PHASE" num="112">11168The desired functionality is not available in the current11169<functionlink id="GetPhase">phase</functionlink>.11170Always returned if the virtual machine has completed running.11171</errorid>11172<errorid id="JVMTI_ERROR_INTERNAL" num="113">11173An unexpected internal error has occurred.11174</errorid>11175</errorcategory>1117611177<errorcategory id="reqerrors" label="Function Specific Required Errors">11178<intro>11179The following errors are returned by some <jvmti/> functions and must11180be returned by the implementation when the condition occurs.11181</intro>1118211183<errorid id="JVMTI_ERROR_INVALID_PRIORITY" num="12">11184Invalid priority.11185</errorid>11186<errorid id="JVMTI_ERROR_THREAD_NOT_SUSPENDED" num="13">11187Thread was not suspended.11188</errorid>11189<errorid id="JVMTI_ERROR_THREAD_SUSPENDED" num="14">11190Thread already suspended.11191</errorid>11192<errorid id="JVMTI_ERROR_THREAD_NOT_ALIVE" num="15">11193This operation requires the thread to be alive--that is,11194it must be started and not yet have died.11195</errorid>11196<errorid id="JVMTI_ERROR_CLASS_NOT_PREPARED" num="22">11197The class has been loaded but not yet prepared.11198</errorid>11199<errorid id="JVMTI_ERROR_NO_MORE_FRAMES" num="31">11200There are no Java programming language or JNI stack frames at the specified depth.11201</errorid>11202<errorid id="JVMTI_ERROR_OPAQUE_FRAME" num="32">11203Information about the frame is not available (e.g. for native frames).11204</errorid>11205<errorid id="JVMTI_ERROR_DUPLICATE" num="40">11206Item already set.11207</errorid>11208<errorid id="JVMTI_ERROR_NOT_FOUND" num="41">11209Desired element (e.g. field or breakpoint) not found11210</errorid>11211<errorid id="JVMTI_ERROR_NOT_MONITOR_OWNER" num="51">11212This thread doesn't own the raw monitor.11213</errorid>11214<errorid id="JVMTI_ERROR_INTERRUPT" num="52">11215The call has been interrupted before completion.11216</errorid>11217<errorid id="JVMTI_ERROR_UNMODIFIABLE_CLASS" num="79">11218The class cannot be modified.11219</errorid>11220<errorid id="JVMTI_ERROR_NOT_AVAILABLE" num="98">11221The functionality is not available in this virtual machine.11222</errorid>11223<errorid id="JVMTI_ERROR_ABSENT_INFORMATION" num="101">11224The requested information is not available.11225</errorid>11226<errorid id="JVMTI_ERROR_INVALID_EVENT_TYPE" num="102">11227The specified event type ID is not recognized.11228</errorid>11229<errorid id="JVMTI_ERROR_NATIVE_METHOD" num="104">11230The requested information is not available for native method.11231</errorid>11232<errorid id="JVMTI_ERROR_CLASS_LOADER_UNSUPPORTED" num="106">11233The class loader does not support this operation.11234</errorid>11235</errorcategory>1123611237<errorcategory id="function-specific-errors" label="Function Specific Agent Errors">11238<intro>11239The following errors are returned by some <jvmti/> functions.11240They are returned in the event of invalid parameters passed by the11241agent or usage in an invalid context.11242An implementation is not required to detect these errors.11243</intro>1124411245<errorid id="JVMTI_ERROR_INVALID_THREAD" num="10">11246The passed thread is not a valid thread.11247</errorid>11248<errorid id="JVMTI_ERROR_INVALID_FIELDID" num="25">11249Invalid field.11250</errorid>11251<errorid id="JVMTI_ERROR_INVALID_METHODID" num="23">11252Invalid method.11253</errorid>11254<errorid id="JVMTI_ERROR_INVALID_LOCATION" num="24">11255Invalid location.11256</errorid>11257<errorid id="JVMTI_ERROR_INVALID_OBJECT" num="20">11258Invalid object.11259</errorid>11260<errorid id="JVMTI_ERROR_INVALID_CLASS" num="21">11261Invalid class.11262</errorid>11263<errorid id="JVMTI_ERROR_TYPE_MISMATCH" num="34">11264The variable is not an appropriate type for the function used.11265</errorid>11266<errorid id="JVMTI_ERROR_INVALID_SLOT" num="35">11267Invalid slot.11268</errorid>11269<errorid id="JVMTI_ERROR_MUST_POSSESS_CAPABILITY" num="99">11270The capability being used is false in this environment.11271</errorid>11272<errorid id="JVMTI_ERROR_INVALID_THREAD_GROUP" num="11">11273Thread group invalid.11274</errorid>11275<errorid id="JVMTI_ERROR_INVALID_MONITOR" num="50">11276Invalid raw monitor.11277</errorid>11278<errorid id="JVMTI_ERROR_ILLEGAL_ARGUMENT" num="103">11279Illegal argument.11280</errorid>11281<errorid id="JVMTI_ERROR_INVALID_TYPESTATE" num="65">11282The state of the thread has been modified, and is now inconsistent.11283</errorid>11284<errorid id="JVMTI_ERROR_UNSUPPORTED_VERSION" num="68">11285A new class file has a version number not supported by this VM.11286</errorid>11287<errorid id="JVMTI_ERROR_INVALID_CLASS_FORMAT" num="60">11288A new class file is malformed (the VM would return a <code>ClassFormatError</code>).11289</errorid>11290<errorid id="JVMTI_ERROR_CIRCULAR_CLASS_DEFINITION" num="61">11291The new class file definitions would lead to a circular11292definition (the VM would return a <code>ClassCircularityError</code>).11293</errorid>11294<errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_ADDED" num="63">11295A new class file would require adding a method.11296</errorid>11297<errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED" num="64">11298A new class version changes a field.11299</errorid>11300<errorid id="JVMTI_ERROR_FAILS_VERIFICATION" num="62">11301The class bytes fail verification.11302</errorid>11303<errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED" num="66">11304A direct superclass is different for the new class11305version, or the set of directly implemented11306interfaces is different.11307</errorid>11308<errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_DELETED" num="67">11309A new class version does not declare a method11310declared in the old class version.11311</errorid>11312<errorid id="JVMTI_ERROR_NAMES_DONT_MATCH" num="69">11313The class name defined in the new class file is11314different from the name in the old class object.11315</errorid>11316<errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED" num="70">11317A new class version has different modifiers.11318</errorid>11319<errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED" num="71">11320A method in the new class version has different modifiers11321than its counterpart in the old class version.11322</errorid>11323</errorcategory>11324</errorsection>1132511326<eventsection label="Events">11327<intro label="Handling Events" id="eventIntro">11328Agents can be informed of many events that occur in application11329programs.11330<p/>11331To handle events, designate a set of callback functions with11332<functionlink id="SetEventCallbacks"></functionlink>.11333For each event the corresponding callback function will be11334called.11335Arguments to the callback function provide additional11336information about the event.11337<p/>11338The callback function is usually called from within an application11339thread. The <jvmti/> implementation does not11340queue events in any way. This means11341that event callback functions must be written11342carefully. Here are some general guidelines. See11343the individual event descriptions for further11344suggestions.11345<p/>11346<ul>11347<li>Any exception thrown during the execution of an event callback can11348overwrite any current pending exception in the current application thread.11349Care must be taken to preserve a pending exception11350when an event callback makes a JNI call that might generate an exception.11351</li>11352<li>Event callback functions must be re-entrant. The <jvmti/> implementation does11353not queue events. If an agent needs to process events one at a time, it11354can use a raw monitor inside the11355event callback functions to serialize event processing.11356</li>11357<li>Event callback functions that execute JNI's FindClass function to load11358classes need to note that FindClass locates the class loader associated11359with the current native method. For the purposes of class loading, an11360event callback that includes a JNI environment as a parameter to the11361callback will treated as if it is a native call, where the native method11362is in the class of the event thread's current frame.11363</li>11364</ul>11365<p/>11366Some <jvmti/> events identify objects with JNI references.11367All references11368in <jvmti/> events are JNI local references and will become invalid11369after the event callback returns.11370Unless stated otherwise, memory referenced by pointers sent in event11371callbacks may not be referenced after the event callback returns.11372<p/>11373Except where stated otherwise, events are delivered on the thread11374that caused the event.11375Events are sent at the time they occur.11376The specification for each event includes the set of11377<functionlink id="GetPhase">phases</functionlink> in which it can be sent;11378if an event triggering activity occurs during another phase, no event11379is sent.11380<p/>11381A thread that generates an event does not change its execution status11382(for example, the event does not cause the thread to be suspended).11383If an agent wishes the event to result in suspension, then the agent11384is responsible for explicitly suspending the thread with11385<functionlink id="SuspendThread"></functionlink>.11386<p/>11387If an event is enabled in multiple environments, the event will be sent11388to each agent in the order that the environments were created.11389</intro>1139011391<intro label="Enabling Events" id="enablingevents">11392All events are initially disabled. In order to receive any11393event:11394<ul>11395<li>11396If the event requires a capability, that capability must11397be added with11398<functionlink id="AddCapabilities"></functionlink>.11399</li>11400<li>11401A callback for the event must be set with11402<functionlink id="SetEventCallbacks"></functionlink>.11403</li>11404<li>11405The event must be enabled with11406<functionlink id="SetEventNotificationMode"></functionlink>.11407</li>11408</ul>11409</intro>1141011411<intro label="Multiple Co-located Events" id="eventorder">11412In many situations it is possible for multiple events to occur11413at the same location in one thread. When this happens, all the events11414are reported through the event callbacks in the order specified in this section.11415<p/>11416If the current location is at the entry point of a method, the11417<eventlink id="MethodEntry"></eventlink> event is reported before11418any other event at the current location in the same thread.11419<p/>11420If an exception catch has been detected at the current location,11421either because it is the beginning of a catch clause or a native method11422that cleared a pending exception has returned, the11423<code>exceptionCatch</code> event is reported before11424any other event at the current location in the same thread.11425<p/>11426If a <code>singleStep</code> event or11427<code>breakpoint</code> event is triggered at the11428current location, the event is defined to occur11429immediately before the code at the current location is executed.11430These events are reported before any events which are triggered11431by the execution of code at the current location in the same11432thread (specifically:11433<code>exception</code>,11434<code>fieldAccess</code>, and11435<code>fieldModification</code>).11436If both a step and breakpoint event are triggered for the same thread and11437location, the step event is reported before the breakpoint event.11438<p/>11439If the current location is the exit point of a method (that is, the last11440location before returning to the caller), the11441<eventlink id="MethodExit"></eventlink> event and11442the <eventlink id="FramePop"></eventlink> event (if requested)11443are reported after all other events at the current location in the same11444thread. There is no specified ordering of these two events11445with respect to each other.11446<p/>11447Co-located events can be triggered during the processing of some other11448event by the agent at the same location in the same thread.11449If such an event, of type <i>y</i>, is triggered during the processing of11450an event of type <i>x</i>, and if <i>x</i>11451precedes <i>y</i> in the ordering specified above, the co-located event11452<i>y</i> is reported for the current thread and location. If <i>x</i> does not precede11453<i>y</i>, <i>y</i> is not reported for the current thread and location.11454For example, if a breakpoint is set at the current location11455during the processing of <eventlink id="SingleStep"></eventlink>,11456that breakpoint will be reported before the thread moves off the current11457location.11458<p/>The following events are never considered to be co-located with11459other events.11460<ul>11461<li><eventlink id="VMStart"></eventlink></li>11462<li><eventlink id="VMInit"></eventlink></li>11463<li><eventlink id="VMDeath"></eventlink></li>11464<li><eventlink id="ThreadStart"></eventlink></li>11465<li><eventlink id="ThreadEnd"></eventlink></li>11466<li><eventlink id="ClassLoad"></eventlink></li>11467<li><eventlink id="ClassPrepare"></eventlink></li>11468</ul>11469</intro>1147011471<intro label="Event Callbacks" id="jvmtiEventCallbacks">11472The event callback structure below is used to specify the handler function11473for events. It is set with the11474<functionlink id="SetEventCallbacks"></functionlink> function.11475</intro>1147611477<event label="Single Step"11478id="SingleStep" const="JVMTI_EVENT_SINGLE_STEP" filtered="thread" num="60">11479<description>11480Single step events allow the agent to trace thread execution11481at the finest granularity allowed by the VM. A single step event is11482generated whenever a thread reaches a new location.11483Typically, single step events represent the completion of one VM11484instruction as defined in <vmspec/>. However, some implementations11485may define locations differently. In any case the11486<code>method</code> and <code>location</code>11487parameters uniquely identify the current location and allow11488the mapping to source file and line number when that information is11489available.11490<p/>11491No single step events are generated from within native methods.11492</description>11493<origin>jvmdi</origin>11494<capabilities>11495<required id="can_generate_single_step_events"></required>11496</capabilities>11497<parameters>11498<param id="jni_env">11499<outptr>11500<struct>JNIEnv</struct>11501</outptr>11502<description>11503The JNI environment of the event (current) thread11504</description>11505</param>11506<param id="thread">11507<jthread/>11508<description>11509Thread about to execution a new instruction11510</description>11511</param>11512<param id="klass">11513<jclass method="method"/>11514<description>11515Class of the method about to execute a new instruction11516</description>11517</param>11518<param id="method">11519<jmethodID class="klass"/>11520<description>11521Method about to execute a new instruction11522</description>11523</param>11524<param id="location">11525<jlocation/>11526<description>11527Location of the new instruction11528</description>11529</param>11530</parameters>11531</event>1153211533<event label="Breakpoint"11534id="Breakpoint" const="JVMTI_EVENT_BREAKPOINT" filtered="thread" num="62">11535<description>11536Breakpoint events are generated whenever a thread reaches a location11537designated as a breakpoint with <functionlink id="SetBreakpoint"></functionlink>.11538The <code>method</code> and <code>location</code>11539parameters uniquely identify the current location and allow11540the mapping to source file and line number when that information is11541available.11542</description>11543<origin>jvmdi</origin>11544<capabilities>11545<required id="can_generate_breakpoint_events"></required>11546</capabilities>11547<parameters>11548<param id="jni_env">11549<outptr>11550<struct>JNIEnv</struct>11551</outptr>11552<description>11553The JNI environment of the event (current) thread.11554</description>11555</param>11556<param id="thread">11557<jthread/>11558<description>11559Thread that hit the breakpoint11560</description>11561</param>11562<param id="klass">11563<jclass method="method"/>11564<description>11565Class of the method that hit the breakpoint11566</description>11567</param>11568<param id="method">11569<jmethodID class="klass"/>11570<description>11571Method that hit the breakpoint11572</description>11573</param>11574<param id="location">11575<jlocation/>11576<description>11577location of the breakpoint11578</description>11579</param>11580</parameters>11581</event>1158211583<event label="Field Access"11584id="FieldAccess" const="JVMTI_EVENT_FIELD_ACCESS" filtered="thread" num="63">11585<description>11586Field access events are generated whenever a thread accesses11587a field that was designated as a watchpoint11588with <functionlink id="SetFieldAccessWatch"></functionlink>.11589The <code>method</code> and <code>location</code>11590parameters uniquely identify the current location and allow11591the mapping to source file and line number when that information is11592available.11593</description>11594<origin>jvmdi</origin>11595<capabilities>11596<required id="can_generate_field_access_events"></required>11597</capabilities>11598<parameters>11599<param id="jni_env">11600<outptr>11601<struct>JNIEnv</struct>11602</outptr>11603<description>11604The JNI environment of the event (current) thread11605</description>11606</param>11607<param id="thread">11608<jthread/>11609<description>11610Thread accessing the field11611</description>11612</param>11613<param id="klass">11614<jclass method="method"/>11615<description>11616Class of the method where the access is occurring11617</description>11618</param>11619<param id="method">11620<jmethodID class="klass"/>11621<description>11622Method where the access is occurring11623</description>11624</param>11625<param id="location">11626<jlocation/>11627<description>11628Location where the access is occurring11629</description>11630</param>11631<param id="field_klass">11632<jclass field="field"/>11633<description>11634Class of the field being accessed11635</description>11636</param>11637<param id="object">11638<jobject/>11639<description>11640Object with the field being accessed if the field is an11641instance field; <code>NULL</code> otherwise11642</description>11643</param>11644<param id="field">11645<jfieldID class="field_klass"/>11646<description>11647Field being accessed11648</description>11649</param>11650</parameters>11651</event>1165211653<event label="Field Modification"11654id="FieldModification" const="JVMTI_EVENT_FIELD_MODIFICATION" filtered="thread" num="64">11655<description>11656Field modification events are generated whenever a thread modifies11657a field that was designated as a watchpoint11658with <functionlink id="SetFieldModificationWatch"></functionlink>.11659The <code>method</code> and <code>location</code>11660parameters uniquely identify the current location and allow11661the mapping to source file and line number when that information is11662available.11663</description>11664<origin>jvmdi</origin>11665<capabilities>11666<required id="can_generate_field_modification_events"></required>11667</capabilities>11668<parameters>11669<param id="jni_env">11670<outptr>11671<struct>JNIEnv</struct>11672</outptr>11673<description>11674The JNI environment of the event (current) thread11675</description>11676</param>11677<param id="thread">11678<jthread/>11679<description>11680Thread modifying the field11681</description>11682</param>11683<param id="klass">11684<jclass method="method"/>11685<description>11686Class of the method where the modification is occurring11687</description>11688</param>11689<param id="method">11690<jmethodID class="klass"/>11691<description>11692Method where the modification is occurring11693</description>11694</param>11695<param id="location">11696<jlocation/>11697<description>11698Location where the modification is occurring11699</description>11700</param>11701<param id="field_klass">11702<jclass field="field"/>11703<description>11704Class of the field being modified11705</description>11706</param>11707<param id="object">11708<jobject/>11709<description>11710Object with the field being modified if the field is an11711instance field; <code>NULL</code> otherwise11712</description>11713</param>11714<param id="field">11715<jfieldID class="field_klass"/>11716<description>11717Field being modified11718</description>11719</param>11720<param id="signature_type">11721<char/>11722<description>11723Signature type of the new value11724</description>11725</param>11726<param id="new_value">11727<jvalue/>11728<description>11729The new value11730</description>11731</param>11732</parameters>11733</event>1173411735<event label="Frame Pop"11736id="FramePop" const="JVMTI_EVENT_FRAME_POP" filtered="thread" num="61">11737<description>11738Frame pop events are generated upon exit from a single method11739in a single frame as specified11740in a call to <functionlink id="NotifyFramePop"></functionlink>.11741This is true whether termination is caused by11742executing its return instruction11743or by throwing an exception to its caller11744(see <paramlink id="was_popped_by_exception"></paramlink>).11745However, frame pops caused by the <functionlink id="PopFrame"/>11746function are not reported.11747<p/>11748The location reported by <functionlink id="GetFrameLocation"></functionlink>11749identifies the executable location in the returning method,11750immediately prior to the return.11751</description>11752<origin>jvmdi</origin>11753<capabilities>11754<required id="can_generate_frame_pop_events"></required>11755</capabilities>11756<parameters>11757<param id="jni_env">11758<outptr>11759<struct>JNIEnv</struct>11760</outptr>11761<description>11762The JNI environment of the event (current) thread11763</description>11764</param>11765<param id="thread">11766<jthread/>11767<description>11768Thread that is popping the frame11769</description>11770</param>11771<param id="klass">11772<jclass method="method"/>11773<description>11774Class of the method being popped11775</description>11776</param>11777<param id="method">11778<jmethodID class="klass"/>11779<description>11780Method being popped11781</description>11782</param>11783<param id="was_popped_by_exception">11784<jboolean/>11785<description>11786True if frame was popped by a thrown exception.11787False if method exited through its return instruction.11788</description>11789</param>11790</parameters>11791</event>1179211793<event label="Method Entry"11794id="MethodEntry" const="JVMTI_EVENT_METHOD_ENTRY" filtered="thread" num="65">11795<description>11796Method entry events are generated upon entry of Java11797programming language methods (including native methods).11798<p/>11799The location reported by <functionlink id="GetFrameLocation"></functionlink>11800identifies the initial executable location in11801the method.11802<p/>11803Enabling method11804entry or exit events will significantly degrade performance on many platforms and is thus11805not advised for performance critical usage (such as profiling).11806<internallink id="bci">Bytecode instrumentation</internallink> should be11807used in these cases.11808</description>11809<origin>jvmdi</origin>11810<capabilities>11811<required id="can_generate_method_entry_events"></required>11812</capabilities>11813<parameters>11814<param id="jni_env">11815<outptr>11816<struct>JNIEnv</struct>11817</outptr>11818<description>11819The JNI environment of the event (current) thread11820</description>11821</param>11822<param id="thread">11823<jthread/>11824<description>11825Thread entering the method11826</description>11827</param>11828<param id="klass">11829<jclass method="method"/>11830<description>11831Class of the method being entered11832</description>11833</param>11834<param id="method">11835<jmethodID class="klass"/>11836<description>11837Method being entered11838</description>11839</param>11840</parameters>11841</event>1184211843<event label="Method Exit"11844id="MethodExit" const="JVMTI_EVENT_METHOD_EXIT" filtered="thread" num="66">11845<description>11846Method exit events are generated upon exit from Java11847programming language methods (including native methods).11848This is true whether termination is caused by11849executing its return instruction11850or by throwing an exception to its caller11851(see <paramlink id="was_popped_by_exception"></paramlink>).11852<p/>11853The <code>method</code> field uniquely identifies the11854method being entered or exited. The <code>frame</code> field provides11855access to the stack frame for the method.11856<p/>11857The location reported by <functionlink id="GetFrameLocation"></functionlink>11858identifies the executable location in the returning method11859immediately prior to the return.11860<p/>11861Enabling method11862entry or exit events will significantly degrade performance on many platforms and is thus11863not advised for performance critical usage (such as profiling).11864<internallink id="bci">Bytecode instrumentation</internallink> should be11865used in these cases.11866</description>11867<origin>jvmdi</origin>11868<capabilities>11869<required id="can_generate_method_exit_events"></required>11870</capabilities>11871<parameters>11872<param id="jni_env">11873<outptr>11874<struct>JNIEnv</struct>11875</outptr>11876<description>11877The JNI environment of the event (current) thread11878</description>11879</param>11880<param id="thread">11881<jthread/>11882<description>11883Thread exiting the method11884</description>11885</param>11886<param id="klass">11887<jclass method="method"/>11888<description>11889Class of the method being exited11890</description>11891</param>11892<param id="method">11893<jmethodID class="klass"/>11894<description>11895Method being exited11896</description>11897</param>11898<param id="was_popped_by_exception">11899<jboolean/>11900<description>11901True if frame was popped by a thrown exception.11902False if method exited through its return instruction.11903</description>11904</param>11905<param id="return_value">11906<jvalue/>11907<description>11908The return value of the method being exited.11909Undefined and should not be used if11910<paramlink id="was_popped_by_exception"></paramlink>11911is true.11912</description>11913</param>11914</parameters>11915</event>1191611917<event label="Native Method Bind" phase="any"11918id="NativeMethodBind" const="JVMTI_EVENT_NATIVE_METHOD_BIND" num="67">11919<description>11920A Native Method Bind event is sent when a VM binds a11921Java programming language native method11922to the address of a function that implements the native method.11923This will occur when the native method is called for the first time11924and also occurs when the JNI function <code>RegisterNatives</code> is called.11925This event allows the bind to be redirected to an agent-specified11926proxy function.11927This event is not sent when the native method is unbound.11928Typically, this proxy function will need to be specific to a11929particular method or, to handle the general case, automatically11930generated assembly code, since after instrumentation code is11931executed the function at the original binding11932address will usually be invoked.11933The original binding can be restored or the redirection changed11934by use of the JNI function <code>RegisterNatives</code>.11935Some events may be sent during the primordial phase, JNI and11936most of <jvmti/> cannot be used at this time but the method and11937address can be saved for use later.11938</description>11939<origin>new</origin>11940<capabilities>11941<required id="can_generate_native_method_bind_events"></required>11942</capabilities>11943<parameters>11944<param id="jni_env">11945<outptr>11946<struct>JNIEnv</struct>11947</outptr>11948<description>11949The JNI environment of the event (current) thread11950Will be <code>NULL</code> if sent during the primordial11951<functionlink id="GetPhase">phase</functionlink>.11952</description>11953</param>11954<param id="thread">11955<jthread/>11956<description>11957Thread requesting the bind11958</description>11959</param>11960<param id="klass">11961<jclass method="method"/>11962<description>11963Class of the method being bound11964</description>11965</param>11966<param id="method">11967<jmethodID class="klass"/>11968<description>11969Native method being bound11970</description>11971</param>11972<param id="address">11973<outptr><void/></outptr>11974<description>11975The address the VM is about to bind to--that is, the11976address of the implementation of the native method11977</description>11978</param>11979<param id="new_address_ptr">11980<agentbuf><void/></agentbuf>11981<description>11982if the referenced address is changed (that is, if11983<code>*new_address_ptr</code> is set), the binding11984will instead be made to the supplied address.11985</description>11986</param>11987</parameters>11988</event>1198911990<event label="Exception"11991id="Exception" const="JVMTI_EVENT_EXCEPTION" filtered="thread" num="58">11992<description>11993Exception events are generated whenever an exception is first detected11994in a Java programming language method.11995Where "exception" means any <code>java.lang.Throwable</code>.11996The exception may have been thrown by a Java programming language or native11997method, but in the case of native methods, the event is not generated11998until the exception is first seen by a Java programming language method. If an exception is11999set and cleared in a native method (and thus is never visible to Java programming language code),12000no exception event is generated.12001<p/>12002The <code>method</code> and <code>location</code>12003parameters uniquely identify the current location12004(where the exception was detected) and allow12005the mapping to source file and line number when that information is12006available. The <code>exception</code> field identifies the thrown12007exception object. The <code>catch_method</code>12008and <code>catch_location</code> identify the location of the catch clause,12009if any, that handles the thrown exception. If there is no such catch clause,12010each field is set to 0. There is no guarantee that the thread will ever12011reach this catch clause. If there are native methods on the call stack12012between the throw location and the catch clause, the exception may12013be reset by one of those native methods.12014Similarly, exceptions that are reported as uncaught (<code>catch_klass</code>12015et al. set to 0) may in fact be caught by native code.12016Agents can check for these occurrences by monitoring12017<eventlink id="ExceptionCatch"></eventlink> events.12018Note that finally clauses are implemented as catch and re-throw. Therefore they12019will be reported in the catch location.12020</description>12021<origin>jvmdi</origin>12022<capabilities>12023<required id="can_generate_exception_events"></required>12024</capabilities>12025<parameters>12026<param id="jni_env">12027<outptr>12028<struct>JNIEnv</struct>12029</outptr>12030<description>12031The JNI environment of the event (current) thread12032</description>12033</param>12034<param id="thread">12035<jthread/>12036<description>12037Thread generating the exception12038</description>12039</param>12040<param id="klass">12041<jclass method="method"/>12042<description>12043Class generating the exception12044</description>12045</param>12046<param id="method">12047<jmethodID class="klass"/>12048<description>12049Method generating the exception12050</description>12051</param>12052<param id="location">12053<jlocation/>12054<description>12055Location where exception occurred12056</description>12057</param>12058<param id="exception">12059<jobject/>12060<description>12061The exception being thrown12062</description>12063</param>12064<param id="catch_klass">12065<jclass method="catch_method"/>12066<description>12067Class that will catch the exception, or <code>NULL</code> if no known catch12068</description>12069</param>12070<param id="catch_method">12071<jmethodID class="catch_klass"/>12072<description>12073Method that will catch the exception, or <code>NULL</code> if no known catch12074</description>12075</param>12076<param id="catch_location">12077<jlocation/>12078<description>12079location which will catch the exception or zero if no known catch12080</description>12081</param>12082</parameters>12083</event>1208412085<event label="Exception Catch"12086id="ExceptionCatch" const="JVMTI_EVENT_EXCEPTION_CATCH" filtered="thread" num="59">12087<description>12088Exception catch events are generated whenever a thrown exception is caught.12089Where "exception" means any <code>java.lang.Throwable</code>.12090If the exception is caught in a Java programming language method, the event is generated12091when the catch clause is reached. If the exception is caught in a native12092method, the event is generated as soon as control is returned to a Java programming language12093method. Exception catch events are generated for any exception for which12094a throw was detected in a Java programming language method.12095Note that finally clauses are implemented as catch and re-throw. Therefore they12096will generate exception catch events.12097<p/>12098The <code>method</code> and <code>location</code>12099parameters uniquely identify the current location12100and allow the mapping to source file and line number when that information is12101available. For exceptions caught in a Java programming language method, the12102<code>exception</code> object identifies the exception object. Exceptions12103caught in native methods are not necessarily available by the time the12104exception catch is reported, so the <code>exception</code> field is set12105to <code>NULL</code>.12106</description>12107<origin>jvmdi</origin>12108<capabilities>12109<required id="can_generate_exception_events"></required>12110</capabilities>12111<parameters>12112<param id="jni_env">12113<outptr>12114<struct>JNIEnv</struct>12115</outptr>12116<description>12117The JNI environment of the event (current) thread12118</description>12119</param>12120<param id="thread">12121<jthread/>12122<description>12123Thread catching the exception12124</description>12125</param>12126<param id="klass">12127<jclass method="method"/>12128<description>12129Class catching the exception12130</description>12131</param>12132<param id="method">12133<jmethodID class="klass"/>12134<description>12135Method catching the exception12136</description>12137</param>12138<param id="location">12139<jlocation/>12140<description>12141Location where exception is being caught12142</description>12143</param>12144<param id="exception">12145<jobject/>12146<description>12147Exception being caught12148</description>12149</param>12150</parameters>12151</event>1215212153<event label="Thread Start"12154id="ThreadStart" const="JVMTI_EVENT_THREAD_START" num="52" phase="start">12155<description>12156Thread start events are generated by a new thread before its initial12157method executes.12158<p/>12159A thread may be listed in the array returned by12160<functionlink id="GetAllThreads"></functionlink>12161before its thread start event is generated.12162It is possible for other events to be generated12163on a thread before its thread start event.12164<p/>12165The event is sent on the newly started <paramlink id="thread"></paramlink>.12166</description>12167<origin>jvmdi</origin>12168<capabilities>12169</capabilities>12170<parameters>12171<param id="jni_env">12172<outptr>12173<struct>JNIEnv</struct>12174</outptr>12175<description>12176The JNI environment of the event (current) thread.12177</description>12178</param>12179<param id="thread">12180<jthread/>12181<description>12182Thread starting12183</description>12184</param>12185</parameters>12186</event>1218712188<event label="Thread End"12189id="ThreadEnd" const="JVMTI_EVENT_THREAD_END" filtered="thread" num="53" phase="start">12190<description>12191Thread end events are generated by a terminating thread12192after its initial method has finished execution.12193<p/>12194A thread may be listed in the array returned by12195<functionlink id="GetAllThreads"></functionlink>12196after its thread end event is generated.12197No events are generated on a thread12198after its thread end event.12199<p/>12200The event is sent on the dying <paramlink id="thread"></paramlink>.12201</description>12202<origin>jvmdi</origin>12203<capabilities>12204</capabilities>12205<parameters>12206<param id="jni_env">12207<outptr>12208<struct>JNIEnv</struct>12209</outptr>12210<description>12211The JNI environment of the event (current) thread.12212</description>12213</param>12214<param id="thread">12215<jthread/>12216<description>12217Thread ending12218</description>12219</param>12220</parameters>12221</event>1222212223<event label="Class Load"12224id="ClassLoad" const="JVMTI_EVENT_CLASS_LOAD" filtered="thread" phase="start" num="55">12225<description>12226A class load event is generated when a class is first loaded. The order12227of class load events generated by a particular thread are guaranteed12228to match the order of class loading within that thread.12229Array class creation does not generate a class load event.12230The creation of a primitive class (for example, java.lang.Integer.TYPE)12231does not generate a class load event.12232<p/>12233This event is sent at an early stage in loading the class. As12234a result the class should be used carefully. Note, for example,12235that methods and fields are not yet loaded, so queries for methods,12236fields, subclasses, and so on will not give correct results.12237See "Loading of Classes and Interfaces" in the <i>Java Language12238Specification</i>. For most12239purposes the <eventlink id="ClassPrepare"></eventlink> event will12240be more useful.12241</description>12242<origin>jvmdi</origin>12243<capabilities>12244</capabilities>12245<parameters>12246<param id="jni_env">12247<outptr>12248<struct>JNIEnv</struct>12249</outptr>12250<description>12251The JNI environment of the event (current) thread12252</description>12253</param>12254<param id="thread">12255<jthread/>12256<description>12257Thread loading the class12258</description>12259</param>12260<param id="klass">12261<jclass/>12262<description>12263Class being loaded12264</description>12265</param>12266</parameters>12267</event>1226812269<elide>12270<event label="Class Unload"12271id="ClassUnload" const="JVMTI_EVENT_CLASS_UNLOAD" num="57">12272<description>12273A class unload event is generated when the class is about to be unloaded.12274Class unload events take place during garbage collection and must be12275handled extremely carefully. The garbage collector holds many locks12276and has suspended all other threads, so the event handler cannot depend12277on the ability to acquire any locks. The class unload event handler should12278do as little as possible, perhaps by queuing information to be processed12279later. In particular, the <code>jclass</code> should be used only in12280the JNI function <code>isSameObject</code> or in the following <jvmti/> functions:12281<ul>12282<li><functionlink id="GetClassSignature"></functionlink></li>12283<li><functionlink id="GetSourceFileName"></functionlink></li>12284<li><functionlink id="IsInterface"></functionlink></li>12285<li><functionlink id="IsArrayClass"></functionlink></li>12286</ul>12287</description>12288<origin>jvmdi</origin>12289<capabilities>12290</capabilities>12291<parameters>12292<param id="jni_env">12293<outptr>12294<struct>JNIEnv</struct>12295</outptr>12296<description>12297The JNI environment of the event (current) thread12298</description>12299</param>12300<param id="thread">12301<jthread/>12302<description>12303Thread generating the class unload12304</description>12305</param>12306<param id="klass">12307<jclass/>12308<description>12309Class being unloaded12310</description>12311</param>12312</parameters>12313</event>12314</elide>1231512316<event label="Class Prepare"12317id="ClassPrepare" const="JVMTI_EVENT_CLASS_PREPARE" filtered="thread" phase="start" num="56">12318<description>12319A class prepare event is generated when class preparation is complete.12320At this point, class fields, methods, and implemented interfaces are12321available, and no code from the class has been executed. Since array12322classes never have fields or methods, class prepare events are not12323generated for them. Class prepare events are not generated for12324primitive classes (for example, <code>java.lang.Integer.TYPE</code>).12325</description>12326<origin>jvmdi</origin>12327<capabilities>12328</capabilities>12329<parameters>12330<param id="jni_env">12331<outptr>12332<struct>JNIEnv</struct>12333</outptr>12334<description>12335The JNI environment of the event (current) thread12336</description>12337</param>12338<param id="thread">12339<jthread/>12340<description>12341Thread generating the class prepare12342</description>12343</param>12344<param id="klass">12345<jclass/>12346<description>12347Class being prepared12348</description>12349</param>12350</parameters>12351</event>1235212353<event label="Class File Load Hook" phase="any"12354id="ClassFileLoadHook" const="JVMTI_EVENT_CLASS_FILE_LOAD_HOOK" num="54">12355<description>12356This event is sent when the VM obtains class file data,12357but before it constructs12358the in-memory representation for that class.12359This event is also sent when the class is being modified by the12360<functionlink id="RetransformClasses"/> function or12361the <functionlink id="RedefineClasses"/> function,12362called in any <jvmti/> environment.12363The agent can instrument12364the existing class file data sent by the VM to include profiling/debugging hooks.12365See the description of12366<internallink id="bci">bytecode instrumentation</internallink>12367for usage information.12368<p/>12369This event may be sent before the VM is initialized (the primordial12370<functionlink id="GetPhase">phase</functionlink>). During this time12371no VM resources should be created. Some classes might not be compatible12372with the function (eg. ROMized classes) and this event will not be12373generated for these classes.12374<p/>12375The agent must allocate the space for the modified12376class file data buffer12377using the memory allocation function12378<functionlink id="Allocate"></functionlink> because the12379VM is responsible for freeing the new class file data buffer12380using <functionlink id="Deallocate"></functionlink>.12381Note that <functionlink id="Allocate"></functionlink>12382is permitted during the primordial phase.12383<p/>12384If the agent wishes to modify the class file, it must set12385<code>new_class_data</code> to point12386to the newly instrumented class file data buffer and set12387<code>new_class_data_len</code> to the length of that12388buffer before returning12389from this call. If no modification is desired, the agent simply12390does not set <code>new_class_data</code>. If multiple agents12391have enabled this event the results are chained. That is, if12392<code>new_class_data</code> has been set, it becomes the12393<code>class_data</code> for the next agent.12394<p/>12395The order that this event is sent to each environment differs12396from other events.12397This event is sent to environments in the following order:12398<ul>12399<li><fieldlink id="can_retransform_classes"12400struct="jvmtiCapabilities">retransformation12401incapable</fieldlink>12402environments, in the12403order in which they were created12404</li>12405<li><fieldlink id="can_retransform_classes"12406struct="jvmtiCapabilities">retransformation12407capable</fieldlink>12408environments, in the12409order in which they were created12410</li>12411</ul>12412When triggered by <functionlink id="RetransformClasses"/>,12413this event is sent only to <fieldlink id="can_retransform_classes"12414struct="jvmtiCapabilities">retransformation12415capable</fieldlink>12416environments.12417</description>12418<origin>jvmpi</origin>12419<capabilities>12420<capability id="can_generate_all_class_hook_events"></capability>12421</capabilities>12422<parameters>12423<param id="jni_env">12424<outptr>12425<struct>JNIEnv</struct>12426</outptr>12427<description>12428The JNI environment of the event (current) thread.12429Will be <code>NULL</code> if sent during the primordial12430<functionlink id="GetPhase">phase</functionlink>.12431</description>12432</param>12433<param id="class_being_redefined">12434<jclass/>12435<description>12436The class being12437<functionlink id="RedefineClasses">redefined</functionlink> or12438<functionlink id="RetransformClasses">retransformed</functionlink>.12439<code>NULL</code> if sent by class load.12440</description>12441</param>12442<param id="loader">12443<jobject/>12444<description>12445The class loader loading the class.12446<code>NULL</code> if the bootstrap class loader.12447</description>12448</param>12449<param id="name">12450<vmbuf><char/></vmbuf>12451<description>12452Name of class being loaded as a VM internal qualified name12453(for example, "java/util/List"), encoded as a12454<internallink id="mUTF">modified UTF-8</internallink> string.12455Note: if the class is defined with a <code>NULL</code> name or12456without a name specified, <code>name</code> will be <code>NULL</code>.12457</description>12458</param>12459<param id="protection_domain">12460<jobject/>12461<description>12462The <code>ProtectionDomain</code> of the class.12463</description>12464</param>12465<param id="class_data_len">12466<jint/>12467<description>12468Length of current class file data buffer.12469</description>12470</param>12471<param id="class_data">12472<vmbuf><uchar/></vmbuf>12473<description>12474Pointer to the current class file data buffer.12475</description>12476</param>12477<param id="new_class_data_len">12478<outptr><jint/></outptr>12479<description>12480Pointer to the length of the new class file data buffer.12481</description>12482</param>12483<param id="new_class_data">12484<agentbuf incount="new_class_data_len"><uchar/></agentbuf>12485<description>12486Pointer to the pointer to the instrumented class file data buffer.12487</description>12488</param>12489</parameters>12490</event>1249112492<event label="VM Start Event"12493id="VMStart" const="JVMTI_EVENT_VM_START" num="57" phase="start">12494<description>12495The VM initialization event signals the start of the VM.12496At this time JNI is live but the VM is not yet fully initialized.12497Once this event is generated, the agent is free to call any JNI function.12498This event signals the beginning of the start phase,12499<jvmti/> functions permitted in the start phase may be called.12500<p/>12501In the case of VM start-up failure, this event will not be sent.12502</description>12503<origin>jvmdi</origin>12504<capabilities>12505</capabilities>12506<parameters>12507<param id="jni_env">12508<outptr>12509<struct>JNIEnv</struct>12510</outptr>12511<description>12512The JNI environment of the event (current) thread.12513</description>12514</param>12515</parameters>12516</event>1251712518<event label="VM Initialization Event"12519id="VMInit" const="JVMTI_EVENT_VM_INIT" num="50">12520<description>12521The VM initialization event signals the completion of VM initialization. Once12522this event is generated, the agent is free to call any JNI or <jvmti/>12523function. The VM initialization event can be preceded by or can be concurrent12524with other events, but12525the preceding events should be handled carefully, if at all, because the12526VM has not completed its initialization. The thread start event for the12527main application thread is guaranteed not to occur until after the12528handler for the VM initialization event returns.12529<p/>12530In the case of VM start-up failure, this event will not be sent.12531</description>12532<origin>jvmdi</origin>12533<capabilities>12534</capabilities>12535<parameters>12536<param id="jni_env">12537<outptr>12538<struct>JNIEnv</struct>12539</outptr>12540<description>12541The JNI environment of the event (current) thread.12542</description>12543</param>12544<param id="thread">12545<jthread/>12546<description>12547The initial thread12548</description>12549</param>12550</parameters>12551</event>1255212553<event label="VM Death Event"12554id="VMDeath" const="JVMTI_EVENT_VM_DEATH" num="51">12555<description>12556The VM death event notifies the agent of the termination of the VM.12557No events will occur after the VMDeath event.12558<p/>12559In the case of VM start-up failure, this event will not be sent.12560Note that <internallink id="onunload">Agent_OnUnload</internallink>12561will still be called in these cases.12562</description>12563<origin>jvmdi</origin>12564<capabilities>12565</capabilities>12566<parameters>12567<param id="jni_env">12568<outptr>12569<struct>JNIEnv</struct>12570</outptr>12571<description>12572The JNI environment of the event (current) thread12573</description>12574</param>12575</parameters>12576</event>1257712578<event label="Compiled Method Load"12579id="CompiledMethodLoad" const="JVMTI_EVENT_COMPILED_METHOD_LOAD" num="68">12580<description>12581Sent when a method is compiled and loaded into memory by the VM.12582If it is unloaded, the <eventlink id="CompiledMethodUnload"/> event is sent.12583If it is moved, the <eventlink id="CompiledMethodUnload"/> event is sent,12584followed by a new <code>CompiledMethodLoad</code> event.12585Note that a single method may have multiple compiled forms, and that12586this event will be sent for each form.12587Note also that several methods may be inlined into a single12588address range, and that this event will be sent for each method.12589<p/>12590These events can be sent after their initial occurrence with12591<functionlink id="GenerateEvents"></functionlink>.12592</description>12593<origin>jvmpi</origin>12594<typedef id="jvmtiAddrLocationMap" label="Native address to location entry">12595<field id="start_address">12596<vmbuf><void/></vmbuf>12597<description>12598Starting native address of code corresponding to a location12599</description>12600</field>12601<field id="location">12602<jlocation/>12603<description>12604Corresponding location. See12605<functionlink id="GetJLocationFormat"></functionlink>12606for the meaning of location.12607</description>12608</field>12609</typedef>12610<capabilities>12611<required id="can_generate_compiled_method_load_events"></required>12612</capabilities>12613<parameters>12614<param id="klass">12615<jclass method="method"/>12616<description>12617Class of the method being compiled and loaded12618</description>12619</param>12620<param id="method">12621<jmethodID class="klass"/>12622<description>12623Method being compiled and loaded12624</description>12625</param>12626<param id="code_size">12627<jint/>12628<description>12629Size of compiled code12630</description>12631</param>12632<param id="code_addr">12633<vmbuf><void/></vmbuf>12634<description>12635Address where compiled method code is loaded12636</description>12637</param>12638<param id="map_length">12639<jint/>12640<description>12641Number of <typelink id="jvmtiAddrLocationMap"></typelink>12642entries in the address map.12643Zero if mapping information cannot be supplied.12644</description>12645</param>12646<param id="map">12647<vmbuf><struct>jvmtiAddrLocationMap</struct></vmbuf>12648<description>12649Map from native addresses to location.12650The native address range of each entry is from12651<fieldlink id="start_address" struct="jvmtiAddrLocationMap"></fieldlink>12652to <code>start_address-1</code> of the next entry.12653<code>NULL</code> if mapping information cannot be supplied.12654</description>12655</param>12656<param id="compile_info">12657<vmbuf><void/></vmbuf>12658<description>12659VM-specific compilation information.12660The referenced compile information is managed by the VM12661and must not depend on the agent for collection.12662A VM implementation defines the content and lifetime12663of the information.12664</description>12665</param>12666</parameters>12667</event>1266812669<event label="Compiled Method Unload"12670id="CompiledMethodUnload" const="JVMTI_EVENT_COMPILED_METHOD_UNLOAD" num="69">12671<description>12672Sent when a compiled method is unloaded from memory.12673This event might not be sent on the thread which performed the unload.12674This event may be sent sometime after the unload occurs, but12675will be sent before the memory is reused12676by a newly generated compiled method. This event may be sent after12677the class is unloaded.12678</description>12679<origin>jvmpi</origin>12680<capabilities>12681<required id="can_generate_compiled_method_load_events"></required>12682</capabilities>12683<parameters>12684<param id="klass">12685<jclass method="method"/>12686<description>12687Class of the compiled method being unloaded.12688</description>12689</param>12690<param id="method">12691<jmethodID class="klass"/>12692<description>12693Compiled method being unloaded.12694For identification of the compiled method only -- the class12695may be unloaded and therefore the method should not be used12696as an argument to further JNI or <jvmti/> functions.12697</description>12698</param>12699<param id="code_addr">12700<vmbuf><void/></vmbuf>12701<description>12702Address where compiled method code was loaded.12703For identification of the compiled method only --12704the space may have been reclaimed.12705</description>12706</param>12707</parameters>12708</event>1270912710<event label="Dynamic Code Generated" phase="any"12711id="DynamicCodeGenerated" const="JVMTI_EVENT_DYNAMIC_CODE_GENERATED" num="70">12712<description>12713Sent when a component of the virtual machine is generated dynamically.12714This does not correspond to Java programming language code that is12715compiled--see <eventlink id="CompiledMethodLoad"></eventlink>.12716This is for native code--for example, an interpreter that is generated12717differently depending on command-line options.12718<p/>12719Note that this event has no controlling capability.12720If a VM cannot generate these events, it simply does not send any.12721<p/>12722These events can be sent after their initial occurrence with12723<functionlink id="GenerateEvents"></functionlink>.12724</description>12725<origin>jvmpi</origin>12726<capabilities>12727</capabilities>12728<parameters>12729<param id="name">12730<vmbuf><char/></vmbuf>12731<description>12732Name of the code, encoded as a12733<internallink id="mUTF">modified UTF-8</internallink> string.12734Intended for display to an end-user.12735The name might not be unique.12736</description>12737</param>12738<param id="address">12739<vmbuf><void/></vmbuf>12740<description>12741Native address of the code12742</description>12743</param>12744<param id="length">12745<jint/>12746<description>12747Length in bytes of the code12748</description>12749</param>12750</parameters>12751</event>1275212753<event label="Data Dump Request"12754id="DataDumpRequest" const="JVMTI_EVENT_DATA_DUMP_REQUEST" num="71">12755<description>12756Sent by the VM to request the agent to dump its data. This12757is just a hint and the agent need not react to this event.12758This is useful for processing command-line signals from users. For12759example, in the Java 2 SDK a CTRL-Break on Win32 and a CTRL-\ on Solaris12760causes the VM to send this event to the agent.12761</description>12762<origin>jvmpi</origin>12763<capabilities>12764</capabilities>12765<parameters>12766</parameters>12767</event>1276812769<event label="Monitor Contended Enter"12770id="MonitorContendedEnter" const="JVMTI_EVENT_MONITOR_CONTENDED_ENTER" filtered="thread" num="75">12771<description>12772Sent when a thread is attempting to enter a Java programming language12773monitor already acquired by another thread.12774</description>12775<origin>jvmpi</origin>12776<capabilities>12777<required id="can_generate_monitor_events"></required>12778</capabilities>12779<parameters>12780<param id="jni_env">12781<outptr>12782<struct>JNIEnv</struct>12783</outptr>12784<description>12785The JNI environment of the event (current) thread12786</description>12787</param>12788<param id="thread">12789<jthread/>12790<description>12791JNI local reference to the thread12792attempting to enter the monitor12793</description>12794</param>12795<param id="object">12796<jobject/>12797<description>12798JNI local reference to the monitor12799</description>12800</param>12801</parameters>12802</event>1280312804<event label="Monitor Contended Entered"12805id="MonitorContendedEntered" const="JVMTI_EVENT_MONITOR_CONTENDED_ENTERED" filtered="thread" num="76">12806<description>12807Sent when a thread enters a Java programming language12808monitor after waiting for it to be released by another thread.12809</description>12810<origin>jvmpi</origin>12811<capabilities>12812<required id="can_generate_monitor_events"></required>12813</capabilities>12814<parameters>12815<param id="jni_env">12816<outptr>12817<struct>JNIEnv</struct>12818</outptr>12819<description>12820The JNI environment of the event (current) thread12821</description>12822</param>12823<param id="thread">12824<jthread/>12825<description>12826JNI local reference to the thread entering12827the monitor12828</description>12829</param>12830<param id="object">12831<jobject/>12832<description>12833JNI local reference to the monitor12834</description>12835</param>12836</parameters>12837</event>1283812839<event label="Monitor Wait"12840id="MonitorWait" const="JVMTI_EVENT_MONITOR_WAIT" filtered="thread" num="73">12841<description>12842Sent when a thread is about to wait on an object.12843</description>12844<origin>jvmpi</origin>12845<capabilities>12846<required id="can_generate_monitor_events"></required>12847</capabilities>12848<parameters>12849<param id="jni_env">12850<outptr>12851<struct>JNIEnv</struct>12852</outptr>12853<description>12854The JNI environment of the event (current) thread12855</description>12856</param>12857<param id="thread">12858<jthread/>12859<description>12860JNI local reference to the thread about to wait12861</description>12862</param>12863<param id="object">12864<jobject/>12865<description>12866JNI local reference to the monitor12867</description>12868</param>12869<param id="timeout">12870<jlong/>12871<description>12872The number of milliseconds the thread will wait12873</description>12874</param>12875</parameters>12876</event>1287712878<event label="Monitor Waited"12879id="MonitorWaited" const="JVMTI_EVENT_MONITOR_WAITED" filtered="thread" num="74">12880<description>12881Sent when a thread finishes waiting on an object.12882</description>12883<origin>jvmpi</origin>12884<capabilities>12885<required id="can_generate_monitor_events"></required>12886</capabilities>12887<parameters>12888<param id="jni_env">12889<outptr>12890<struct>JNIEnv</struct>12891</outptr>12892<description>12893The JNI environment of the event (current) thread12894</description>12895</param>12896<param id="thread">12897<jthread/>12898<description>12899JNI local reference to the thread that was finished waiting12900</description>12901</param>12902<param id="object">12903<jobject/>12904<description>12905JNI local reference to the monitor.12906</description>12907</param>12908<param id="timed_out">12909<jboolean/>12910<description>12911True if the monitor timed out12912</description>12913</param>12914</parameters>12915</event>1291612917<event label="Resource Exhausted"12918id="ResourceExhausted" const="JVMTI_EVENT_RESOURCE_EXHAUSTED" num="80"12919since="1.1">12920<description>12921Sent when a VM resource needed by a running application has been exhausted.12922Except as required by the optional capabilities, the set of resources12923which report exhaustion is implementation dependent.12924<p/>12925The following bit flags define the properties of the resource exhaustion:12926<constants id="jvmtiResourceExhaustionFlags"12927label="Resource Exhaustion Flags"12928kind="bits"12929since="1.1">12930<constant id="JVMTI_RESOURCE_EXHAUSTED_OOM_ERROR" num="0x0001">12931After this event returns, the VM will throw a12932<code>java.lang.OutOfMemoryError</code>.12933</constant>12934<constant id="JVMTI_RESOURCE_EXHAUSTED_JAVA_HEAP" num="0x0002">12935The VM was unable to allocate memory from the <tm>Java</tm>12936platform <i>heap</i>.12937The <i>heap</i> is the runtime12938data area from which memory for all class instances and12939arrays are allocated.12940</constant>12941<constant id="JVMTI_RESOURCE_EXHAUSTED_THREADS" num="0x0004">12942The VM was unable to create a thread.12943</constant>12944</constants>12945</description>12946<origin>new</origin>12947<capabilities>12948<capability id="can_generate_resource_exhaustion_heap_events">12949Can generate events when the VM is unable to allocate memory from the12950<internallink id="JVMTI_RESOURCE_EXHAUSTED_JAVA_HEAP">heap</internallink>.12951</capability>12952<capability id="can_generate_resource_exhaustion_threads_events">12953Can generate events when the VM is unable to12954<internallink id="JVMTI_RESOURCE_EXHAUSTED_THREADS">create12955a thread</internallink>.12956</capability>12957</capabilities>12958<parameters>12959<param id="jni_env">12960<outptr>12961<struct>JNIEnv</struct>12962</outptr>12963<description>12964The JNI environment of the event (current) thread12965</description>12966</param>12967<param id="flags">12968<jint/>12969<description>12970Flags defining the properties of the of resource exhaustion12971as specified by the12972<internallink id="jvmtiResourceExhaustionFlags">Resource12973Exhaustion Flags</internallink>.12974</description>12975</param>12976<param id="reserved">12977<vmbuf><void/></vmbuf>12978<description>12979Reserved.12980</description>12981</param>12982<param id="description">12983<vmbuf><char/></vmbuf>12984<description>12985Description of the resource exhaustion, encoded as a12986<internallink id="mUTF">modified UTF-8</internallink> string.12987</description>12988</param>12989</parameters>12990</event>1299112992<event label="VM Object Allocation"12993id="VMObjectAlloc" const="JVMTI_EVENT_VM_OBJECT_ALLOC" num="84">12994<description>12995Sent when a method causes the virtual machine to allocate an12996Object visible to Java programming language code and the12997allocation is not detectable by other intrumentation mechanisms.12998Generally object allocation should be detected by instrumenting12999the bytecodes of allocating methods.13000Object allocation generated in native code by JNI function13001calls should be detected using13002<internallink id="jniIntercept">JNI function interception</internallink>.13003Some methods might not have associated bytecodes and are not13004native methods, they instead are executed directly by the13005VM. These methods should send this event.13006Virtual machines which are incapable of bytecode instrumentation13007for some or all of their methods can send this event.13008<p/>13009Typical examples where this event might be sent:13010<ul>13011<li>Reflection -- for example, <code>java.lang.Class.newInstance()</code></li>13012<li>Methods not represented by bytecodes -- for example, VM intrinsics and13013J2ME preloaded classes</li>13014</ul>13015Cases where this event would not be generated:13016<ul>13017<li>Allocation due to bytecodes -- for example, the <code>new</code>13018and <code>newarray</code> VM instructions</li>13019<li>Allocation due to JNI function calls -- for example,13020<code>AllocObject</code></li>13021<li>Allocations during VM initialization</li>13022<li>VM internal objects</li>13023</ul>13024</description>13025<origin>new</origin>13026<capabilities>13027<required id="can_generate_vm_object_alloc_events"></required>13028</capabilities>13029<parameters>13030<param id="jni_env">13031<outptr>13032<struct>JNIEnv</struct>13033</outptr>13034<description>13035The JNI environment of the event (current) thread13036</description>13037</param>13038<param id="thread">13039<jthread/>13040<description>13041Thread allocating the object.13042</description>13043</param>13044<param id="object">13045<jobject/>13046<description>13047JNI local reference to the object that was allocated13048</description>13049</param>13050<param id="object_klass">13051<jclass/>13052<description>13053JNI local reference to the class of the object13054</description>13055</param>13056<param id="size">13057<jlong/>13058<description>13059Size of the object (in bytes). See <functionlink id="GetObjectSize"/>.13060</description>13061</param>13062</parameters>13063</event>1306413065<event label="Object Free"13066id="ObjectFree" const="JVMTI_EVENT_OBJECT_FREE" num="83">13067<description>13068An Object Free event is sent when the garbage collector frees an object.13069Events are only sent for tagged objects--see13070<internallink id="Heap">heap functions</internallink>.13071<p/>13072The event handler must not use JNI functions and13073must not use <jvmti/> functions except those which13074specifically allow such use (see the raw monitor, memory management,13075and environment local storage functions).13076</description>13077<origin>new</origin>13078<capabilities>13079<required id="can_generate_object_free_events"></required>13080</capabilities>13081<parameters>13082<param id="tag">13083<jlong/>13084<description>13085The freed object's tag13086</description>13087</param>13088</parameters>13089</event>1309013091<event label="Garbage Collection Start"13092id="GarbageCollectionStart" const="JVMTI_EVENT_GARBAGE_COLLECTION_START" num="81">13093<description>13094A Garbage Collection Start event is sent when a13095garbage collection pause begins.13096Only stop-the-world collections are reported--that is, collections during13097which all threads cease to modify the state of the Java virtual machine.13098This means that some collectors will never generate these events.13099This event is sent while the VM is still stopped, thus13100the event handler must not use JNI functions and13101must not use <jvmti/> functions except those which13102specifically allow such use (see the raw monitor, memory management,13103and environment local storage functions).13104<p/>13105This event is always sent as a matched pair with13106<eventlink id="GarbageCollectionFinish"/>13107(assuming both events are enabled) and no garbage collection13108events will occur between them.13109</description>13110<origin>new</origin>13111<capabilities>13112<required id="can_generate_garbage_collection_events"></required>13113</capabilities>13114<parameters>13115</parameters>13116</event>1311713118<event label="Garbage Collection Finish"13119id="GarbageCollectionFinish" const="JVMTI_EVENT_GARBAGE_COLLECTION_FINISH" num="82">13120<description>13121A Garbage Collection Finish event is sent when a13122garbage collection pause ends.13123This event is sent while the VM is still stopped, thus13124the event handler must not use JNI functions and13125must not use <jvmti/> functions except those which13126specifically allow such use (see the raw monitor, memory management,13127and environment local storage functions).13128<p/>13129Some agents may need to do post garbage collection operations that13130require the use of the disallowed <jvmti/> or JNI functions. For these13131cases an agent thread can be created which waits on a raw monitor,13132and the handler for the Garbage Collection Finish event simply13133notifies the raw monitor13134<p/>13135This event is always sent as a matched pair with13136<eventlink id="GarbageCollectionStart"/> (assuming both events are enabled).13137<issue>13138The most important use of this event is to provide timing information,13139and thus additional information is not required. However,13140information about the collection which is "free" should be included -13141what that information is needs to be determined.13142</issue>13143</description>13144<origin>new</origin>13145<capabilities>13146<required id="can_generate_garbage_collection_events"></required>13147</capabilities>13148<parameters>13149</parameters>13150</event>1315113152<elide>13153<event label="Verbose Output" phase="any"13154id="VerboseOutput" const="JVMTI_EVENT_VERBOSE_OUTPUT" num="85">13155<description>13156Send verbose messages as strings.13157<issue>13158This format is extremely fragile, as it can change with each13159platform, collector and version. Alternatives include:13160<ul>13161<li>building off Java programming language M and M APIs</li>13162<li>XML</li>13163<li>key/value pairs</li>13164<li>removing it</li>13165</ul>13166</issue>13167<issue>13168Though this seemed trivial to implement.13169In the RI it appears this will be quite complex.13170</issue>13171</description>13172<origin>new</origin>13173<capabilities>13174</capabilities>13175<parameters>13176<param id="flag">13177<enum>jvmtiVerboseFlag</enum>13178<description>13179Which verbose output is being sent.13180</description>13181</param>13182<param id="message">13183<vmbuf><char/></vmbuf>13184<description>13185Message text, encoded as a13186<internallink id="mUTF">modified UTF-8</internallink> string.13187</description>13188</param>13189</parameters>13190</event>13191</elide>1319213193</eventsection>1319413195<datasection>13196<intro>13197<jvmti/> extends the data types defined by JNI.13198</intro>13199<basetypes id="jniTypes" label="JNI Types Used in the JVM Tool Interface">13200<basetype id="jboolean">13201<description>13202Holds a Java programming language <code>boolean</code>.13203Unsigned 8 bits.13204</description>13205</basetype>13206<basetype id="jchar">13207<description>13208Holds a Java programming language <code>char</code>.13209Unsigned 16 bits.13210</description>13211</basetype>13212<basetype id="jint">13213<description>13214Holds a Java programming language <code>int</code>.13215Signed 32 bits.13216</description>13217</basetype>13218<basetype id="jlong">13219<description>13220Holds a Java programming language <code>long</code>.13221Signed 64 bits.13222</description>13223</basetype>13224<basetype id="jfloat">13225<description>13226Holds a Java programming language <code>float</code>.1322732 bits.13228</description>13229</basetype>13230<basetype id="jdouble">13231<description>13232Holds a Java programming language <code>double</code>.1323364 bits.13234</description>13235</basetype>13236<basetype id="jobject">13237<description>13238Holds a Java programming language object.13239</description>13240</basetype>13241<basetype id="jclass">13242<description>13243Holds a Java programming language class.13244</description>13245</basetype>13246<basetype id="jvalue">13247<description>13248Is a union of all primitive types and <code>jobject</code>. Thus, holds any Java13249programming language value.13250</description>13251</basetype>13252<basetype id="jfieldID">13253<description>13254Identifies a Java programming language field.13255<code>jfieldID</code>s returned by <jvmti/> functions and events may be13256safely stored.13257</description>13258</basetype>13259<basetype id="jmethodID">13260<description>13261Identifies a Java programming language method, initializer, or constructor.13262<code>jmethodID</code>s returned by <jvmti/> functions and events may be13263safely stored. However, if the class is unloaded, they become invalid13264and must not be used.13265</description>13266</basetype>13267<basetype id="JNIEnv">13268<description>13269Pointer to the JNI function table. Pointer to this (<code>JNIEnv *</code>)13270is a JNI environment.13271</description>13272</basetype>13273</basetypes>1327413275<basetypes id="jvmtiTypes" label="JVM Tool Interface Base Types">13276<basetype id="jvmtiEnv">13277<description>13278The <jvmti/> <internallink id="environments">environment</internallink> pointer.13279See the <internallink id="FunctionSection">Function Section</internallink>.13280<code>jvmtiEnv</code> points to the13281<internallink id="FunctionTable">function table</internallink> pointer.13282</description>13283</basetype>13284<basetype id="jthread">13285<definition>typedef jobject jthread;</definition>13286<description>13287Subtype of <datalink id="jobject"></datalink> that holds a thread.13288</description>13289</basetype>13290<basetype id="jthreadGroup">13291<definition>typedef jobject jthreadGroup;</definition>13292<description>13293Subtype of <datalink id="jobject"></datalink> that holds a thread group.13294</description>13295</basetype>13296<basetype id="jlocation">13297<definition>typedef jlong jlocation;</definition>13298<description>13299A 64 bit value, representing a monotonically increasing13300executable position within a method.13301<code>-1</code> indicates a native method.13302See <functionlink id="GetJLocationFormat"></functionlink> for the format on a13303given VM.13304</description>13305</basetype>13306<basetype id="jrawMonitorID">13307<definition>struct _jrawMonitorID;13308typedef struct _jrawMonitorID *jrawMonitorID;</definition>13309<description>13310A raw monitor.13311</description>13312</basetype>13313<basetype id="jvmtiError">13314<description>13315Holds an error return code.13316See the <internallink id="ErrorSection">Error section</internallink> for possible values.13317<example>13318typedef enum {13319JVMTI_ERROR_NONE = 0,13320JVMTI_ERROR_INVALID_THREAD = 10,13321...13322} jvmtiError;13323</example>13324</description>13325</basetype>13326<basetype id="jvmtiEvent">13327<description>13328An identifier for an event type.13329See the <internallink id="EventSection">Event section</internallink> for possible values.13330It is guaranteed that future versions of this specification will13331never assign zero as an event type identifier.13332<example>13333typedef enum {13334JVMTI_EVENT_SINGLE_STEP = 1,13335JVMTI_EVENT_BREAKPOINT = 2,13336...13337} jvmtiEvent;13338</example>13339</description>13340</basetype>13341<basetype id="jvmtiEventCallbacks">13342<description>13343The callbacks used for events.13344<example>13345typedef struct {13346jvmtiEventVMInit VMInit;13347jvmtiEventVMDeath VMDeath;13348...13349} jvmtiEventCallbacks;13350</example>13351See <internallink id="jvmtiEventCallbacks">event callbacks</internallink>13352for the complete structure.13353<p/>13354Where, for example, the VM initialization callback is defined:13355<example>13356typedef void (JNICALL *jvmtiEventVMInit)13357(jvmtiEnv *jvmti_env,13358JNIEnv* jni_env,13359jthread thread);13360</example>13361See the individual events for the callback function definition.13362</description>13363</basetype>13364<basetype id="jniNativeInterface">13365<definition>typedef struct JNINativeInterface_ jniNativeInterface;</definition>13366<description>13367Typedef for the JNI function table <code>JNINativeInterface</code>13368defined in the13369<externallink id="http://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/functions.html#wp23720">JNI Specification</externallink>.13370The JNI reference implementation defines this with an underscore.13371</description>13372</basetype>13373</basetypes>1337413375</datasection>1337613377<issuessection label="Issues">13378<intro id="suspendRequired" label="Resolved Issue: Suspend - Required or Automatic">13379JVMDI requires that the agent suspend threads before calling13380certain sensitive functions. JVMPI requires garbage collection to be13381disabled before calling certain sensitive functions.13382It was suggested that rather than have this requirement, that13383VM place itself in a suitable state before performing an13384operation. This makes considerable sense since each VM13385knows its requirements and can most easily arrange a13386safe state.13387<p/>13388The ability to externally suspend/resume threads will, of13389course, remain. The ability to enable/disable garbage collection will not.13390<p/>13391This issue is resolved--suspend will not13392be required. The spec has been updated to reflect this.13393</intro>1339413395<intro id="stackSampling" label="Resolved Issue: Call Stack Sampling">13396There are a variety of approaches to sampling call stacks.13397The biggest bifurcation is between VM controlled and agent13398controlled.13399<p/>13400This issue is resolved--agent controlled13401sampling will be the approach.13402</intro>1340313404<intro id="threadRepresentation" label="Resolved Issue: Thread Representation">13405JVMDI represents threads as jthread. JVMPI primarily13406uses JNIEnv* to represent threads.13407<p/>13408The Expert Group has chosen jthread as the representation13409for threads in <jvmti/>.13410JNIEnv* is sent by13411events since it is needed to JNI functions. JNIEnv, per the13412JNI spec, are not supposed to be used outside their thread.13413</intro>1341413415<intro id="design" label="Resolved Issue: Method Representation">13416The JNI spec allows an implementation to depend on jclass/jmethodID13417pairs, rather than simply a jmethodID, to reference a method.13418JVMDI, for consistency, choose the same representation.13419JVMPI, however, specifies that a jmethodID alone maps to a13420method. Both of the Sun <tm>J2SE</tm> virtual machines (Classic and <tm>HotSpot</tm>) store13421pointers in jmethodIDs, and as a result, a jmethodID is sufficient.13422In fact, any JVM implementation that supports JVMPI must have13423such a representation.13424<jvmti/> will use jmethodID as a unique representation of a method13425(no jclass is used).13426There should be efficiency gains, particularly in13427functionality like stack dumping, to this representation.13428<p/>13429Note that fields were not used in JVMPI and that the access profile13430of fields differs from methods--for implementation efficiency13431reasons, a jclass/jfieldID pair will still be needed for field13432reference.13433</intro>1343413435<intro id="localReferenceIssue" label="Resolved Issue: Local References">13436Functions return local references.13437</intro>1343813439<intro id="frameRep" label="Resolved Issue: Representation of frames">13440In JVMDI, a frame ID is used to represent a frame. Problem with this13441is that a VM must track when a frame becomes invalid, a far better13442approach, and the one used in <jvmti/>, is to reference frames by depth.13443</intro>1344413445<intro id="requiredCapabilities" label="Issue: Required Capabilities">13446Currently, having a required capabilities means that the functionality13447is optional. Capabilities are useful even for required functionality13448since they can inform the VM is needed set-up. Thus, there should be13449a set of capabilities that a conformant implementation must provide13450(if requested during Agent_OnLoad).13451</intro>1345213453<intro id="taghint" label="Proposal: add tag hint function">13454A hint of the percentage of objects that will be tagged would13455help the VM pick a good implementation.13456</intro>1345713458<intro id="moreMonitorQueries" label="Request: More Monitor Quires">13459How difficult or easy would be to extend the monitor_info category to include13460<pre>13461- current number of monitors13462- enumeration of monitors13463- enumeration of threads waiting on a given monitor13464</pre>13465The reason for my question is the fact that current get_monitor_info support13466requires the agent to specify a given thread to get the info which is probably13467OK in the profiling/debugging space, while in the monitoring space the agent13468could be watching the monitor list and then decide which thread to ask for13469the info. You might ask why is this important for monitoring .... I think it13470can aid in the detection/prediction of application contention caused by hot-locks.13471</intro>13472</issuessection>1347313474<changehistory id="ChangeHistory" update="09/05/07">13475<intro>13476The <jvmti/> specification is an evolving document with major, minor,13477and micro version numbers.13478A released version of the specification is uniquely identified13479by its major and minor version.13480The functions, events, and capabilities in this specification13481indicate a "Since" value which is the major and minor version in13482which it was introduced.13483The version of the specification implemented by the VM can13484be retrieved at runtime with the <functionlink id="GetVersionNumber"/>13485function.13486</intro>13487<change date="14 Nov 2002">13488Converted to XML document.13489</change>13490<change date="14 Nov 2002">13491Elided heap dump functions (for now) since what was there13492was wrong.13493</change>13494<change date="18 Nov 2002">13495Added detail throughout.13496</change>13497<change date="18 Nov 2002">13498Changed JVMTI_THREAD_STATUS_RUNNING to JVMTI_THREAD_STATUS_RUNNABLE.13499</change>13500<change date="19 Nov 2002">13501Added AsyncGetStackTrace.13502</change>13503<change date="19 Nov 2002">13504Added jframeID return to GetStackTrace.13505</change>13506<change date="19 Nov 2002">13507Elided GetCurrentFrame and GetCallingFrame functions (for now) since what was there13508since they are redundant with GetStackTrace.13509</change>13510<change date="19 Nov 2002">13511Elided ClearAllBreakpoints since it has always been redundant.13512</change>13513<change date="19 Nov 2002">13514Added GetSystemProperties.13515</change>13516<change date="19 Nov 2002">13517Changed the thread local storage functions to use jthread.13518</change>13519<change date="20 Nov 2002">13520Added GetJLocationFormat.13521</change>13522<change date="22 Nov 2002">13523Added events and introductory text.13524</change>13525<change date="22 Nov 2002">13526Cross reference type and constant definitions.13527</change>13528<change date="24 Nov 2002">13529Added DTD.13530</change>13531<change date="24 Nov 2002">13532Added capabilities function section.13533</change>13534<change date="29 Nov 2002">13535Assign capabilities to each function and event.13536</change>13537<change date="29 Nov 2002">13538Add <internallink id="jniIntercept">JNI interception functions</internallink>.13539</change>13540<change date="30 Nov 2002">13541Auto generate SetEventNotificationMode capabilities.13542</change>13543<change date="30 Nov 2002">13544Add <eventlink id="VMObjectAlloc"></eventlink> event.13545</change>13546<change date="30 Nov 2002">13547Add <eventlink id="DynamicCodeGenerated"></eventlink> event.13548</change>13549<change date="30 Nov 2002">13550Add const to declarations.13551</change>13552<change date="30 Nov 2002">13553Change method exit and frame pop to send on exception.13554</change>13555<change date="1 Dec 2002">13556Add ForceGarbageCollection.13557</change>13558<change date="2 Dec 2002">13559Redo Xrun section; clarify GetStackTrace and add example;13560Fix width problems; use "agent" consistently.13561</change>13562<change date="8 Dec 2002">13563Remove previous start-up intro.13564Add <internallink id="environments"><jvmti/> Environments</internallink>13565section.13566</change>13567<change date="8 Dec 2002">13568Add <functionlink id="DisposeEnvironment"></functionlink>.13569</change>13570<change date="9 Dec 2002">13571Numerous minor updates.13572</change>13573<change date="15 Dec 2002">13574Add heap profiling functions added:13575get/set annotation, iterate live objects/heap.13576Add heap profiling functions place holder added:13577heap roots.13578Heap profiling event added: object free.13579Heap profiling event redesigned: vm object allocation.13580Heap profiling event placeholders added: garbage collection start/finish.13581Native method bind event added.13582</change>13583<change date="19 Dec 2002">13584Revamp suspend/resume functions.13585Add origin information with jvmdi tag.13586Misc fixes.13587</change>13588<change date="24 Dec 2002">13589Add semantics to types.13590</change>13591<change date="27 Dec 2002">13592Add local reference section.13593Autogenerate parameter descriptions from types.13594</change>13595<change date="28 Dec 2002">13596Document that RunAgentThread sends threadStart.13597</change>13598<change date="29 Dec 2002">13599Remove redundant local ref and dealloc warning.13600Convert GetRawMonitorName to allocated buffer.13601Add GenerateEvents.13602</change>13603<change date="30 Dec 2002">13604Make raw monitors a type and rename to "jrawMonitorID".13605</change>13606<change date="1 Jan 2003">13607Include origin information.13608Clean-up JVMDI issue references.13609Remove Deallocate warnings which are now automatically generated.13610</change>13611<change date="2 Jan 2003">13612Fix representation issues for jthread.13613</change>13614<change date="3 Jan 2003">13615Make capabilities buffered out to 64 bits - and do it automatically.13616</change>13617<change date="4 Jan 2003">13618Make constants which are enumeration into enum types.13619Parameters now of enum type.13620Clean-up and index type section.13621Replace remaining datadef entities with callback.13622</change>13623<change date="7 Jan 2003">13624Correct GenerateEvents description.13625More internal semantics work.13626</change>13627<change date="9 Jan 2003">13628Replace previous GetSystemProperties with two functions13629which use allocated information instead fixed.13630Add SetSystemProperty.13631More internal semantics work.13632</change>13633<change date="12 Jan 2003">13634Add varargs to end of SetEventNotificationMode.13635</change>13636<change date="20 Jan 2003">13637Finish fixing spec to reflect that alloc sizes are jlong.13638</change>13639<change date="22 Jan 2003">13640Allow NULL as RunAgentThread arg.13641</change>13642<change date="22 Jan 2003">13643Fixed names to standardized naming convention13644Removed AsyncGetStackTrace.13645</change>13646<change date="29 Jan 2003">13647Since we are using jthread, removed GetThread.13648</change>13649<change date="31 Jan 2003">13650Change GetFieldName to allow NULLs like GetMethodName.13651</change>13652<change date="29 Feb 2003" version="v40">13653Rewrite the introductory text, adding sections on13654start-up, environments and bytecode instrumentation.13655Change the command line arguments per EG discussions.13656Add an introduction to the capabilities section.13657Add the extension mechanism category and functions.13658Mark for deletion, but clarified anyhow, SuspendAllThreads.13659Rename IterateOverLiveObjects to IterateOverReachableObjects and13660change the text accordingly.13661Clarify IterateOverHeap.13662Clarify CompiledMethodLoad.13663Discuss prerequisite state for Calling Functions.13664Clarify SetAllocationHooks.13665Added issues ("To be resolved:") through-out.13666And so on...13667</change>13668<change date="6 Mar 2003" version="v41">13669Remove struct from the call to GetOwnedMonitorInfo.13670Automatically generate most error documentation, remove13671(rather broken) hand written error doc.13672Better describe capability use (empty initial set).13673Add min value to jint params.13674Remove the capability can_access_thread_local_storage.13675Rename error JVMTI_ERROR_NOT_IMPLEMENTED to JVMTI_ERROR_MUST_POSSESS_CAPABILITY;13676same for *NOT_IMPLEMENTED.13677Description fixes.13678</change>13679<change date="8 Mar 2003" version="v42">13680Rename GetClassSignature to GetClassName.13681Rename IterateOverClassObjects to IterateOverInstancesOfClass.13682Remove GetMaxStack (operand stack isn't used in <jvmti/>).13683Description fixes: define launch-time, remove native frame pop13684from PopFrame, and assorted clarifications.13685</change>13686<change date="8 Mar 2003" version="v43">13687Fix minor editing problem.13688</change>13689<change date="10 Mar 2003" version="v44">13690Add phase information.13691Remap (compact) event numbers.13692</change>13693<change date="11 Mar 2003" version="v45">13694More phase information - allow "any".13695Elide raw monitor queries and events.13696Minor description fixes.13697</change>13698<change date="12 Mar 2003" version="v46">13699Add GetPhase.13700Use "phase" through document.13701Elide GetRawMonitorName.13702Elide GetObjectMonitors.13703</change>13704<change date="12 Mar 2003" version="v47">13705Fixes from link, XML, and spell checking.13706Auto-generate the callback structure.13707</change>13708<change date="13 Mar 2003" version="v48">13709One character XML fix.13710</change>13711<change date="13 Mar 2003" version="v49">13712Change function parameter names to be consistent with13713event parameters (fooBarBaz becomes foo_bar_baz).13714</change>13715<change date="14 Mar 2003" version="v50">13716Fix broken link. Fix thread markers.13717</change>13718<change date="14 Mar 2003" version="v51">13719Change constants so they are under 128 to workaround13720compiler problems.13721</change>13722<change date="23 Mar 2003" version="v52">13723Overhaul capabilities. Separate GetStackTrace into13724GetStackTrace and GetStackFrames.13725</change>13726<change date="8 Apr 2003" version="v54">13727Use depth instead of jframeID to reference frames.13728Remove the now irrelevant GetCurrentFrame, GetCallerFrame and GetStackFrames.13729Remove frame arg from events.13730</change>13731<change date="9 Apr 2003" version="v55">13732Remove GetObjectWithAnnotation since tests show bufferred approach more efficient.13733Add missing annotation_count to GetObjectsWithAnnotations13734</change>13735<change date="10 Apr 2003" version="v56">13736Remove confusing parenthetical statement in GetObjectsWithAnnotations13737</change>13738<change date="13 Apr 2003" version="v58">13739Replace jclass/jmethodID representation of method with simply jmethodID;13740Pass JvmtiEnv* as first arg of every event; remove JNIEnv* where inappropriate.13741Replace can_access_frames with can_access_local_variables; remove from purely stack access.13742Use can_get_synthetic_attribute; fix description.13743Clarify that zero length arrays must be deallocated.13744Clarify RelinquishCapabilities.13745Generalize JVMTI_ERROR_VM_DEAD to JVMTI_ERROR_WRONG_PHASE.13746</change>13747<change date="27 Apr 2003" version="v59">13748Remove lingering indirect references to OBSOLETE_METHOD_ID.13749</change>13750<change date="4 May 2003" version="v60">13751Allow DestroyRawMonitor during OnLoad.13752</change>13753<change date="7 May 2003" version="v61">13754Added not monitor owner error return to DestroyRawMonitor.13755</change>13756<change date="13 May 2003" version="v62">13757Clarify semantics of raw monitors.13758Change flags on <code>GetThreadStatus</code>.13759<code>GetClassLoader</code> return NULL for the bootstrap class loader.13760Add <code>GetClassName</code> issue.13761Define local variable signature.13762Disallow zero in annotations array of <code>GetObjectsWithAnnotations</code>.13763Remove over specification in <code>GetObjectsWithAnnotations</code>.13764Elide <code>SetAllocationHooks</code>.13765Elide <code>SuspendAllThreads</code>.13766</change>13767<change date="14 May 2003" version="v63">13768Define the data type <code>jvmtiEventCallbacks</code>.13769Zero length allocations return NULL.13770Keep SetAllocationHooks in JVMDI, but remove from <jvmti/>.13771Add JVMTI_THREAD_STATUS_FLAG_INTERRUPTED.13772</change>13773<change date="15 May 2003" version="v64">13774Better wording, per review.13775</change>13776<change date="15 May 2003" version="v65">13777First Alpha.13778Make jmethodID and jfieldID unique, jclass not used.13779</change>13780<change date="27 May 2003" version="v66">13781Fix minor XSLT errors.13782</change>13783<change date="13 June 2003" version="v67">13784Undo making jfieldID unique (jmethodID still is).13785</change>13786<change date="17 June 2003" version="v68">13787Changes per June 11th Expert Group meeting --13788Overhaul Heap functionality: single callback,13789remove GetHeapRoots, add reachable iterators,13790and rename "annotation" to "tag".13791NULL thread parameter on most functions is current13792thread.13793Add timers.13794Remove ForceExit.13795Add GetEnvironmentLocalStorage.13796Add verbose flag and event.13797Add AddToBootstrapClassLoaderSearch.13798Update ClassFileLoadHook.13799</change>13800<change date="18 June 2003" version="v69">13801Clean up issues sections.13802Rename GetClassName back to GetClassSignature and13803fix description.13804Add generic signature to GetClassSignature,13805GetFieldSignature, GetMethodSignature, and13806GetLocalVariableTable.13807Elide EstimateCostOfCapabilities.13808Clarify that the system property functions operate13809on the VM view of system properties.13810Clarify Agent_OnLoad.13811Remove "const" from JNIEnv* in events.13812Add metadata accessors.13813</change>13814<change date="18 June 2003" version="v70">13815Add start_depth to GetStackTrace.13816Move system properties to a new category.13817Add GetObjectSize.13818Remove "X" from command line flags.13819XML, HTML, and spell check corrections.13820</change>13821<change date="19 June 2003" version="v71">13822Fix JVMTI_HEAP_ROOT_THREAD to be 6.13823Make each synopsis match the function name.13824Fix unclear wording.13825</change>13826<change date="26 June 2003" version="v72">13827SetThreadLocalStorage and SetEnvironmentLocalStorage should allow value13828to be set to NULL.13829NotifyFramePop, GetFrameLocationm and all the local variable operations13830needed to have their wording about frames fixed.13831Grammar and clarity need to be fixed throughout.13832Capitalization and puntuation need to be consistent.13833Need micro version number and masks for accessing major, minor, and micro.13834The error code lists should indicate which must be returned by13835an implementation.13836The command line properties should be visible in the properties functions.13837Disallow popping from the current thread.13838Allow implementations to return opaque frame error when they cannot pop.13839The NativeMethodBind event should be sent during any phase.13840The DynamicCodeGenerated event should be sent during any phase.13841The following functions should be allowed to operate before VMInit:13842Set/GetEnvironmentLocalStorage13843GetMethodDeclaringClass13844GetClassSignature13845GetClassModifiers13846IsInterface13847IsArrayClass13848GetMethodName13849GetMethodModifiers13850GetMaxLocals13851GetArgumentsSize13852GetLineNumberTable13853GetMethodLocation13854IsMethodNative13855IsMethodSynthetic.13856Other changes (to XSL):13857Argument description should show asterisk after not before pointers.13858NotifyFramePop, GetFrameLocationm and all the local variable operations13859should hsve the NO_MORE_FRAMES error added.13860Not alive threads should have a different error return than invalid thread.13861</change>13862<change date="7 July 2003" version="v73">13863VerboseOutput event was missing message parameter.13864Minor fix-ups.13865</change>13866<change date="14 July 2003" version="v74">13867Technical Publications Department corrections.13868Allow thread and environment local storage to be set to NULL.13869</change>13870<change date="23 July 2003" version="v75">13871Use new Agent_OnLoad rather than overloaded JVM_OnLoad.13872Add JNICALL to callbacks (XSL).13873Document JNICALL requirement for both events and callbacks (XSL).13874Restrict RedefineClasses to methods and attributes.13875Elide the VerboseOutput event.13876VMObjectAlloc: restrict when event is sent and remove method parameter.13877Finish loose ends from Tech Pubs edit.13878</change>13879<change date="24 July 2003" version="v76">13880Change ClassFileLoadHook event to send the class instead of a boolean of redefine.13881</change>13882<change date="24 July 2003" version="v77">13883XML fixes.13884Minor text clarifications and corrections.13885</change>13886<change date="24 July 2003" version="v78">13887Remove GetExceptionHandlerTable and GetThrownExceptions from <jvmti/>.13888Clarify that stack frames are JVM Spec frames.13889Split can_get_source_info into can_get_source_file_name, can_get_line_numbers,13890and can_get_source_debug_extension.13891PopFrame cannot have a native calling method.13892Removed incorrect statement in GetClassloaderClasses13893(see <vmspec chapter="4.4"/>).13894</change>13895<change date="24 July 2003" version="v79">13896XML and text fixes.13897Move stack frame description into Stack Frame category.13898</change>13899<change date="26 July 2003" version="v80">13900Allow NULL (means bootstrap loader) for GetClassloaderClasses.13901Add new heap reference kinds for references from classes.13902Add timer information struct and query functions.13903Add AvailableProcessors.13904Rename GetOtherThreadCpuTime to GetThreadCpuTime.13905Explicitly add JVMTI_ERROR_INVALID_THREAD and JVMTI_ERROR_THREAD_NOT_ALIVE13906to SetEventNotification mode.13907Add initial thread to the VM_INIT event.13908Remove platform assumptions from AddToBootstrapClassLoaderSearch.13909</change>13910<change date="26 July 2003" version="v81">13911Grammar and clarity changes per review.13912</change>13913<change date="27 July 2003" version="v82">13914More grammar and clarity changes per review.13915Add Agent_OnUnload.13916</change>13917<change date="28 July 2003" version="v83">13918Change return type of Agent_OnUnload to void.13919</change>13920<change date="28 July 2003" version="v84">13921Rename JVMTI_REFERENCE_ARRAY to JVMTI_REFERENCE_ARRAY_ELEMENT.13922</change>13923<change date="28 July 2003" version="v85">13924Steal java.lang.Runtime.availableProcessors() wording for13925AvailableProcessors().13926Guarantee that zero will never be an event ID.13927Remove some issues which are no longer issues.13928Per review, rename and more completely document the timer13929information functions.13930</change>13931<change date="29 July 2003" version="v86">13932Non-spec visible change to XML controlled implementation:13933SetThreadLocalStorage must run in VM mode.13934</change>13935<change date="5 August 2003" version="0.1.87">13936Add GetErrorName.13937Add varargs warning to jvmtiExtensionEvent.13938Remove "const" on the jvmtiEnv* of jvmtiExtensionEvent.13939Remove unused can_get_exception_info capability.13940Pass jvmtiEnv* and JNIEnv* to the jvmtiStartFunction.13941Fix jvmtiExtensionFunctionInfo.func declared type.13942Extension function returns error code.13943Use new version numbering.13944</change>13945<change date="5 August 2003" version="0.2.88">13946Remove the ClassUnload event.13947</change>13948<change date="8 August 2003" version="0.2.89">13949Heap reference iterator callbacks return an enum that13950allows outgoing object references to be ignored.13951Allow JNIEnv as a param type to extension events/functions.13952</change>13953<change date="15 August 2003" version="0.2.90">13954Fix a typo.13955</change>13956<change date="2 September 2003" version="0.2.91">13957Remove all metadata functions: GetClassMetadata,13958GetFieldMetadata, and GetMethodMetadata.13959</change>13960<change date="1 October 2003" version="0.2.92">13961Mark the functions Allocate. Deallocate, RawMonitor*,13962SetEnvironmentLocalStorage, and GetEnvironmentLocalStorage13963as safe for use in heap callbacks and GC events.13964</change>13965<change date="24 November 2003" version="0.2.93">13966Add pass through opaque user data pointer to heap iterate13967functions and callbacks.13968In the CompiledMethodUnload event, send the code address.13969Add GarbageCollectionOccurred event.13970Add constant pool reference kind.13971Mark the functions CreateRawMonitor and DestroyRawMonitor13972as safe for use in heap callbacks and GC events.13973Clarify: VMDeath, GetCurrentThreadCpuTimerInfo,13974GetThreadCpuTimerInfo, IterateOverReachableObjects,13975IterateOverObjectsReachableFromObject, GetTime and13976JVMTI_ERROR_NULL_POINTER.13977Add missing errors to: GenerateEvents and13978AddToBootstrapClassLoaderSearch.13979Fix description of ClassFileLoadHook name parameter.13980In heap callbacks and GC/ObjectFree events, specify13981that only explicitly allowed functions can be called.13982Allow GetCurrentThreadCpuTimerInfo, GetCurrentThreadCpuTime,13983GetTimerInfo, and GetTime during callback.13984Allow calling SetTag/GetTag during the onload phase.13985SetEventNotificationMode, add: error attempted inappropriate13986thread level control.13987Remove jvmtiExceptionHandlerEntry.13988Fix handling of native methods on the stack --13989location_ptr param of GetFrameLocation, remove13990JVMTI_ERROR_OPAQUE_FRAME from GetFrameLocation,13991jvmtiFrameInfo.location, and jlocation.13992Remove typo (from JVMPI) implying that the MonitorWaited13993event is sent on sleep.13994</change>13995<change date="25 November 2003" version="0.2.94">13996Clarifications and typos.13997</change>13998<change date="3 December 2003" version="0.2.95">13999Allow NULL user_data in heap iterators.14000</change>14001<change date="28 January 2004" version="0.2.97">14002Add GetThreadState, deprecate GetThreadStatus.14003</change>14004<change date="29 January 2004" version="0.2.98">14005INVALID_SLOT and TYPE_MISMATCH errors should be optional.14006</change>14007<change date="12 February 2004" version="0.2.102">14008Remove MonitorContendedExit.14009Added JNIEnv parameter to VMObjectAlloc.14010Clarified definition of class_tag and referrer_index14011parameters to heap callbacks.14012</change>14013<change date="16 Febuary 2004" version="0.2.103">14014Document JAVA_TOOL_OPTIONS.14015</change>14016<change date="17 Febuary 2004" version="0.2.105">14017Divide start phase into primordial and start.14018Add VMStart event14019Change phase associations of functions and events.14020</change>14021<change date="18 Febuary 2004" version="0.3.6">14022Elide deprecated GetThreadStatus.14023Bump minor version, subtract 100 from micro version14024</change>14025<change date="18 Febuary 2004" version="0.3.7">14026Document that timer nanosecond values are unsigned.14027Clarify text having to do with native methods.14028</change>14029<change date="19 Febuary 2004" version="0.3.8">14030Fix typos.14031Remove elided deprecated GetThreadStatus.14032</change>14033<change date="23 Febuary 2004" version="0.3.9">14034Require NotifyFramePop to act on suspended threads.14035</change>14036<change date="24 Febuary 2004" version="0.3.10">14037Add capabilities14038(<internallink id="jvmtiCapabilities.can_redefine_any_class"14039><code>can_redefine_any_class</code></internallink>14040and14041<internallink id="jvmtiCapabilities.can_generate_all_class_hook_events"14042><code>can_generate_all_class_hook_events</code></internallink>)14043and an error (<errorlink id="JVMTI_ERROR_UNMODIFIABLE_CLASS"></errorlink>)14044which allow some classes to be unmodifiable.14045</change>14046<change date="28 Febuary 2004" version="0.3.11">14047Add JVMTI_ERROR_MUST_POSSESS_CAPABILITY to SetEventNotificationMode.14048</change>14049<change date="8 March 2004" version="0.3.12">14050Clarified CompiledMethodUnload so that it is clear the event14051may be posted after the class has been unloaded.14052</change>14053<change date="5 March 2004" version="0.3.13">14054Change the size parameter of VMObjectAlloc to jlong to match GetObjectSize.14055</change>14056<change date="13 March 2004" version="0.3.14">14057Added guideline for the use of the JNI FindClass function in event14058callback functions.14059</change>14060<change date="15 March 2004" version="0.3.15">14061Add GetAllStackTraces and GetThreadListStackTraces.14062</change>14063<change date="19 March 2004" version="0.3.16">14064ClassLoad and ClassPrepare events can be posted during start phase.14065</change>14066<change date="25 March 2004" version="0.3.17">14067Add JVMTI_ERROR_NATIVE_METHOD to GetLineNumberTable, GetLocalVariableTable,14068GetMaxLocals, GetArgumentsSize, GetMethodLocation, GetBytecodes.14069</change>14070<change date="29 March 2004" version="0.3.18">14071Return the timer kind in the timer information structure.14072</change>14073<change date="31 March 2004" version="0.3.19">14074Spec clarifications:14075JVMTI_THREAD_STATE_IN_NATIVE might not include JNI or <jvmti/>.14076ForceGarbageCollection does not run finalizers.14077The context of the specification is the Java platform.14078Warn about early instrumentation.14079</change>14080<change date="1 April 2004" version="0.3.20">14081Refinements to the above clarifications and14082Clarify that an error returned by Agent_OnLoad terminates the VM.14083</change>14084<change date="1 April 2004" version="0.3.21">14085Array class creation does not generate a class load event.14086</change>14087<change date="7 April 2004" version="0.3.22">14088Align thread state hierarchy more closely with java.lang.Thread.State.14089</change>14090<change date="12 April 2004" version="0.3.23">14091Clarify the documentation of thread state.14092</change>14093<change date="19 April 2004" version="0.3.24">14094Remove GarbageCollectionOccurred event -- can be done by agent.14095</change>14096<change date="22 April 2004" version="0.3.25">14097Define "command-line option".14098</change>14099<change date="29 April 2004" version="0.3.26">14100Describe the intended use of bytecode instrumentation.14101Fix description of extension event first parameter.14102</change>14103<change date="30 April 2004" version="0.3.27">14104Clarification and typos.14105</change>14106<change date="18 May 2004" version="0.3.28">14107Remove DataDumpRequest event.14108</change>14109<change date="18 May 2004" version="0.3.29">14110Clarify RawMonitorWait with zero timeout.14111Clarify thread state after RunAgentThread.14112</change>14113<change date="24 May 2004" version="0.3.30">14114Clean-up: fix bad/old links, etc.14115</change>14116<change date="30 May 2004" version="0.3.31">14117Clarifications including:14118All character strings are modified UTF-8.14119Agent thread visibiity.14120Meaning of obsolete method version.14121Thread invoking heap callbacks,14122</change>14123<change date="1 June 2004" version="1.0.32">14124Bump major.minor version numbers to "1.0".14125</change>14126<change date="2 June 2004" version="1.0.33">14127Clarify interaction between ForceGarbageCollection14128and ObjectFree.14129</change>14130<change date="6 June 2004" version="1.0.34">14131Restrict AddToBootstrapClassLoaderSearch and14132SetSystemProperty to the OnLoad phase only.14133</change>14134<change date="11 June 2004" version="1.0.35">14135Fix typo in SetTag.14136</change>14137<change date="18 June 2004" version="1.0.36">14138Fix trademarks.14139Add missing parameter in example GetThreadState usage.14140</change>14141<change date="4 August 2004" version="1.0.37">14142Copyright updates.14143</change>14144<change date="5 November 2004" version="1.0.38">14145Add missing function table layout.14146Add missing description of C++ member function format of functions.14147Clarify that name in CFLH can be NULL.14148Released as part of <tm>J2SE</tm> 5.0.14149</change>14150<change date="24 April 2005" version="1.1.47">14151Bump major.minor version numbers to "1.1".14152Add ForceEarlyReturn* functions.14153Add GetOwnedMonitorStackDepthInfo function.14154Add GetCurrentThread function.14155Add "since" version marker.14156Add AddToSystemClassLoaderSearch.14157Allow AddToBootstrapClassLoaderSearch be used in live phase.14158Fix historic rubbish in the descriptions of the heap_object_callback14159parameter of IterateOverHeap and IterateOverInstancesOfClass functions;14160disallow NULL for this parameter.14161Clarify, correct and make consistent: wording about current thread,14162opaque frames and insufficient number of frames in PopFrame.14163Consistently use "current frame" rather than "topmost".14164Clarify the JVMTI_ERROR_TYPE_MISMATCH errors in GetLocal* and SetLocal*14165by making them compatible with those in ForceEarlyReturn*.14166Many other clarifications and wording clean ups.14167</change>14168<change date="25 April 2005" version="1.1.48">14169Add GetConstantPool.14170Switch references to the first edition of the VM Spec, to the seconds edition.14171</change>14172<change date="26 April 2005" version="1.1.49">14173Clarify minor/major version order in GetConstantPool.14174</change>14175<change date="26 April 2005" version="1.1.50">14176Add SetNativeMethodPrefix and SetNativeMethodPrefixes.14177Reassign GetOwnedMonitorStackDepthInfo to position 153.14178Break out Class Loader Search in its own documentation category.14179Deal with overly long lines in XML source.14180</change>14181<change date="29 April 2005" version="1.1.51">14182Allow agents be started in the live phase.14183Added paragraph about deploying agents.14184</change>14185<change date="30 April 2005" version="1.1.52">14186Add specification description to SetNativeMethodPrefix(es).14187Better define the conditions on GetConstantPool.14188</change>14189<change date="30 April 2005" version="1.1.53">14190Break out the GetClassVersionNumber function from GetConstantPool.14191Clean-up the references to the VM Spec.14192</change>14193<change date="1 May 2005" version="1.1.54">14194Allow SetNativeMethodPrefix(es) in any phase.14195Add clarifications about the impact of redefinition on GetConstantPool.14196</change>14197<change date="2 May 2005" version="1.1.56">14198Various clarifications to SetNativeMethodPrefix(es).14199</change>14200<change date="2 May 2005" version="1.1.57">14201Add missing performance warning to the method entry event.14202</change>14203<change date="5 May 2005" version="1.1.58">14204Remove internal JVMDI support.14205</change>14206<change date="8 May 2005" version="1.1.59">14207Add <functionlink id="RetransformClasses"/>.14208Revamp the bytecode instrumentation documentation.14209Change <functionlink id="IsMethodObsolete"/> to no longer14210require the can_redefine_classes capability.14211</change>14212<change date="11 May 2005" version="1.1.63">14213Clarifications for retransformation.14214</change>14215<change date="11 May 2005" version="1.1.64">14216Clarifications for retransformation, per review.14217Lock "retransformation (in)capable" at class load enable time.14218</change>14219<change date="4 June 2005" version="1.1.67">14220Add new heap functionity which supports reporting primitive values,14221allows setting the referrer tag, and has more powerful filtering:14222FollowReferences, IterateThroughHeap, and their associated14223callbacks, structs, enums, and constants.14224</change>14225<change date="4 June 2005" version="1.1.68">14226Clarification.14227</change>14228<change date="6 June 2005" version="1.1.69">14229FollowReferences, IterateThroughHeap: Put callbacks in a struct;14230Add missing error codes; reduce bits in the visit control flags.14231</change>14232<change date="14 June 2005" version="1.1.70">14233More on new heap functionity: spec clean-up per review.14234</change>14235<change date="15 June 2005" version="1.1.71">14236More on new heap functionity: Rename old heap section to Heap (1.0).14237</change>14238<change date="21 June 2005" version="1.1.72">14239Fix typos.14240</change>14241<change date="27 June 2005" version="1.1.73">14242Make referrer info structure a union.14243</change>14244<change date="9 September 2005" version="1.1.74">14245In new heap functions:14246Add missing superclass reference kind.14247Use a single scheme for computing field indexes.14248Remove outdated references to struct based referrer info.14249</change>14250<change date="12 September 2005" version="1.1.75">14251Don't callback during FollowReferences on frivolous java.lang.Object superclass.14252</change>14253<change date="13 September 2005" version="1.1.76">14254In string primitive callback, length now Unicode length.14255In array and string primitive callbacks, value now "const".14256Note possible compiler impacts on setting JNI function table.14257</change>14258<change date="13 September 2005" version="1.1.77">14259GetClassVersionNumbers() and GetConstantPool() should return14260error on array or primitive class.14261</change>14262<change date="14 September 2005" version="1.1.78">14263Grammar fixes.14264</change>14265<change date="26 September 2005" version="1.1.79">14266Add IsModifiableClass query.14267</change>14268<change date="9 February 2006" version="1.1.81">14269Add referrer_class_tag parameter to jvmtiHeapReferenceCallback.14270</change>14271<change date="13 February 2006" version="1.1.82">14272Doc fixes: update can_redefine_any_class to include retransform.14273Clarify that exception events cover all Throwables.14274In GetStackTrace, no test is done for start_depth too big if start_depth is zero,14275Clarify fields reported in Primitive Field Callback -- static vs instance.14276Repair confusing names of heap types, including callback names.14277Require consistent usage of stack depth in the face of thread launch methods.14278Note incompatibility of <jvmti/> memory management with other systems.14279</change>14280<change date="14 February 2006" version="1.1.85">14281Fix typos and missing renames.14282</change>14283<change date="13 March 2006" version="1.1.86">14284Clarify that jmethodIDs and jfieldIDs can be saved.14285Clarify that Iterate Over Instances Of Class includes subclasses.14286</change>14287<change date="14 March 2006" version="1.1.87">14288Better phrasing.14289</change>14290<change date="16 March 2006" version="1.1.88">14291Match the referrer_index for static fields in Object Reference Callback14292with the Reference Implementation (and all other known implementations);14293that is, make it match the definition for instance fields.14294In GetThreadListStackTraces, add JVMTI_ERROR_INVALID_THREAD to cover14295an invalid thread in the list; and specify that not started threads14296return empty stacks.14297</change>14298<change date="17 March 2006" version="1.1.89">14299Typo.14300</change>14301<change date="25 March 2006" version="1.1.90">14302Typo.14303</change>14304<change date="6 April 2006" version="1.1.91">14305Remove restrictions on AddToBootstrapClassLoaderSearch and14306AddToSystemClassLoaderSearch.14307</change>14308<change date="1 May 2006" version="1.1.93">14309Changed spec to return -1 for monitor stack depth for the14310implementation which can not determine stack depth.14311</change>14312<change date="3 May 2006" version="1.1.94">14313Corrections for readability and accuracy courtesy of Alan Pratt of IBM.14314List the object relationships reported in FollowReferences.14315</change>14316<change date="5 May 2006" version="1.1.95">14317Clarify the object relationships reported in FollowReferences.14318</change>14319<change date="28 June 2006" version="1.1.98">14320Clarify DisposeEnvironment; add warning.14321Fix typos in SetLocalXXX "retrieve" => "set".14322Clarify that native method prefixes must remain set while used.14323Clarify that exactly one Agent_OnXXX is called per agent.14324Clarify that library loading is independent from start-up.14325Remove ambiguous reference to Agent_OnLoad in the Agent_OnUnload spec.14326</change>14327<change date="31 July 2006" version="1.1.99">14328Clarify the interaction between functions and exceptions.14329Clarify and give examples of field indices.14330Remove confusing "That is" sentence from MonitorWait and MonitorWaited events.14331Update links to point to Java 6.14332</change>14333<change date="6 August 2006" version="1.1.102">14334Add ResourceExhaustedEvent.14335</change>14336<change date="11 October 2012" version="1.2.2">14337Fixed the "HTTP" and "Missing Anchor" errors reported by the LinkCheck tool.14338</change>14339<change date="19 June 2013" version="1.2.3">14340Added support for statically linked agents.14341</change>14342</changehistory>1434314344</specification>14345<!-- Keep this comment at the end of the file14346Local variables:14347mode: sgml14348sgml-omittag:t14349sgml-shorttag:t14350sgml-namecase-general:t14351sgml-general-insert-case:lower14352sgml-minimize-attributes:nil14353sgml-always-quote-attributes:t14354sgml-indent-step:214355sgml-indent-data:t14356sgml-parent-document:nil14357sgml-exposed-tags:nil14358sgml-local-catalogs:nil14359sgml-local-ecat-files:nil14360End:14361-->143621436314364