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

public Class BsdDebuggerLocal

extends DebuggerBase
implements BsdDebugger
Class Inheritance
All Implemented Interfaces
sun.jvm.hotspot.debugger.bsd.BsdDebugger, sun.jvm.hotspot.debugger.JVMDebugger, sun.jvm.hotspot.debugger.Debugger, sun.jvm.hotspot.debugger.ThreadAccess, sun.jvm.hotspot.debugger.SymbolLookup
Imports
java.util.ArrayList, .List, 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.runtime.JavaThread, .Threads, .VM, 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 BsdCDebugger
private boolean
private boolean
private List<LoadObject>
private long
private long
private long
private List<ThreadProxy>
private boolean
private BsdDebuggerLocal.BsdDebuggerLocalWorkerThread
Inherited from sun.jvm.hotspot.debugger.DebuggerBase:
heapOopSizejavaPrimitiveTypesConfiguredjbooleanSizejbyteSizejcharSizejdoubleSizejfloatSizejintSizejlongSizejshortSizeklassPtrSizemachDescnarrowKlassBasenarrowKlassShiftnarrowOopBasenarrowOopShiftoopSizeutils

Constructor Summary

AccessConstructor and Description
public
BsdDebuggerLocal(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.bsd.BsdDebugger.addressValueToString.

From the BsdDebugger 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 synchronized boolean
detach()

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

From the Debugger interface via JVMDebugger

private native void
private void
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 long[]
getJavaThreadsInfo()

this functions used for core file reading and called from native attach0, it returns an array of long integers as [thread_id, stack_start, stack_end, thread_id, stack_start, stack_end, ....] for all java threads recorded in Threads.

public List<LoadObject>
public MachineDescription
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 threadIdAddr, Address uniqueThreadIdAddr)

From the ThreadAccess interface via Debugger and JVMDebugger

public ThreadProxy
getThreadForIdentifierAddress(Address addr)

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

Gets an abstract ThreadProxy object for the thread identified by the contents of the memory location pointed to by addr.

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[]
getThreadIntegerRegisterSet0(long unique_thread_id)

public List<ThreadProxy>
getThreadList()

Implements sun.jvm.hotspot.debugger.bsd.BsdDebugger.getThreadList.

From the BsdCDebugger 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.bsd.BsdDebugger.lookup.

From the BsdCDebugger 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 BsdDebugger interface

public Address
parseAddress(String addressString)

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

From the Debugger interface via JVMDebugger

public BsdAddress
readAddress(long address)

Implements sun.jvm.hotspot.debugger.bsd.BsdDebugger.readAddress.

From the BsdDebugger 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 BsdAddress
public BsdAddress
public BsdOopHandle
public BsdOopHandle
readOopHandle(long address)

Implements sun.jvm.hotspot.debugger.bsd.BsdDebugger.readOopHandle.

From the BsdDebugger interface

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

Field Detail

attachedback to summary
private boolean attached
cdbgback to summary
private BsdCDebugger cdbg
isCoreback to summary
private boolean isCore
isDarwinback to summary
private boolean isDarwin
loadObjectListback to summary
private List<LoadObject> loadObjectList
p_ps_prochandleback to summary
private long p_ps_prochandle
symbolicatorback to summary
private long symbolicator
taskback to summary
private long task
threadListback to summary
private List<ThreadProxy> threadList
useGCC32ABIback to summary
private boolean useGCC32ABI
workerThreadback to summary
private BsdDebuggerLocal.BsdDebuggerLocalWorkerThread workerThread

Constructor Detail

BsdDebuggerLocalback to summary
public BsdDebuggerLocal(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.bsd.BsdDebugger.addressValueToString.

From the BsdDebugger 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)
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
findABIVersionback to summary
private void findABIVersion() throws DebuggerException
getAddressSizeback to summary
public static native int getAddressSize()
getAddressValueback to summary
public long getAddressValue(Address addr)

Implements sun.jvm.hotspot.debugger.bsd.BsdDebugger.getAddressValue, sun.jvm.hotspot.debugger.Debugger.getAddressValue.

From the BsdDebugger 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

getJavaThreadsInfoback to summary
public long[] getJavaThreadsInfo()

this functions used for core file reading and called from native attach0, it returns an array of long integers as [thread_id, stack_start, stack_end, thread_id, stack_start, stack_end, ....] for all java threads recorded in Threads. Also adds the ThreadProxy to threadList

getLoadObjectListback to summary
public List<LoadObject> getLoadObjectList()

Implements sun.jvm.hotspot.debugger.bsd.BsdDebugger.getLoadObjectList.

From the BsdCDebugger interface

getMachineDescriptionback to summary
public MachineDescription getMachineDescription()

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

From the Debugger interface

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 threadIdAddr, Address uniqueThreadIdAddr)

From the ThreadAccess interface via Debugger and JVMDebugger

getThreadForIdentifierAddressback to summary
public ThreadProxy getThreadForIdentifierAddress(Address addr)

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

Doc from sun.jvm.hotspot.debugger.ThreadAccess.getThreadForIdentifierAddress.

Gets an abstract ThreadProxy object for the thread identified by the contents of the memory location pointed to by addr. The contents at location addr are inherently platform-dependent; see the documentation for this class for more information. FIXME: what exception, if any, should this throw?

Annotations
@Override
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(long unique_thread_id) throws DebuggerException

Implements sun.jvm.hotspot.debugger.bsd.BsdDebugger.getThreadIntegerRegisterSet.

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

Implements sun.jvm.hotspot.debugger.bsd.BsdDebugger.getThreadList.

From the BsdCDebugger 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.bsd.BsdDebugger.lookup.

From the BsdCDebugger 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 BsdDebugger 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 BsdAddress readAddress(long address) throws UnmappedAddressException, UnalignedAddressException

Implements sun.jvm.hotspot.debugger.bsd.BsdDebugger.readAddress.

From the BsdDebugger 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 BsdAddress readCompKlassAddress(long address) throws UnmappedAddressException, UnalignedAddressException

Implements sun.jvm.hotspot.debugger.bsd.BsdDebugger.readCompKlassAddress.

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

Implements sun.jvm.hotspot.debugger.bsd.BsdDebugger.readCompOopAddress.

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

Implements sun.jvm.hotspot.debugger.bsd.BsdDebugger.readCompOopHandle.

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

Implements sun.jvm.hotspot.debugger.bsd.BsdDebugger.readOopHandle.

From the BsdDebugger interface

requireAttachback to summary
private void requireAttach()
sun.jvm.hotspot.debugger.bsd back to summary

pack-priv Class BsdDebuggerLocal.BsdDebuggerLocalWorkerThread

extends Thread
Class Inheritance

Field Summary

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

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public BsdDebuggerLocal.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 BsdDebuggerLocal debugger
lastExceptionback to summary
pack-priv DebuggerException lastException
taskback to summary
pack-priv BsdDebuggerLocal.WorkerThreadTask task

Constructor Detail

BsdDebuggerLocalWorkerThreadback to summary
public BsdDebuggerLocalWorkerThread(BsdDebuggerLocal debugger)

Method Detail

executeback to summary
public BsdDebuggerLocal.WorkerThreadTask execute(BsdDebuggerLocal.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.bsd back to summary

pack-priv Interface BsdDebuggerLocal.WorkerThreadTask


Method Summary

Modifier and TypeMethod and Description
public void

Method Detail

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