Top Description Inners Fields Constructors Methods
sun.jvm.hotspot.debugger.linux

public Class LinuxDebuggerLocal

extends DebuggerBase
implements LinuxDebugger
Class Inheritance
All Implemented Interfaces
sun.jvm.hotspot.debugger.linux.LinuxDebugger, sun.jvm.hotspot.debugger.JVMDebugger, sun.jvm.hotspot.debugger.Debugger, sun.jvm.hotspot.debugger.ThreadAccess, sun.jvm.hotspot.debugger.SymbolLookup
Imports
java.io.IOException, .UncheckedIOException, java.nio.file.Files, .Path, .Paths, java.util.ArrayList, .List, .Map, .NoSuchElementException, java.util.stream.Collectors, sun.jvm.hotspot.debugger.Address, .DebuggerBase, .DebuggerException, .DebuggerUtilities, .MachineDescription, .NotInHeapException, .OopHandle, .ProcessInfo, .ReadResult, .ThreadProxy, .UnalignedAddressException, .UnmappedAddressException, sun.jvm.hotspot.debugger.cdbg.CDebugger, .ClosestSymbol, .LoadObject, sun.jvm.hotspot.utilities.PlatformInfo

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.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv class
pack-priv static interface

Field Summary

Modifier and TypeField and Description
private boolean
private LinuxCDebugger
private boolean
private List<LoadObject>
private Map<Integer, Integer>
private long
private List<ThreadProxy>
private boolean
private LinuxDebuggerLocal.LinuxDebuggerLocalWorkerThread
Inherited from sun.jvm.hotspot.debugger.DebuggerBase:
heapOopSizejavaPrimitiveTypesConfiguredjbooleanSizejbyteSizejcharSizejdoubleSizejfloatSizejintSizejlongSizejshortSizeklassPtrSizemachDescnarrowKlassBasenarrowKlassShiftnarrowOopBasenarrowOopShiftoopSizeutils

Constructor Summary

AccessConstructor and Description
public
LinuxDebuggerLocal(MachineDescription machDesc, boolean useCache)

machDesc may not be null.

Method Summary

Modifier and TypeMethod and Description
public String
addressValueToString(long address)

Implements sun.jvm.hotspot.debugger.linux.LinuxDebugger.addressValueToString.

From the LinuxDebugger interface

public synchronized void
attach(int processID)

Implements sun.jvm.hotspot.debugger.Debugger.attach.

From the Debugger interface via JVMDebugger

public synchronized void
attach(String execName, String coreName)

Implements sun.jvm.hotspot.debugger.Debugger.attach.

From the Debugger interface via JVMDebugger

private native void
attach0(int pid)

private native void
attach0(String execName, String coreName)

private void
public String
consoleExecuteCommand(String cmd)

Implements sun.jvm.hotspot.debugger.Debugger.consoleExecuteCommand.

If the underlying debugger has a console (as dbx does), this provides access to it.

private ClosestSymbol
createClosestSymbol(String name, long offset)

private LoadObject
createLoadObject(String fileName, long size, long base)

public native String
public synchronized boolean
detach()

Implements sun.jvm.hotspot.debugger.Debugger.detach.

From the Debugger interface via JVMDebugger

private native void
private void
private void
public Address
public native long
public static native int
public long
public CDebugger
getCDebugger()

Implements sun.jvm.hotspot.debugger.Debugger.getCDebugger.

If this platform supports C/C++ debugging via the CDebugger interface, returns a CDebugger object; otherwise returns null.

public String
getConsolePrompt()

Implements sun.jvm.hotspot.debugger.Debugger.getConsolePrompt.

If the underlying debugger has a console, this returns the debugger-specific prompt which should be displayed.

public String
getCPU()

Implements sun.jvm.hotspot.debugger.Debugger.getCPU.

From the Debugger interface via JVMDebugger

public int
getHostPID(int id)

public List<LoadObject>
public MachineDescription
private int
getNamespacePID(Path statusPath)

public String
getOS()

Implements sun.jvm.hotspot.debugger.Debugger.getOS.

From the Debugger interface via JVMDebugger

public List<ProcessInfo>
getProcessList()

