8302320: AsyncGetCallTrace obtains too few frames in sanity test
Reviewed-by: jvernee, dholmes, rrich
This commit is contained in:
parent
02eb240c71
commit
db483a38a8
src/hotspot/cpu/x86
test/hotspot/jtreg/serviceability/AsyncGetCallTrace
@ -68,8 +68,11 @@ bool frame::safe_for_sender(JavaThread *thread) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// unextended sp must be within the stack and above or equal sp
|
||||
if (!thread->is_in_stack_range_incl(unextended_sp, sp)) {
|
||||
// unextended sp must be within the stack
|
||||
// Note: sp can be greater than unextended_sp in the case of
|
||||
// interpreted -> interpreted calls that go through a method handle linker,
|
||||
// since those pop the last argument (the appendix) from the stack.
|
||||
if (!thread->is_in_stack_range_incl(unextended_sp, sp - Interpreter::stackElementSize)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -230,7 +230,40 @@ Java_MyPackage_ASGCTBaseTest_checkAsyncGetCallTraceCall(JNIEnv* env, jclass cls)
|
||||
return false;
|
||||
}
|
||||
|
||||
return strcmp(name.get(), "checkAsyncGetCallTraceCall") == 0;
|
||||
if (strcmp(name.get(), "checkAsyncGetCallTraceCall") != 0) {
|
||||
fprintf(stderr, "Name is not checkAsyncGetCallTraceCall: %s\n", name.get());
|
||||
return false;
|
||||
}
|
||||
|
||||
// AsyncGetCallTrace and GetStackTrace should return comparable frames
|
||||
// so we obtain the frames using GetStackTrace and compare them.
|
||||
|
||||
jthread thread;
|
||||
jvmti->GetCurrentThread(&thread);
|
||||
jvmtiFrameInfo gstFrames[MAX_DEPTH];
|
||||
jint gstCount = 0;
|
||||
|
||||
jvmti->GetStackTrace(thread, 0, MAX_DEPTH, gstFrames, &gstCount);
|
||||
|
||||
if (gstCount != trace.num_frames) {
|
||||
fprintf(stderr, "GetStackTrace and AsyncGetCallTrace return different number of frames: %d vs %d)", gstCount, trace.num_frames);
|
||||
return false;
|
||||
}
|
||||
|
||||
for (int i = 0; i < trace.num_frames; ++i) {
|
||||
if (trace.frames[i].lineno == -3) {
|
||||
if (gstFrames[i].location != -1) {
|
||||
fprintf(stderr, "%d: ASGCT found native frame but GST did not\n", i);
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (gstFrames[i].method != trace.frames[i].method_id) {
|
||||
fprintf(stderr, "%d: method_id mismatch: %p vs %p\n", i, gstFrames[i].method, trace.frames[i].method_id);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user