src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/x86/X86CurrentFrameGuess.java
changeset 59065 5f458adec06b
parent 47216 71c04702a3d5
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/x86/X86CurrentFrameGuess.java	Wed Nov 13 11:34:31 2019 -0800
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/x86/X86CurrentFrameGuess.java	Wed Nov 13 13:05:16 2019 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -137,7 +137,16 @@
                 setValues(curSP, null, pc);
                 return true;
               }
+              Frame oldFrame = frame;
               frame = frame.sender(map);
+              if (frame.getSP().lessThanOrEqual(oldFrame.getSP())) {
+                  // Frame points to itself or to a location in the wrong direction.
+                  // Break the loop and move on to next offset.
+                  if (DEBUG) {
+                      System.out.println("X86CurrentFrameGuess.run: frame <= oldFrame: " + frame);
+                  }
+                  break;
+              }
             }
           } catch (Exception e) {
             if (DEBUG) {