Implements sun.jvm.hotspot.debugger.Debugger.getProcessList.

From the Debugger interface via JVMDebugger

public ThreadProxy
getThreadForIdentifierAddress(Address addr)

Implements sun.jvm.hotspot.debugger.ThreadAccess.getThreadForIdentifierAddress.

From the ThreadAccess interface via Debugger and JVMDebugger

public ThreadProxy
getThreadForThreadId(long id)

Implements sun.jvm.hotspot.debugger.ThreadAccess.getThreadForThreadId.

From the ThreadAccess interface via Debugger and JVMDebugger

public synchronized long[]
private native long[]
public List<ThreadProxy>
getThreadList()

Implements sun.jvm.hotspot.debugger.linux.LinuxDebugger.getThreadList.

From the LinuxCDebugger interface

private long
handleGCC32ABI(long addr, String symbol)

public boolean
hasConsole()

Implements sun.jvm.hotspot.debugger.Debugger.hasConsole.

Find out whether this debugger has a console available on which commands can be executed; see executeCommandOnConsole, below.

public boolean
hasProcessList()

Implements sun.jvm.hotspot.debugger.Debugger.hasProcessList.

From the Debugger interface via JVMDebugger

private static native void
public synchronized Address
lookup(String objectName, String symbol)

Implements sun.jvm.hotspot.debugger.SymbolLookup.lookup.

From the SymbolLookup interface via Debugger and JVMDebugger

public synchronized ClosestSymbol
lookup(long addr)

Implements sun.jvm.hotspot.debugger.linux.LinuxDebugger.lookup.

From the LinuxCDebugger interface

private native ClosestSymbol
lookupByAddress0(long address)

private native long
lookupByName0(String objectName, String symbol)

public synchronized OopHandle
lookupOop(String objectName, String symbol)

Implements sun.jvm.hotspot.debugger.SymbolLookup.lookupOop.

From the SymbolLookup interface via Debugger and JVMDebugger

public Address
newAddress(long value)

Implements sun.jvm.hotspot.debugger.JVMDebugger.newAddress.

From the LinuxDebugger interface

public Address
parseAddress(String addressString)

Implements sun.jvm.hotspot.debugger.Debugger.parseAddress.

From the Debugger interface via JVMDebugger

public LinuxAddress
readAddress(long address)

Implements sun.jvm.hotspot.debugger.linux.LinuxDebugger.readAddress.

From the LinuxDebugger interface

public synchronized ReadResult
readBytesFromProcess(long address, long numBytes)

Implements sun.jvm.hotspot.debugger.Debugger.readBytesFromProcess.

This reads bytes from the remote process.

private native byte[]
readBytesFromProcess0(long address, long numBytes)

public LinuxAddress
public LinuxAddress
public LinuxOopHandle
public LinuxOopHandle
readOopHandle(long address)

Implements sun.jvm.hotspot.debugger.linux.LinuxDebugger.readOopHandle.

From the LinuxDebugger interface

private void
private native void
Inherited from sun.jvm.hotspot.debugger.DebuggerBase:
checkConfiguredcheckJavaConfiguredclearCacheconfigureJavaPrimitiveTypeSizesdisableCacheenableCachefindSymbolgetHeapOopSizegetJBooleanSizegetJByteSizegetJCharSizegetJDoubleSizegetJFloatSizegetJIntSizegetJLongSizegetJShortSizegetKlassPtrSizegetNarrowKlassBasegetNarrowKlassShiftgetNarrowOopBasegetNarrowOopShiftinitCacheinvalidatePageCacheparseCacheNumPagesPropertyputHeapConstreadAddressValuereadBytesreadCIntegerreadCompKlassAddressValuereadCompOopAddressValuereadJBooleanreadJBytereadJCharreadJDoublereadJFloatreadJIntreadJLongreadJShortsetBigEndian

Field Detail

