19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 package sun.jvm.hotspot;
26
27 import java.io.*;
28 import java.awt.*;
29 import java.awt.event.*;
30 import java.math.*;
31 import javax.swing.*;
32 import javax.swing.tree.*;
33 import java.util.*;
34
35 import sun.jvm.hotspot.code.*;
36 import sun.jvm.hotspot.compiler.*;
37 import sun.jvm.hotspot.debugger.*;
38 import sun.jvm.hotspot.gc_implementation.parallelScavenge.*;
39 import sun.jvm.hotspot.gc_interface.*;
40 import sun.jvm.hotspot.interpreter.*;
41 import sun.jvm.hotspot.memory.*;
42 import sun.jvm.hotspot.oops.*;
43 import sun.jvm.hotspot.runtime.*;
44 import sun.jvm.hotspot.ui.*;
45 import sun.jvm.hotspot.ui.tree.*;
46 import sun.jvm.hotspot.ui.classbrowser.*;
47 import sun.jvm.hotspot.utilities.*;
48
49 /** The top-level HotSpot Debugger. FIXME: make this an embeddable
50 component! (Among other things, figure out what to do with the
51 menu bar...) */
52
53 public class HSDB implements ObjectHistogramPanel.Listener, SAListener {
54 public static void main(String[] args) {
55 new HSDB(args).run();
56 }
57
58 //--------------------------------------------------------------------------------
1074 anno = "NewGen ";
1075 } else if (i == 1) {
1076 anno = "OldGen ";
1077 } else {
1078 anno = "Gen " + i + " ";
1079 }
1080 bad = false;
1081 break;
1082 }
1083 }
1084
1085 } else if (collHeap instanceof ParallelScavengeHeap) {
1086 ParallelScavengeHeap heap = (ParallelScavengeHeap) collHeap;
1087 if (heap.youngGen().isIn(handle)) {
1088 anno = "PSYoungGen ";
1089 bad = false;
1090 } else if (heap.oldGen().isIn(handle)) {
1091 anno = "PSOldGen ";
1092 bad = false;
1093 }
1094 } else {
1095 // Optimistically assume the oop isn't bad
1096 anno = "[Unknown generation] ";
1097 bad = false;
1098 }
1099
1100 if (!bad) {
1101 try {
1102 Oop oop = VM.getVM().getObjectHeap().newOop(handle);
1103 if (oop instanceof Instance) {
1104 // Java-level objects always have workable names
1105 anno = anno + oop.getKlass().getName().asString();
1106 } else {
1107 ByteArrayOutputStream bos = new ByteArrayOutputStream();
1108 Oop.printOopValueOn(oop, new PrintStream(bos));
1109 anno = anno + bos.toString();
1110 }
1111 }
1112 catch (AddressException e) {
1113 anno += "CORRUPT OOP";
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 package sun.jvm.hotspot;
26
27 import java.io.*;
28 import java.awt.*;
29 import java.awt.event.*;
30 import java.math.*;
31 import javax.swing.*;
32 import javax.swing.tree.*;
33 import java.util.*;
34
35 import sun.jvm.hotspot.code.*;
36 import sun.jvm.hotspot.compiler.*;
37 import sun.jvm.hotspot.debugger.*;
38 import sun.jvm.hotspot.gc_implementation.parallelScavenge.*;
39 import sun.jvm.hotspot.gc_implementation.shenandoah.*;
40 import sun.jvm.hotspot.gc_interface.*;
41 import sun.jvm.hotspot.interpreter.*;
42 import sun.jvm.hotspot.memory.*;
43 import sun.jvm.hotspot.oops.*;
44 import sun.jvm.hotspot.runtime.*;
45 import sun.jvm.hotspot.ui.*;
46 import sun.jvm.hotspot.ui.tree.*;
47 import sun.jvm.hotspot.ui.classbrowser.*;
48 import sun.jvm.hotspot.utilities.*;
49
50 /** The top-level HotSpot Debugger. FIXME: make this an embeddable
51 component! (Among other things, figure out what to do with the
52 menu bar...) */
53
54 public class HSDB implements ObjectHistogramPanel.Listener, SAListener {
55 public static void main(String[] args) {
56 new HSDB(args).run();
57 }
58
59 //--------------------------------------------------------------------------------
1075 anno = "NewGen ";
1076 } else if (i == 1) {
1077 anno = "OldGen ";
1078 } else {
1079 anno = "Gen " + i + " ";
1080 }
1081 bad = false;
1082 break;
1083 }
1084 }
1085
1086 } else if (collHeap instanceof ParallelScavengeHeap) {
1087 ParallelScavengeHeap heap = (ParallelScavengeHeap) collHeap;
1088 if (heap.youngGen().isIn(handle)) {
1089 anno = "PSYoungGen ";
1090 bad = false;
1091 } else if (heap.oldGen().isIn(handle)) {
1092 anno = "PSOldGen ";
1093 bad = false;
1094 }
1095 } else if (collHeap instanceof ShenandoahHeap) {
1096 ShenandoahHeap heap = (ShenandoahHeap) collHeap;
1097 anno = "ShenandoahHeap ";
1098 bad = false;
1099 } else {
1100 // Optimistically assume the oop isn't bad
1101 anno = "[Unknown generation] ";
1102 bad = false;
1103 }
1104
1105 if (!bad) {
1106 try {
1107 Oop oop = VM.getVM().getObjectHeap().newOop(handle);
1108 if (oop instanceof Instance) {
1109 // Java-level objects always have workable names
1110 anno = anno + oop.getKlass().getName().asString();
1111 } else {
1112 ByteArrayOutputStream bos = new ByteArrayOutputStream();
1113 Oop.printOopValueOn(oop, new PrintStream(bos));
1114 anno = anno + bos.toString();
1115 }
1116 }
1117 catch (AddressException e) {
1118 anno += "CORRUPT OOP";
|