RFR (XS): 8003690: Example code in JVMTI GetStackTrace documentation is broken
serguei.spitsyn at oracle.com
serguei.spitsyn at oracle.com
Tue Nov 20 10:06:47 PST 2012
Mikael,
The fix looks good.
Thank you for fixing it!
The first
The second problem was introduced when the JVMTI was updated with generics.
The GetMethodName got an extra parameter for generic signature,
but this code snippet was not fixed at this time.
Thanks,
Serguei
On 11/20/12 8:52 AM, Mikael Vidstedt wrote:
>
> In the JVMTI documentation for GetStackTrace there is a code snippet
> outlining how to use the functionality:
>
> jvmtiFrameInfo frames[5];
> jint count;
> jvmtiError err;
>
> err = (*jvmti)->GetStackTrace(jvmti, aThread, 0, 5,
> &frames, &count);
> if (err == JVMTI_ERROR_NONE && count >= 1) {
> char *methodName;
> err = (*jvmti)->GetMethodName(jvmti, frames[0].method,
> &methodName, NULL);
> if (err == JVMTI_ERROR_NONE) {
> printf("Executing method: %s", methodName);
> }
> }
>
> There are two errors in the code:
>
> 1. The 5th argument to GetStackTrace (frames) should not have an
> ampersand
> 2. GetMethodName takes 5 parameters, but the example only passes four
> parameters to it
>
> Please review the following change:
>
> http://cr.openjdk.java.net/~mikael/8003690/webrev.00/
>
> Thanks,
> Mikael
>
More information about the serviceability-dev
mailing list