1 /*
2 * Copyright 2005-2008 Sun Microsystems, Inc. All Rights Reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
20 * CA 95054 USA or visit www.sun.com if you need additional information or
21 * have any questions.
22 *
23 */
24
25 package sun.jvm.hotspot;
26
27 import java.io.*;
28 import java.math.*;
29 import java.util.*;
30 import java.util.regex.*;
31
32 import sun.jvm.hotspot.types.Type;
33 import sun.jvm.hotspot.types.Field;
34 import sun.jvm.hotspot.HotSpotTypeDataBase;
35 import sun.jvm.hotspot.types.basic.BasicType;
36 import sun.jvm.hotspot.types.CIntegerType;
37 import sun.jvm.hotspot.code.*;
38 import sun.jvm.hotspot.compiler.*;
39 import sun.jvm.hotspot.debugger.*;
40 import sun.jvm.hotspot.interpreter.*;
906 while (base != null && base.lessThan(end)) {
907 Address val = base.getAddressAt(0);
908 if (AddressOps.equal(val, value)) {
909 if (!printed) {
910 printed = true;
911 blob.printOn(out);
912 }
913 out.println("found at " + base + "\n");
914 }
915 base = base.addOffsetTo(stride);
916 }
917 }
918 public void epilogue() {
919 }
920
921
922 };
923 VM.getVM().getCodeCache().iterate(v);
924
925 }
926 }
927 }
928 },
929 new Command("where", "where { -a | id }", false) {
930 public void doit(Tokens t) {
931 if (t.countTokens() != 1) {
932 usage();
933 } else {
934 String name = t.nextToken();
935 Threads threads = VM.getVM().getThreads();
936 boolean all = name.equals("-a");
937 for (JavaThread thread = threads.first(); thread != null; thread = thread.next()) {
938 StringWriter sw = new StringWriter();
939 ByteArrayOutputStream bos = new ByteArrayOutputStream();
940 thread.printThreadIDOn(new PrintStream(bos));
941 if (all || bos.toString().equals(name)) {
942 HTMLGenerator gen = new HTMLGenerator(false);
943 out.println(gen.genHTMLForJavaStackTrace(thread));
944 if (!all) return;
945 }
|
1 /*
2 * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores,
20 * CA 94065 USA or visit www.oracle.com if you need additional information or
21 * have any questions.
22 *
23 */
24
25 package sun.jvm.hotspot;
26
27 import java.io.*;
28 import java.math.*;
29 import java.util.*;
30 import java.util.regex.*;
31
32 import sun.jvm.hotspot.types.Type;
33 import sun.jvm.hotspot.types.Field;
34 import sun.jvm.hotspot.HotSpotTypeDataBase;
35 import sun.jvm.hotspot.types.basic.BasicType;
36 import sun.jvm.hotspot.types.CIntegerType;
37 import sun.jvm.hotspot.code.*;
38 import sun.jvm.hotspot.compiler.*;
39 import sun.jvm.hotspot.debugger.*;
40 import sun.jvm.hotspot.interpreter.*;
906 while (base != null && base.lessThan(end)) {
907 Address val = base.getAddressAt(0);
908 if (AddressOps.equal(val, value)) {
909 if (!printed) {
910 printed = true;
911 blob.printOn(out);
912 }
913 out.println("found at " + base + "\n");
914 }
915 base = base.addOffsetTo(stride);
916 }
917 }
918 public void epilogue() {
919 }
920
921
922 };
923 VM.getVM().getCodeCache().iterate(v);
924
925 }
926 }
927 }
928 },
929 new Command("dumpcodecache", "dumpcodecache", false) {
930 public void doit(Tokens t) {
931 if (t.countTokens() != 0) {
932 usage();
933 } else {
934 final PrintStream fout = out;
935 final HTMLGenerator gen = new HTMLGenerator(false);
936 CodeCacheVisitor v = new CodeCacheVisitor() {
937 public void prologue(Address start, Address end) {
938 }
939 public void visit(CodeBlob blob) {
940 fout.println(gen.genHTML(blob.instructionsBegin()));
941 }
942 public void epilogue() {
943 }
944
945
946 };
947 VM.getVM().getCodeCache().iterate(v);
948 }
949 }
950 },
951 new Command("where", "where { -a | id }", false) {
952 public void doit(Tokens t) {
953 if (t.countTokens() != 1) {
954 usage();
955 } else {
956 String name = t.nextToken();
957 Threads threads = VM.getVM().getThreads();
958 boolean all = name.equals("-a");
959 for (JavaThread thread = threads.first(); thread != null; thread = thread.next()) {
960 StringWriter sw = new StringWriter();
961 ByteArrayOutputStream bos = new ByteArrayOutputStream();
962 thread.printThreadIDOn(new PrintStream(bos));
963 if (all || bos.toString().equals(name)) {
964 HTMLGenerator gen = new HTMLGenerator(false);
965 out.println(gen.genHTMLForJavaStackTrace(thread));
966 if (!all) return;
967 }
|