attachedback to summary
private boolean attached
cdbgback to summary
private LinuxCDebugger cdbg
isCoreback to summary
private boolean isCore
loadObjectListback to summary
private List<LoadObject> loadObjectList
nspidMapback to summary
private Map<Integer, Integer> nspidMap
p_ps_prochandleback to summary
private long p_ps_prochandle
threadListback to summary
private List<ThreadProxy> threadList
useGCC32ABIback to summary
private boolean useGCC32ABI
workerThreadback to summary
private LinuxDebuggerLocal.LinuxDebuggerLocalWorkerThread workerThread

Constructor Detail

LinuxDebuggerLocalback to summary
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.

Method Detail

addressValueToStringback to summary
public String addressValueToString(long address)

Implements sun.jvm.hotspot.debugger.linux.LinuxDebugger.addressValueToString.

From the LinuxDebugger interface

attachback to summary
public synchronized void attach(int processID) throws DebuggerException

Implements sun.jvm.hotspot.debugger.Debugger.attach.

From the Debugger interface via JVMDebugger

attachback to summary
public synchronized void attach(String execName, String coreName)

Implements sun.jvm.hotspot.debugger.Debugger.attach.

From the Debugger interface via JVMDebugger

attach0back to summary
private native void attach0(int pid) throws DebuggerException
attach0back to summary
private native void attach0(String execName, String coreName) throws DebuggerException
checkAttachedback to summary
private void checkAttached() throws DebuggerException
consoleExecuteCommandback to summary
public String consoleExecuteCommand(String cmd) throws DebuggerException

Implements sun.jvm.hotspot.debugger.Debugger.consoleExecuteCommand.

Doc from sun.jvm.hotspot.debugger.Debugger.consoleExecuteCommand.

If the underlying debugger has a console (as dbx does), this provides access to it. Takes in a platform-dependent String, executes it on the debugger's console, and returns any output as a String.

createClosestSymbolback to summary
private ClosestSymbol createClosestSymbol(String name, long offset)
createLoadObjectback to summary
private LoadObject createLoadObject(String fileName, long size, long base)
demangleback to summary
public native String demangle(String sym)

Implements sun.jvm.hotspot.debugger.linux.LinuxDebugger.demangle.

Annotations
@Override
detachback to summary
public synchronized boolean detach()

Implements sun.jvm.hotspot.debugger.Debugger.detach.

From the Debugger interface via JVMDebugger

detach0back to summary
private native void detach0() throws DebuggerException
fillNSpidMapback to summary
private void fillNSpidMap(Path proc)
findABIVersionback to summary
private void findABIVersion() throws DebuggerException
findLibPtrByAddressback to summary
public Address findLibPtrByAddress(Address pc)

Implements sun.jvm.hotspot.debugger.linux.LinuxDebugger.findLibPtrByAddress.

Annotations
@Override
findLibPtrByAddress0back to summary
public native long findLibPtrByAddress0(long pc)
getAddressSizeback to summary
public static native int getAddressSize()
getAddressValueback to summary
public long getAddressValue(Address addr)

Implements sun.jvm.hotspot.debugger.linux.LinuxDebugger.getAddressValue, sun.jvm.hotspot.debugger.Debugger.getAddressValue.

From the LinuxDebugger interface

getCDebuggerback to summary
public CDebugger getCDebugger()

Implements sun.jvm.hotspot.debugger.Debugger.getCDebugger.

Doc from sun.jvm.hotspot.debugger.Debugger.getCDebugger.

If this platform supports C/C++ debugging via the CDebugger interface, returns a CDebugger object; otherwise returns null.

getConsolePromptback to summary
public String getConsolePrompt() throws DebuggerException

Implements sun.jvm.hotspot.debugger.Debugger.getConsolePrompt.

Doc from sun.jvm.hotspot.debugger.Debugger.getConsolePrompt.

If the underlying debugger has a console, this returns the debugger-specific prompt which should be displayed.

getCPUback to summary
public String getCPU()

Implements sun.jvm.hotspot.debugger.Debugger.getCPU.

From the Debugger interface via JVMDebugger

getHostPIDback to summary
public int getHostPID(int id)
getLoadObjectListback to summary
public List<LoadObject> getLoadObjectList()

Implements sun.jvm.hotspot.debugger.linux.LinuxDebugger.getLoadObjectList.

From the LinuxCDebugger interface

