hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/Debugger.java
author coleenp
Sun, 13 Apr 2008 17:43:42 -0400
changeset 360 21d113ecbf6a
parent 1 489c9b5090e2
child 670 ddf3e9583f2f
permissions -rw-r--r--
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes Summary: Compressed oops in instances, arrays, and headers. Code contributors are coleenp, phh, never, swamyv Reviewed-by: jmasa, kamg, acorn, tbell, kvn, rasbold
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
489c9b5090e2 Initial load
duke
parents:
diff changeset
     2
 * Copyright 2000-2002 Sun Microsystems, Inc.  All Rights Reserved.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    19
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    20
 * CA 95054 USA or visit www.sun.com if you need additional information or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    21
 * have any questions.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
489c9b5090e2 Initial load
duke
parents:
diff changeset
    25
package sun.jvm.hotspot.debugger;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    26
489c9b5090e2 Initial load
duke
parents:
diff changeset
    27
import java.util.*;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    28
import sun.jvm.hotspot.debugger.cdbg.CDebugger;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    29
489c9b5090e2 Initial load
duke
parents:
diff changeset
    30
public interface Debugger extends SymbolLookup, ThreadAccess {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    31
  /** Indicates whether this underlying debugger can provide a list of
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
      currently-running processes. */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
  public boolean hasProcessList() throws DebuggerException;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
  /** Provide a snapshot of the list of currently-running processes in
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
      the form of a List of ProcessInfo objects. Must only be called
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
      if hasProcessList(), above, returns true. */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
  public List getProcessList() throws DebuggerException;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
  /** If an error occurs during attachment (i.e., "no such process"),
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
      the thrown DebuggerException will contain a description of the
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
      error in its message string. */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
  public void attach(int processID) throws DebuggerException;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
  /** This attaches the debugger to the given coreFileName, which is
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
      assumed to have been generated from the specified
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
      executableName. If an error occurs during loading of the core
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
      file (i.e., "no such file"), the thrown DebuggerException will
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
      contain a description of the error in its message string. */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
  public void attach(String executableName, String coreFileName)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
    throws DebuggerException;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
  /** Detach from the remote process. Returns false if not currently
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
      attached. */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
  public boolean detach() throws DebuggerException;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
  /** Parse an address from a hex string in the format "0xFFFFFFFF".
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
      The length of the address (i.e., 32 or 64 bits) is platform
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
      dependent. This method should ONLY be used by routines which
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
      need to interact with the user and parse a string entered by
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
      hand; for example, a graphical user interface. This routine
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
      should NOT be used to subvert the current safety mechanisms in
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
      the system which prevent arbitrary conversion from Address to
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
      long and back. */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
  public Address parseAddress(String addressString)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
    throws NumberFormatException, DebuggerException;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
  /** Returns the 64-bit value of an Address. This method should ONLY
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
      be used when implementing a debugger which needs to interface to
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
      C and which needs a unique identifier for certain objects. */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
  public long getAddressValue(Address addr) throws DebuggerException;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
  /** Support for remote debugging. Get the name of the operating
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
      system on which this debugger is running (to be able to properly
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
      configure the local system). Typical return values are
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
      "solaris", "linux", "win32"; see utilities/PlatformInfo.java. */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
  public String getOS() throws DebuggerException;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
  /** Support for remote debugging. Get the name of the CPU type on
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
      which this debugger is running (to be able to properly configure
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
      the local system). Typical return values are "sparc", "x86"; see
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
      utilities/PlatformInfo.java. */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
  public String getCPU() throws DebuggerException;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
  /** Retrieve the machine description for the underlying hardware for
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
      the cases in which we need to do, for example, machine-dependent
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
      byte swapping */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
  public MachineDescription getMachineDescription() throws DebuggerException;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
  /** Find out whether this debugger has a console available on which
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
      commands can be executed; see executeCommandOnConsole, below.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
      This is an interim routine designed to allow access to the
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
      underlying dbx process on Solaris until we have disassembly,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
      etc. in the SA. */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
  public boolean hasConsole() throws DebuggerException;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
  /** If the underlying debugger has a console (as dbx does), this
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
      provides access to it. Takes in a platform-dependent String,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
      executes it on the debugger's console, and returns any output as
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
      a String. */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
  public String consoleExecuteCommand(String cmd) throws DebuggerException;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
  /** If the underlying debugger has a console, this returns the
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
      debugger-specific prompt which should be displayed. */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
  public String getConsolePrompt() throws DebuggerException;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
  /** If this platform supports C/C++ debugging via the CDebugger
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
      interface, returns a CDebugger object; otherwise returns
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
      null. */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
  public CDebugger getCDebugger() throws DebuggerException;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
  /** the following methods are intended only for RemoteDebuggerClient */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
  public long getJBooleanSize();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
  public long getJByteSize();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
  public long getJCharSize();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
  public long getJDoubleSize();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
  public long getJFloatSize();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
  public long getJIntSize();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
  public long getJLongSize();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
  public long getJShortSize();
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   121
  public long getHeapBase();
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   122
  public long getHeapOopSize();
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   123
  public long getLogMinObjAlignmentInBytes();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
  public ReadResult readBytesFromProcess(long address, long numBytes)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
    throws DebuggerException;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
  public void writeBytesToProcess(long address, long numBytes, byte[] data)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
    throws UnmappedAddressException, DebuggerException;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
}