public class LinuxDebuggerLocal extends DebuggerBase implements LinuxDebugger
An implementation of the JVMDebugger interface. The basic debug facilities are implemented through ptrace interface in the JNI code (libsaproc.so). Library maps and symbol table management are done in JNI.
NOTE that since we have the notion of fetching "Java primitive types" from the remote process (which might have different sizes than we expect) we have a bootstrapping problem. We need to know the sizes of these types before we can fetch them. The current implementation solves this problem by requiring that it be configured with these type sizes before they can be fetched. The readJ(Type) routines here will throw a RuntimeException if they are called before the debugger is configured with the Java primitive type sizes.
heapOopSize, javaPrimitiveTypesConfigured, jbooleanSize, jbyteSize, jcharSize, jdoubleSize, jfloatSize, jintSize, jlongSize, jshortSize, klassPtrSize, machDesc, narrowKlassBase, narrowKlassShift, narrowOopBase, narrowOopShift, oopSize, utils
Constructor and Description |
---|
LinuxDebuggerLocal(MachineDescription machDesc,
boolean useCache)
machDesc may not be null.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
addressValueToString(long address)
From the LinuxDebugger interface
|
void |
attach(int processID)
From the Debugger interface via JVMDebugger
|
void |
attach(java.lang.String execName,
java.lang.String coreName)
From the Debugger interface via JVMDebugger
|
java.lang.String |
consoleExecuteCommand(java.lang.String cmd)
If the underlying debugger has a console (as dbx does), this
provides access to it.
|
boolean |
detach()
From the Debugger interface via JVMDebugger
|
static int |
getAddressSize() |
long |
getAddressValue(Address addr)
From the LinuxDebugger interface
|
CDebugger |
getCDebugger()
If this platform supports C/C++ debugging via the CDebugger
interface, returns a CDebugger object; otherwise returns
null.
|
java.lang.String |
getConsolePrompt()
If the underlying debugger has a console, this returns the
debugger-specific prompt which should be displayed.
|
java.lang.String |
getCPU()
From the Debugger interface via JVMDebugger
|
java.util.List |
getLoadObjectList()
From the LinuxCDebugger interface
|
MachineDescription |
getMachineDescription()
From the Debugger interface
|
java.lang.String |
getOS()
From the Debugger interface via JVMDebugger
|
java.util.List |
getProcessList()
From the Debugger interface via JVMDebugger
|
ThreadProxy |
getThreadForIdentifierAddress(Address addr)
From the ThreadAccess interface via Debugger and JVMDebugger
|
ThreadProxy |
getThreadForThreadId(long id)
From the ThreadAccess interface via Debugger and JVMDebugger
|
long[] |
getThreadIntegerRegisterSet(int lwp_id) |
java.util.List |
getThreadList()
From the LinuxCDebugger interface
|
boolean |
hasConsole()
Find out whether this debugger has a console available on which
commands can be executed; see executeCommandOnConsole, below.
|
boolean |
hasProcessList()
From the Debugger interface via JVMDebugger
|
ClosestSymbol |
lookup(long addr)
From the LinuxCDebugger interface
|
Address |
lookup(java.lang.String objectName,
java.lang.String symbol)
From the SymbolLookup interface via Debugger and JVMDebugger
|
OopHandle |
lookupOop(java.lang.String objectName,
java.lang.String symbol)
From the SymbolLookup interface via Debugger and JVMDebugger
|
Address |
newAddress(long value)
From the LinuxDebugger interface
|
Address |
parseAddress(java.lang.String addressString)
From the Debugger interface via JVMDebugger
|
LinuxAddress |
readAddress(long address)
From the LinuxDebugger interface
|
ReadResult |
readBytesFromProcess(long address,
long numBytes)
This reads bytes from the remote process.
|
long |
readCInteger(long address,
long numBytes,
boolean isUnsigned)
Need to override this to relax alignment checks on x86.
|
LinuxAddress |
readCompKlassAddress(long address) |
LinuxAddress |
readCompOopAddress(long address) |
LinuxOopHandle |
readCompOopHandle(long address) |
long |
readJLong(long address) |
LinuxOopHandle |
readOopHandle(long address)
From the LinuxDebugger interface
|
void |
writeBytesToProcess(long address,
long numBytes,
byte[] data) |
checkConfigured, checkJavaConfigured, clearCache, configureJavaPrimitiveTypeSizes, disableCache, enableCache, getHeapOopSize, getJBooleanSize, getJByteSize, getJCharSize, getJDoubleSize, getJFloatSize, getJIntSize, getJLongSize, getJShortSize, getKlassPtrSize, getNarrowKlassBase, getNarrowKlassShift, getNarrowOopBase, getNarrowOopShift, initCache, invalidatePageCache, parseCacheNumPagesProperty, putHeapConst, readAddressValue, readBytes, readCompKlassAddressValue, readCompOopAddressValue, readJBoolean, readJByte, readJChar, readJDouble, readJFloat, readJInt, readJShort, setBigEndian, writeAddressValue, writeBytes, writeCInteger, writeJBoolean, writeJByte, writeJChar, writeJDouble, writeJFloat, writeJInt, writeJLong, writeJShort
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
readJBoolean, readJByte, readJChar, readJDouble, readJFloat, readJInt, readJShort
configureJavaPrimitiveTypeSizes, putHeapConst
getHeapOopSize, getJBooleanSize, getJByteSize, getJCharSize, getJDoubleSize, getJFloatSize, getJIntSize, getJLongSize, getJShortSize, getKlassPtrSize, getNarrowKlassBase, getNarrowKlassShift, getNarrowOopBase, getNarrowOopShift
public LinuxDebuggerLocal(MachineDescription machDesc, boolean useCache) throws DebuggerException
machDesc may not be null.
useCache should be set to true if debugging is being done locally, and to false if the debugger is being created for the purpose of supporting remote debugging.
DebuggerException
public static int getAddressSize()
public boolean hasProcessList() throws DebuggerException
hasProcessList
in interface Debugger
DebuggerException
public java.util.List getProcessList() throws DebuggerException
getProcessList
in interface Debugger
DebuggerException
public void attach(int processID) throws DebuggerException
attach
in interface Debugger
DebuggerException
public void attach(java.lang.String execName, java.lang.String coreName)
public boolean detach()
public Address parseAddress(java.lang.String addressString) throws java.lang.NumberFormatException
parseAddress
in interface Debugger
java.lang.NumberFormatException
public java.lang.String getOS()
public java.lang.String getCPU()
public boolean hasConsole() throws DebuggerException
Debugger
hasConsole
in interface Debugger
DebuggerException
public java.lang.String consoleExecuteCommand(java.lang.String cmd) throws DebuggerException
Debugger
consoleExecuteCommand
in interface Debugger
DebuggerException
public java.lang.String getConsolePrompt() throws DebuggerException
Debugger
getConsolePrompt
in interface Debugger
DebuggerException
public Address lookup(java.lang.String objectName, java.lang.String symbol)
lookup
in interface SymbolLookup
public OopHandle lookupOop(java.lang.String objectName, java.lang.String symbol)
lookupOop
in interface SymbolLookup
public MachineDescription getMachineDescription()
getMachineDescription
in interface Debugger
public ThreadProxy getThreadForIdentifierAddress(Address addr)
getThreadForIdentifierAddress
in interface ThreadAccess
public ThreadProxy getThreadForThreadId(long id)
getThreadForThreadId
in interface ThreadAccess
public java.lang.String addressValueToString(long address)
addressValueToString
in interface LinuxDebugger
public LinuxAddress readAddress(long address) throws UnmappedAddressException, UnalignedAddressException
readAddress
in interface LinuxDebugger
UnmappedAddressException
UnalignedAddressException
public LinuxAddress readCompOopAddress(long address) throws UnmappedAddressException, UnalignedAddressException
readCompOopAddress
in interface LinuxDebugger
UnmappedAddressException
UnalignedAddressException
public LinuxAddress readCompKlassAddress(long address) throws UnmappedAddressException, UnalignedAddressException
readCompKlassAddress
in interface LinuxDebugger
UnmappedAddressException
UnalignedAddressException
public LinuxOopHandle readOopHandle(long address) throws UnmappedAddressException, UnalignedAddressException, NotInHeapException
readOopHandle
in interface LinuxDebugger
UnmappedAddressException
UnalignedAddressException
NotInHeapException
public LinuxOopHandle readCompOopHandle(long address) throws UnmappedAddressException, UnalignedAddressException, NotInHeapException
readCompOopHandle
in interface LinuxDebugger
UnmappedAddressException
UnalignedAddressException
NotInHeapException
public long[] getThreadIntegerRegisterSet(int lwp_id) throws DebuggerException
getThreadIntegerRegisterSet
in interface LinuxDebugger
DebuggerException
public long readCInteger(long address, long numBytes, boolean isUnsigned) throws UnmappedAddressException, UnalignedAddressException
readCInteger
in interface LinuxDebugger
readCInteger
in class DebuggerBase
UnmappedAddressException
UnalignedAddressException
public long readJLong(long address) throws UnmappedAddressException, UnalignedAddressException
readJLong
in interface LinuxDebugger
readJLong
in class DebuggerBase
UnmappedAddressException
UnalignedAddressException
public long getAddressValue(Address addr)
getAddressValue
in interface Debugger
getAddressValue
in interface LinuxDebugger
public Address newAddress(long value)
newAddress
in interface LinuxDebugger
public java.util.List getThreadList()
getThreadList
in interface LinuxDebugger
public java.util.List getLoadObjectList()
getLoadObjectList
in interface LinuxDebugger
public ClosestSymbol lookup(long addr)
lookup
in interface LinuxDebugger
public CDebugger getCDebugger()
Debugger
getCDebugger
in interface Debugger
public ReadResult readBytesFromProcess(long address, long numBytes) throws UnmappedAddressException, DebuggerException
readBytesFromProcess
in interface Debugger
UnmappedAddressException
DebuggerException
public void writeBytesToProcess(long address, long numBytes, byte[] data) throws UnmappedAddressException, DebuggerException
writeBytesToProcess
in interface Debugger
UnmappedAddressException
DebuggerException
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.