Path: blob/master/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/Debugger.java
41161 views
/*1* Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*22*/2324package sun.jvm.hotspot.debugger;2526import java.util.*;27import sun.jvm.hotspot.debugger.cdbg.CDebugger;2829public interface Debugger extends SymbolLookup, ThreadAccess {30/** Indicates whether this underlying debugger can provide a list of31currently-running processes. */32public boolean hasProcessList() throws DebuggerException;3334/** Provide a snapshot of the list of currently-running processes in35the form of a List of ProcessInfo objects. Must only be called36if hasProcessList(), above, returns true. */37public List<ProcessInfo> getProcessList() throws DebuggerException;3839/** If an error occurs during attachment (i.e., "no such process"),40the thrown DebuggerException will contain a description of the41error in its message string. */42public void attach(int processID) throws DebuggerException;4344/** This attaches the debugger to the given coreFileName, which is45assumed to have been generated from the specified46executableName. If an error occurs during loading of the core47file (i.e., "no such file"), the thrown DebuggerException will48contain a description of the error in its message string. */49public void attach(String executableName, String coreFileName)50throws DebuggerException;5152/** Detach from the remote process. Returns false if not currently53attached. */54public boolean detach() throws DebuggerException;5556/** Parse an address from a hex string in the format "0xFFFFFFFF".57The length of the address (i.e., 32 or 64 bits) is platform58dependent. This method should ONLY be used by routines which59need to interact with the user and parse a string entered by60hand; for example, a graphical user interface. This routine61should NOT be used to subvert the current safety mechanisms in62the system which prevent arbitrary conversion from Address to63long and back. */64public Address parseAddress(String addressString)65throws NumberFormatException, DebuggerException;6667/** Returns the 64-bit value of an Address. This method should ONLY68be used when implementing a debugger which needs to interface to69C and which needs a unique identifier for certain objects. */70public long getAddressValue(Address addr) throws DebuggerException;7172/** Support for remote debugging. Get the name of the operating73system on which this debugger is running (to be able to properly74configure the local system). Typical return values are75"linux", "win32"; see utilities/PlatformInfo.java. */76public String getOS() throws DebuggerException;7778/** Support for remote debugging. Get the name of the CPU type on79which this debugger is running (to be able to properly configure80the local system). Typical return value is "x86"; see81utilities/PlatformInfo.java. */82public String getCPU() throws DebuggerException;8384/** Retrieve the machine description for the underlying hardware for85the cases in which we need to do, for example, machine-dependent86byte swapping */87public MachineDescription getMachineDescription() throws DebuggerException;8889/** Find out whether this debugger has a console available on which90commands can be executed; see executeCommandOnConsole, below.91This is an interim routine designed to allow access to the92underlying dbx process on Solaris until we have disassembly,93etc. in the SA. */94public boolean hasConsole() throws DebuggerException;9596/** If the underlying debugger has a console (as dbx does), this97provides access to it. Takes in a platform-dependent String,98executes it on the debugger's console, and returns any output as99a String. */100public String consoleExecuteCommand(String cmd) throws DebuggerException;101102/** If the underlying debugger has a console, this returns the103debugger-specific prompt which should be displayed. */104public String getConsolePrompt() throws DebuggerException;105106/** If this platform supports C/C++ debugging via the CDebugger107interface, returns a CDebugger object; otherwise returns108null. */109public CDebugger getCDebugger() throws DebuggerException;110111/**112* Find address and executable which contains symbol.113*/114public String findSymbol(String symbol);115116/** the following methods are intended only for RemoteDebuggerClient */117public long getJBooleanSize();118public long getJByteSize();119public long getJCharSize();120public long getJDoubleSize();121public long getJFloatSize();122public long getJIntSize();123public long getJLongSize();124public long getJShortSize();125public long getHeapOopSize();126public long getNarrowOopBase();127public int getNarrowOopShift();128public long getKlassPtrSize();129public long getNarrowKlassBase();130public int getNarrowKlassShift();131132public ReadResult readBytesFromProcess(long address, long numBytes)133throws DebuggerException;134135public void writeBytesToProcess(long address, long numBytes, byte[] data)136throws UnmappedAddressException, DebuggerException;137}138139140