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 } 946 } 947 if (!all) out.println("Couldn't find thread " + name); 948 } | 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 } 968 } 969 if (!all) out.println("Couldn't find thread " + name); 970 } |