File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -868,7 +868,24 @@ jvmtiInternalGetStackTrace(
868
868
}
869
869
walkState.skipCount = framesWalked + start_depth;
870
870
}
871
+
871
872
walkState.maxFrames = max_frame_count;
873
+
874
+ #if JAVA_SPEC_VERSION >= 20
875
+ /* Adjusts the second‑pass stack walk limit (maxFrames) to include the
876
+ * number of frames skipped in the first pass (userData1).
877
+ *
878
+ * When the first pass walks more frames than the original max_frame_count,
879
+ * the skipped frame count is added to the limit so that, after skipping,
880
+ * up to max_frame_count frames can still be returned to the caller.
881
+ */
882
+ if (walkState.framesWalked > max_frame_count) {
883
+ UDATA skippedFrames = (UDATA)walkState.userData1 ;
884
+ Assert_JVMTI_true (skippedFrames <= (UDATA_MAX - max_frame_count));
885
+ walkState.maxFrames += skippedFrames;
886
+ }
887
+ #endif /* JAVA_SPEC_VERSION >= 20 */
888
+
872
889
walkState.flags = J9_STACKWALK_INCLUDE_NATIVES | J9_STACKWALK_VISIBLE_ONLY
873
890
| J9_STACKWALK_RECORD_BYTECODE_PC_OFFSET | J9_STACKWALK_COUNT_SPECIFIED
874
891
| J9_STACKWALK_ITERATE_FRAMES;
You can’t perform that action at this time.
0 commit comments