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