Blame SOURCES/PStack-808293.patch

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