8049881: jstack not working on core files
Summary: Access _trace_id field of Klass in try-catch block
Reviewed-by: dholmes, dsamersoff, mgronlun
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Klass.java Mon Jul 21 09:48:38 2014 -0400
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Klass.java Tue Jul 22 06:34:42 2014 -0700
@@ -55,7 +55,10 @@
layoutHelper = new IntField(type.getJIntField("_layout_helper"), 0);
name = type.getAddressField("_name");
accessFlags = new CIntField(type.getCIntegerField("_access_flags"), 0);
- traceIDField = type.getField("_trace_id");
+ try {
+ traceIDField = type.getField("_trace_id");
+ } catch(Exception e) {
+ }
subklass = new MetadataField(type.getAddressField("_subklass"), 0);
nextSibling = new MetadataField(type.getAddressField("_next_sibling"), 0);
@@ -108,7 +111,11 @@
public AccessFlags getAccessFlagsObj(){ return new AccessFlags(getAccessFlags()); }
public Klass getSubklassKlass() { return (Klass) subklass.getValue(this); }
public Klass getNextSiblingKlass() { return (Klass) nextSibling.getValue(this); }
- public long traceID() { return traceIDField.getJLong(addr); }
+
+ public long traceID() {
+ if (traceIDField == null) return 0;
+ return traceIDField.getJLong(addr);
+ }
// computed access flags - takes care of inner classes etc.
// This is closer to actual source level than getAccessFlags() etc.