changeset 6798:3503744d5b23

8049881: jstack not working on core files Summary: Access _trace_id field of Klass in try-catch block Reviewed-by: dholmes, dsamersoff, mgronlun
author poonam
date Tue, 22 Jul 2014 06:34:42 -0700
parents ec757fe48123
children c0e87c6d7975
files agent/src/share/classes/sun/jvm/hotspot/oops/Klass.java
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/agent/src/share/classes/sun/jvm/hotspot/oops/Klass.java	Mon Jul 21 09:48:38 2014 -0400
+++ b/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.