hotspot/agent/src/share/classes/sun/jvm/hotspot/CommandProcessor.java

Print this page
rev 611 : Merge
   1 /*
   2  * Copyright 2005 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  *  


 868                             out.println("Searching " + base + " " + end);
 869                             while (base != null && base.lessThan(end)) {
 870                                 Address val = base.getAddressAt(0);
 871                                 if (AddressOps.equal(val, value)) {
 872                                     out.println(base);
 873                                 }
 874                                 base = base.addOffsetTo(stride);
 875                             }
 876                         }
 877                     } else if (type.equals("heap")) {
 878                         RawHeapVisitor iterator = new RawHeapVisitor() {
 879                                 public void prologue(long used) {
 880                                 }
 881         
 882                                 public void visitAddress(Address addr) {
 883                                     Address val = addr.getAddressAt(0);
 884                                     if (AddressOps.equal(val, value)) {
 885                                         out.println("found at " + addr);
 886                                     }
 887                                 }
 888 





 889                                 public void epilogue() {
 890                                 }
 891                             };
 892                         VM.getVM().getObjectHeap().iterateRaw(iterator);
 893                     } else if (type.equals("codecache")) {
 894                         CodeCacheVisitor v = new CodeCacheVisitor() {
 895                                 public void prologue(Address start, Address end) {
 896                                 }
 897                                 public void visit(CodeBlob blob) {
 898                                     boolean printed = false;
 899                                     Address base = blob.getAddress();
 900                                     Address end = base.addOffsetTo(blob.getSize());
 901                                     while (base != null && base.lessThan(end)) {
 902                                         Address val = base.getAddressAt(0);
 903                                         if (AddressOps.equal(val, value)) {
 904                                             if (!printed) {
 905                                                 printed = true;
 906                                                 blob.printOn(out);
 907                                             }
 908                                             out.println("found at " + base + "\n");


   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  *  


 868                             out.println("Searching " + base + " " + end);
 869                             while (base != null && base.lessThan(end)) {
 870                                 Address val = base.getAddressAt(0);
 871                                 if (AddressOps.equal(val, value)) {
 872                                     out.println(base);
 873                                 }
 874                                 base = base.addOffsetTo(stride);
 875                             }
 876                         }
 877                     } else if (type.equals("heap")) {
 878                         RawHeapVisitor iterator = new RawHeapVisitor() {
 879                                 public void prologue(long used) {
 880                                 }
 881         
 882                                 public void visitAddress(Address addr) {
 883                                     Address val = addr.getAddressAt(0);
 884                                     if (AddressOps.equal(val, value)) {
 885                                         out.println("found at " + addr);
 886                                     }
 887                                 }
 888                                 public void visitCompOopAddress(Address addr) {
 889                                     Address val = addr.getCompOopAddressAt(0);
 890                                     if (AddressOps.equal(val, value)) {
 891                                         out.println("found at " + addr);
 892                                     }
 893                                 }
 894                                 public void epilogue() {
 895                                 }
 896                             };
 897                         VM.getVM().getObjectHeap().iterateRaw(iterator);
 898                     } else if (type.equals("codecache")) {
 899                         CodeCacheVisitor v = new CodeCacheVisitor() {
 900                                 public void prologue(Address start, Address end) {
 901                                 }
 902                                 public void visit(CodeBlob blob) {
 903                                     boolean printed = false;
 904                                     Address base = blob.getAddress();
 905                                     Address end = base.addOffsetTo(blob.getSize());
 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");