Interface IDebuggerUnit
- All Superinterfaces:
IAddressableUnit,IEventSource,IInteractiveUnit,IUnit,IUnitCreator,IUserDataSupport
- All Known Subinterfaces:
IDalvikDebuggerUnit,INativeDebuggerUnit
Main Application Programming / Service Provider interface for JEB debugger units. Most methods in
this class do not raise exceptions; they return false or null on error or if the implementation
is not present or irrelevant. This interface is designed to be as generic as possible, in order
to accommodate all types of debuggers (native code, bytecode, etc.)
-
Method Summary
Modifier and TypeMethodDescriptionbooleanattach(DebuggerSetupInformation setupInformation) Attach the debugger to a target.booleanIndicate if performing a given operation is likely to be safe.booleanclearBreakpoint(IDebuggerBreakpoint breakpoint) Remove an execution breakpoint.booleanRemove all execution breakpoints.longconvertSymbolicAddressToMemoryToAddress(String symbol, ICodeUnit unit) Convert a symbolic address, such as a register name, method symbol, string representation of a physical address, etc.convertToUnitAddress(String address) Convert a global address (not specifying the unit to which it applies) to an address explicitly relevant to a unit.booleandetach()Detach from the target (if possible).getBreakpoint(String address, ICodeUnit unit) Get the execution breakpoint set at the given address.List<? extends IDebuggerBreakpoint> Retrieve a list of execution breakpoints.Get the default thread.List<? extends IDebuggerModule> Get the list of modules or libraries that are relevant to the target.Retrieve a list of code units that could potentially be managed by this debugger.getSuspendPolicy(DebuggerEventType eventType) Get the suspend policy.Retrieve the optional target application.Provide an optional target enumerator.Retrieve information about the target being debugged.getThreadById(long threadId) Get a thread by its identifier.List<? extends IDebuggerThread> Get a list of threads running on the target.booleanNon blocking method that checks a default thread is set.booleanDetermine whether or not this debugger is attached to a target.default booleanisPaused()Determine if the target is fully paused.booleanisPaused(boolean allThreadsMustBeSuspended) Determine if the target is paused.booleanpause()Pause or suspend the target.booleanregisterDebuggee(ICodeUnit unit) Register a code unit as a debuggee candidate.booleanrestart()Restart the target (if possible).booleanrun()Run or resume execution of the target.default IDebuggerBreakpointsetBreakpoint(String address, ICodeUnit unit) Set a general standard breakpoint at the given address.setBreakpoint(String address, ICodeUnit unit, int flags, boolean overwrite) Set a general breakpoint at the given address.booleansetDefaultThread(long threadId) Set the default thread.booleansetSuspendPolicy(DebuggerEventType eventType, DebuggerSuspendPolicy suspendPolicy) Set the suspend policy, that is what threads are/are not paused when a breakpoint-like event is reported to the debugger.booleanKill the target (if possible).booleanunregisterDebuggee(ICodeUnit unit) Unregister a code unit as a debuggee candidate.Methods inherited from interface com.pnfsoftware.jeb.core.units.IAddressableUnit
getAddressLabel, getAddressLabels, getAddressOfItem, getCanonicalAddress, getItemAtAddress, getItemObject, getRelatedItems, getWellKnownAddresses, isValidAddress, normalizeAddressMethods inherited from interface com.pnfsoftware.jeb.util.events.IEventSource
addListener, countListeners, getListeners, getParentSource, insertListener, notifyListeners, removeListener, setParentSourceMethods inherited from interface com.pnfsoftware.jeb.core.units.IInteractiveUnit
addressToLocation, canExecuteAction, executeAction, executeAction, getAddressActions, getCommentManager, getFullComment, getFullComments, getGlobalActions, getInlineComment, getInlineComments, getItemActions, getMetadataManager, locationToAddress, prepareExecution, setInlineCommentMethods inherited from interface com.pnfsoftware.jeb.core.units.IUnit
addChild, addChild, canBePersisted, dispose, execprvfunc, generateQuickState, getChildren, getContributions, getCreationTimestamp, getDescription, getExtraInputs, getFormatter, getFormatType, getIconData, getInput, getInterpreters, getLock, getName, getNotes, getNotificationManager, getParent, getParentArtifact, getParentProject, getPropertyDefinitionManager, getPropertyManager, getRealName, getStatus, getUid, getUnitProcessor, initializePropertyObjects, isDisposed, isProcessed, isStale, isTransientChild, notifyGenericChange, postDeserialization, process, removeChild, setName, setNotes, setParent, setRealName, setUnitProcessorMethods inherited from interface com.pnfsoftware.jeb.core.IUserDataSupport
clearAllData, getAllData, getData, setData
-
Method Details
-
getTargetEnumerator
IDebuggerTargetEnumerator getTargetEnumerator()Provide an optional target enumerator.- Returns:
- target enumerator, or null
-
canPerformOperation
Indicate if performing a given operation is likely to be safe. This method does not provide synchronization/locking facility; its result is purely indicative and may be used by front-ends and clients to minimize error generation.- Parameters:
op- operation type- Returns:
- true if the operation is likely safe
-
setSuspendPolicy
Set the suspend policy, that is what threads are/are not paused when a breakpoint-like event is reported to the debugger.- Parameters:
eventType- event typesuspendPolicy- suspend policy- Returns:
- true if the policy was set
-
getSuspendPolicy
Get the suspend policy.- Parameters:
eventType- event type- Returns:
- suspend policy, or null if unavailable
-
getModules
List<? extends IDebuggerModule> getModules()Get the list of modules or libraries that are relevant to the target.- Returns:
- target modules, or null on error
-
getPotentialDebuggees
Retrieve a list of code units that could potentially be managed by this debugger. The list returned by this method is likely to change after the debugger isattachedto a target. Note that a potential debuggee may not have been processed.- Returns:
- candidate debuggee units, or null on error
-
registerDebuggee
Register a code unit as a debuggee candidate.- Parameters:
unit- code unit- Returns:
- true if the unit was registered
-
unregisterDebuggee
Unregister a code unit as a debuggee candidate.- Parameters:
unit- code unit- Returns:
- true if the unit was unregistered
-
getTargetApplication
IUnit getTargetApplication()Retrieve the optional target application.- Returns:
- target application, or null
-
isAttached
boolean isAttached()Determine whether or not this debugger is attached to a target. Unless attached, most operations are likely to fail.- Returns:
- true if the debugger is attached
-
attach
Attach the debugger to a target.- Parameters:
setupInformation- the target information- Returns:
- true if the target was successfully attached, false otherwise
-
restart
boolean restart()Restart the target (if possible).- Returns:
- true if the target was restarted
-
detach
boolean detach()Detach from the target (if possible).- Returns:
- true if the debugger was detached
-
getTargetInformation
IDebuggerTargetInformation getTargetInformation()Retrieve information about the target being debugged.- Returns:
- target information, or null
-
run
boolean run()Run or resume execution of the target.- Returns:
- success indicator
-
pause
boolean pause()Pause or suspend the target. The debugger should stop execution of the target, as much as it possibly can. Typically, if the debugger has enough privilege to do so, this means pausing all threads currently executing within the target.- Returns:
- success indicator
-
isPaused
boolean isPaused(boolean allThreadsMustBeSuspended) Determine if the target is paused.- Parameters:
allThreadsMustBeSuspended-- Returns:
- true if the target is suspended
-
isPaused
default boolean isPaused()Determine if the target is fully paused. This is equivalent to determining that all threads are suspended.- Returns:
- true if the target is paused
-
terminate
boolean terminate()Kill the target (if possible).- Returns:
- true if the target was terminated
-
getThreads
List<? extends IDebuggerThread> getThreads()Get a list of threads running on the target.- Returns:
- a list of threads (possibly, but unlikely, empty), null on error
-
getThreadById
Get a thread by its identifier.- Parameters:
threadId- thread id- Returns:
- thread, or null
-
setDefaultThread
boolean setDefaultThread(long threadId) Set the default thread.- Parameters:
threadId- thread id- Returns:
- true on success, false if the thread cannot be set as the default thread
-
getDefaultThread
IDebuggerThread getDefaultThread()Get the default thread. Note that clients may call this method very frequently.- Returns:
- default thread, or null
-
hasDefaultThread
boolean hasDefaultThread()Non blocking method that checks a default thread is set.- Returns:
- true if a default thread is set
-
setBreakpoint
Set a general breakpoint at the given address. Specific breakpoint operations (such as enabling/disabling a breakpoint) can be executed directly on the breakpoint object.- Parameters:
address- address, as defined by interactive unitsunit- code unit relevant to the addressflags- optional, or a combination ofIDebuggerBreakpoint.BREAK_ON_xxxflags and other flags offered in that typeoverwrite- overwrite an existing breakpoint at the same address- Returns:
- a breakpoint object, representing a new or existing breakpoint; null on error
-
setBreakpoint
Set a general standard breakpoint at the given address. Specific breakpoint operations (such as enabling/disabling a breakpoint) can be executed directly on the breakpoint object.- Parameters:
address- address, as defined by interactive unitsunit- code unit relevant to the address- Returns:
- a breakpoint object, representing a new or existing breakpoint; null on error
-
getBreakpoint
Get the execution breakpoint set at the given address.- Parameters:
address- address, as defined by interactive unitsunit- optional code unit relevant to the address- Returns:
- the breakpoint object on success, null if none or the operation failed
-
getBreakpoints
List<? extends IDebuggerBreakpoint> getBreakpoints()Retrieve a list of execution breakpoints.- Returns:
- a list of breakpoints, possibly empty; null on error
-
clearBreakpoint
Remove an execution breakpoint.- Parameters:
breakpoint- breakpoint to clear- Returns:
- true if the breakpoint was cleared
-
clearBreakpoints
boolean clearBreakpoints()Remove all execution breakpoints.- Returns:
- true if breakpoints were cleared
-
convertToUnitAddress
Convert a global address (not specifying the unit to which it applies) to an address explicitly relevant to a unit. The conversion may not be possible, for example if the unit is nothandled by this debugger.- Parameters:
address- debugger-global address- Returns:
- unit address, or null if conversion failed
-
convertSymbolicAddressToMemoryToAddress
Convert a symbolic address, such as a register name, method symbol, string representation of a physical address, etc. to its associated physical memory address.- Parameters:
symbol- the symbol nameunit- optional- Returns:
- the physical address associated with the symbol, 0 on error
-