Blame SOURCES/PStack-808293.patch

9bf359
--- jdk8/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/PStack.java	2012-04-06 02:26:33.322164601 +0200
9bf359
+++ jdk8/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/PStack.java	2012-04-06 02:26:57.958514071 +0200
9bf359
@@ -1,5 +1,6 @@
9bf359
 /*
9bf359
  * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
9bf359
+ * Copyright (c) 2012, Red Hat Inc.
9bf359
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9bf359
  *
9bf359
  * This code is free software; you can redistribute it and/or modify it
9bf359
@@ -84,7 +85,8 @@
9bf359
                out.print("----------------- ");
9bf359
                out.print(th);
9bf359
                out.println(" -----------------");
9bf359
-               while (f != null) {
9bf359
+               int maxStack = 256;
9bf359
+               while (f != null && maxStack-- > 0) {
9bf359
                   ClosestSymbol sym = f.closestSymbolToPC();
9bf359
                   Address pc = f.pc();
9bf359
                   out.print(pc + "\t");
9bf359
@@ -158,10 +160,19 @@
9bf359
                          }
9bf359
                       }
9bf359
                   }
9bf359
+                  Address oldPC = f.pc();
9bf359
+                  Address oldFP = f.localVariableBase();
9bf359
                   f = f.sender(th);
9bf359
+                  if (f != null
9bf359
+                      && oldPC.equals(f.pc())
9bf359
+                      && oldFP.equals(f.localVariableBase())) {
9bf359
+                      // We didn't make any progress
9bf359
+                      f = null;
9bf359
+                  }
9bf359
                }
9bf359
             } catch (Exception exp) {
9bf359
-               exp.printStackTrace();
9bf359
+               // exp.printStackTrace();
9bf359
+               out.println("bad stack: " + exp);
9bf359
                // continue, may be we can do a better job for other threads
9bf359
             }
9bf359
             if (concurrentLocks) {