agent/src/share/classes/sun/jvm/hotspot/TestDebugger.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File 7088955 Sdiff agent/src/share/classes/sun/jvm/hotspot

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

Print this page


   1 /*
   2  * Copyright (c) 2000, 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, 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 sun.jvm.hotspot.debugger.*;
  28 import sun.jvm.hotspot.debugger.dbx.*;
  29 
  30 // A test of the debugger backend. This should be used to connect to
  31 // the helloWorld.cpp program.
  32 
  33 public class TestDebugger {
  34   // FIXME: make these configurable, i.e., via a dotfile
  35   private static final String dbxPathName               = "/export/home/kbr/ws/dbx_61/dev/Derived-sparcv9-S2./src/dbx/dbx";
  36   private static final String[] dbxSvcAgentDSOPathNames =
  37     new String[] {
  38       "/export/home/kbr/main/sa_baseline/src/os/solaris/agent/libsvc_agent_dbx.so"
  39     };
  40 
  41   private static void usage() {
  42     System.out.println("usage: java TestDebugger [pid]");
  43     System.out.println("pid must be the process ID of the helloWorld process");
  44     System.exit(1);
  45   }
  46 
  47   public static void main(String[] args) {
  48     try {
  49       if (args.length != 1) {
  50         usage();
  51       }
  52 
  53       int pid = 0;
  54       try {
  55         pid = Integer.parseInt(args[0]);
  56       }
  57       catch (NumberFormatException e) {
  58         usage();
  59       }
  60 
  61       JVMDebugger debugger = new DbxDebuggerLocal(new MachineDescriptionSPARC64Bit(),
  62                                                   dbxPathName, dbxSvcAgentDSOPathNames, true);
  63 
  64       try {
  65         debugger.attach(pid);
  66       }
  67       catch (DebuggerException e) {
  68         System.err.print("Error attaching to process ID " + pid + ": ");
  69         if (e.getMessage() != null) {
  70           System.err.print(e.getMessage());
  71         }
  72         System.err.println();
  73         System.exit(1);
  74       }
  75 
  76       // HACK: configure debugger with primitive type sizes to get
  77       // Java types going
  78       debugger.configureJavaPrimitiveTypeSizes(1, 1, 2, 8, 4, 4, 8, 2);
  79 
  80       // FIXME: figure out how to canonicalize and/or eliminate
  81       // loadobject specification
  82       String loadObjectName = "-";


   1 /*
   2  * Copyright (c) 2000, 2011, 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, 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 sun.jvm.hotspot.debugger.*;
  28 import sun.jvm.hotspot.debugger.proc.*;
  29 
  30 // A test of the debugger backend. This should be used to connect to
  31 // the helloWorld.cpp program.
  32 
  33 public class TestDebugger {






  34 
  35   private static void usage() {
  36     System.out.println("usage: java TestDebugger [pid]");
  37     System.out.println("pid must be the process ID of the helloWorld process");
  38     System.exit(1);
  39   }
  40 
  41   public static void main(String[] args) {
  42     try {
  43       if (args.length != 1) {
  44         usage();
  45       }
  46 
  47       int pid = 0;
  48       try {
  49         pid = Integer.parseInt(args[0]);
  50       }
  51       catch (NumberFormatException e) {
  52         usage();
  53       }
  54 
  55       JVMDebugger debugger = new ProcDebuggerLocal(null, true);

  56 
  57       try {
  58         debugger.attach(pid);
  59       }
  60       catch (DebuggerException e) {
  61         System.err.print("Error attaching to process ID " + pid + ": ");
  62         if (e.getMessage() != null) {
  63           System.err.print(e.getMessage());
  64         }
  65         System.err.println();
  66         System.exit(1);
  67       }
  68 
  69       // HACK: configure debugger with primitive type sizes to get
  70       // Java types going
  71       debugger.configureJavaPrimitiveTypeSizes(1, 1, 2, 8, 4, 4, 8, 2);
  72 
  73       // FIXME: figure out how to canonicalize and/or eliminate
  74       // loadobject specification
  75       String loadObjectName = "-";


agent/src/share/classes/sun/jvm/hotspot/TestDebugger.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File