getMachineDescriptionback to summary
public MachineDescription getMachineDescription()

Implements sun.jvm.hotspot.debugger.Debugger.getMachineDescription.

From the Debugger interface

getNamespacePIDback to summary
private int getNamespacePID(Path statusPath)
getOSback to summary
public String getOS()

Implements sun.jvm.hotspot.debugger.Debugger.getOS.

From the Debugger interface via JVMDebugger

getProcessListback to summary
public List<ProcessInfo> getProcessList() throws DebuggerException

Implements sun.jvm.hotspot.debugger.Debugger.getProcessList.

From the Debugger interface via JVMDebugger

getThreadForIdentifierAddressback to summary
public ThreadProxy getThreadForIdentifierAddress(Address addr)

Implements sun.jvm.hotspot.debugger.ThreadAccess.getThreadForIdentifierAddress.

From the ThreadAccess interface via Debugger and JVMDebugger

getThreadForThreadIdback to summary
public ThreadProxy getThreadForThreadId(long id)

Implements sun.jvm.hotspot.debugger.ThreadAccess.getThreadForThreadId.

From the ThreadAccess interface via Debugger and JVMDebugger

getThreadIntegerRegisterSetback to summary
public synchronized long[] getThreadIntegerRegisterSet(int lwp_id) throws DebuggerException

Implements sun.jvm.hotspot.debugger.linux.LinuxDebugger.getThreadIntegerRegisterSet.

getThreadIntegerRegisterSet0back to summary
private native long[] getThreadIntegerRegisterSet0(int lwp_id) throws DebuggerException
getThreadListback to summary
public List<ThreadProxy> getThreadList()

Implements sun.jvm.hotspot.debugger.linux.LinuxDebugger.getThreadList.

From the LinuxCDebugger interface

handleGCC32ABIback to summary
private long handleGCC32ABI(long addr, String symbol) throws DebuggerException
hasConsoleback to summary
public boolean hasConsole() throws DebuggerException

Implements sun.jvm.hotspot.debugger.Debugger.hasConsole.

Doc from sun.jvm.hotspot.debugger.Debugger.hasConsole.

Find out whether this debugger has a console available on which commands can be executed; see executeCommandOnConsole, below. This is an interim routine designed to allow access to the underlying dbx process on Solaris until we have disassembly, etc. in the SA.

hasProcessListback to summary
public boolean hasProcessList() throws DebuggerException

Implements sun.jvm.hotspot.debugger.Debugger.hasProcessList.

From the Debugger interface via JVMDebugger

init0back to summary
private static native void init0() throws DebuggerException
lookupback to summary
public synchronized Address lookup(String objectName, String symbol)

Implements sun.jvm.hotspot.debugger.SymbolLookup.lookup.

From the SymbolLookup interface via Debugger and JVMDebugger

lookupback to summary
public synchronized ClosestSymbol lookup(long addr)

Implements sun.jvm.hotspot.debugger.linux.LinuxDebugger.lookup.

From the LinuxCDebugger interface

lookupByAddress0back to summary
private native ClosestSymbol lookupByAddress0(long address) throws DebuggerException
lookupByName0back to summary
private native long lookupByName0(String objectName, String symbol) throws DebuggerException
lookupOopback to summary
public synchronized OopHandle lookupOop(String objectName, String symbol)

Implements sun.jvm.hotspot.debugger.SymbolLookup.lookupOop.

From the SymbolLookup interface via Debugger and JVMDebugger

newAddressback to summary
public Address newAddress(long value)

Implements sun.jvm.hotspot.debugger.JVMDebugger.newAddress.

From the LinuxDebugger interface

parseAddressback to summary
public Address parseAddress(String addressString) throws NumberFormatException

Implements sun.jvm.hotspot.debugger.Debugger.parseAddress.

From the Debugger interface via JVMDebugger

readAddressback to summary
public LinuxAddress readAddress(long address) throws UnmappedAddressException, UnalignedAddressException

Implements sun.jvm.hotspot.debugger.linux.LinuxDebugger.readAddress.

From the LinuxDebugger interface

