New JVMTI function / new JVMTI version

Keith McGuigan keith.mcguigan at
Tue Nov 30 13:11:05 PST 2010


I'd like to propose a new revision of the JVMTI spec, 1.2.1 to be  
implemented by Hotspot in JDK 7, with the addition of a new method,  
GetThisObject() (defined below).  This new function would be part of  
the 'Local Variable" set of functions.  The motivation for this  
addition is better filtering of JDI events in the situations where  
events are raised in the context of a native method.  This function  
would use a new slot in the function pointer table, so the 1.2 version  
of JVMTI will be backward-compatible with version 1.1.  Clients using  
JVMTI 1.1 or 1.0 would be unaffected by this change, other than  
observing that GetVersion() function returns the new revision number.

Comments?  Suggestions? Complaints?

Get This Object

GetThisObject(jvmtiEnv* env,
             jthread thread,
             jint depth,
             jobject* value_ptr)
This function can be used to retrieve the value of the local object  
variable at slot 0 (the "this" object) from non-static frames. This  
function can retrieve the "this" object from native activations,  
whereas GetLocalObject() would return JVMTI_ERROR_OPAQUE_FRAME for  
those frames.

Phase	Callback Safe	Position	Since
may only be called during the live phase	 No	155	1.2

Optional Functionality: might not be implemented for all virtual  
machines. The following capability (as returned by GetCapabilities)  
must be true to use this function.
Capability	 Effect
can_access_local_variables	 Can set and get local variables

Name	 Type	 Description
thread	jthread	 The thread of the frame containing the variable's  
value. If thread is NULL, the current thread is used.
depth	jint	 The depth of the frame containing the variable's value.
value_ptr	jobject*	 On return, points to the variable's value.

Agent passes a pointer to a jobject. On return, the jobject has been  
set. The object returned by value_ptr is a JNI local reference and  
must be managed.

This function returns either a universal error or one of the following  
Error	 Description
JVMTI_ERROR_MUST_POSSESS_CAPABILITY	 The environment does not possess  
the capability can_access_local_variables. Use AddCapabilities.
JVMTI_ERROR_INVALID_SLOT	 If the activation corresponds to a static  
JVMTI_ERROR_INVALID_THREAD	thread is not a thread object.
JVMTI_ERROR_THREAD_NOT_ALIVE	thread is not live (has not been started  
or is now dead).
JVMTI_ERROR_ILLEGAL_ARGUMENT	depth is less than zero.
JVMTI_ERROR_NO_MORE_FRAMES	 There are no stack frames at the specified  
-------------- next part --------------
An HTML attachment was scrubbed...

More information about the serviceability-dev mailing list