readBytesFromProcessback to summary
public synchronized ReadResult readBytesFromProcess(long address, long numBytes) throws UnmappedAddressException, DebuggerException

Implements sun.jvm.hotspot.debugger.Debugger.readBytesFromProcess.

This reads bytes from the remote process.

readBytesFromProcess0back to summary
private native byte[] readBytesFromProcess0(long address, long numBytes) throws DebuggerException
readCompKlassAddressback to summary
public LinuxAddress readCompKlassAddress(long address) throws UnmappedAddressException, UnalignedAddressException

Implements sun.jvm.hotspot.debugger.linux.LinuxDebugger.readCompKlassAddress.

readCompOopAddressback to summary
public LinuxAddress readCompOopAddress(long address) throws UnmappedAddressException, UnalignedAddressException

Implements sun.jvm.hotspot.debugger.linux.LinuxDebugger.readCompOopAddress.

readCompOopHandleback to summary
public LinuxOopHandle readCompOopHandle(long address) throws UnmappedAddressException, UnalignedAddressException, NotInHeapException

Implements sun.jvm.hotspot.debugger.linux.LinuxDebugger.readCompOopHandle.

readOopHandleback to summary
public LinuxOopHandle readOopHandle(long address) throws UnmappedAddressException, UnalignedAddressException, NotInHeapException

Implements sun.jvm.hotspot.debugger.linux.LinuxDebugger.readOopHandle.

From the LinuxDebugger interface

requireAttachback to summary
private void requireAttach()
setSAAltRoot0back to summary
private native void setSAAltRoot0(String altroot)
sun.jvm.hotspot.debugger.linux back to summary

pack-priv Class LinuxDebuggerLocal.LinuxDebuggerLocalWorkerThread

extends Thread
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv LinuxDebuggerLocal
pack-priv DebuggerException
pack-priv LinuxDebuggerLocal.WorkerThreadTask
Inherited from java.lang.Thread:
MAX_PRIORITYMIN_PRIORITYNORM_PRIORITY

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public LinuxDebuggerLocal.WorkerThreadTask
public void
run()

Overrides java.lang.Thread.run.

Implements java.lang.Runnable.run.

This method is run by the thread when it executes.

Inherited from java.lang.Thread:
activeCountcheckAccessclonecurrentThreaddumpStackenumerategetAllStackTracesgetContextClassLoadergetDefaultUncaughtExceptionHandlergetIdgetNamegetPrioritygetStackTracegetStategetThreadGroupgetUncaughtExceptionHandlerholdsLockinterruptinterruptedisAliveisDaemonisInterruptedisVirtualjoinjoinjoinjoinofPlatformofVirtualonSpinWaitsetContextClassLoadersetDaemonsetDefaultUncaughtExceptionHandlersetNamesetPrioritysetUncaughtExceptionHandlersleepsleepsleepstartstartVirtualThreadstopthreadIdtoStringyield

Field Detail

debuggerback to summary
pack-priv LinuxDebuggerLocal debugger
lastExceptionback to summary
pack-priv DebuggerException lastException
taskback to summary
pack-priv LinuxDebuggerLocal.WorkerThreadTask task

Constructor Detail

LinuxDebuggerLocalWorkerThreadback to summary
public LinuxDebuggerLocalWorkerThread(LinuxDebuggerLocal debugger)

Method Detail

executeback to summary
public LinuxDebuggerLocal.WorkerThreadTask execute(LinuxDebuggerLocal.WorkerThreadTask task) throws DebuggerException
runback to summary
public void run()

Overrides java.lang.Thread.run.

Implements java.lang.Runnable.run.

Doc from java.lang.Thread.run.

This method is run by the thread when it executes. Subclasses of Thread may override this method.

This method is not intended to be invoked directly. If this thread is a platform thread created with a Runnable task then invoking this method will invoke the task's run method. If this thread is a virtual thread then invoking this method directly does nothing.

sun.jvm.hotspot.debugger.linux back to summary

pack-priv Interface LinuxDebuggerLocal.WorkerThreadTask


Method Summary

Modifier and TypeMethod and Description
public void

Method Detail

doitback to summary
public void doit(LinuxDebuggerLocal debugger) throws DebuggerException