# Interface: com.pnfsoftware.jeb.core.units.code.debug.IDebuggerUnit

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: attach
- parameter: `setupInformation`, type: `com.pnfsoftware.jeb.core.units.code.debug.impl.DebuggerSetupInformation`
- return type: `boolean`

Description: Attach the debugger to a target.
parameter: setupInformation: the target information
return: true if the target was successfully attached, false otherwise

## Method: canPerformOperation
- parameter: `op`, type: `com.pnfsoftware.jeb.core.units.code.debug.DebuggerOperationType`
- return type: `boolean`

Description: 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.
parameter: op: operation type
return: true if the operation is likely safe

## Method: clearBreakpoint
- parameter: `breakpoint`, type: `com.pnfsoftware.jeb.core.units.code.debug.IDebuggerBreakpoint`
- return type: `boolean`

Description: Remove an execution breakpoint.
parameter: breakpoint: breakpoint to clear
return: true if the breakpoint was cleared

## Method: clearBreakpoints
- return type: `boolean`

Description: Remove all execution breakpoints.
return: true if breakpoints were cleared

## Method: convertSymbolicAddressToMemoryToAddress
- parameter: `symbol`, type: `java.lang.String`
- parameter: `unit`, type: `com.pnfsoftware.jeb.core.units.code.ICodeUnit`
- return type: `long`

Description: Convert a symbolic address, such as a register name, method symbol, string representation of a physical address, etc. to its associated physical memory address.
parameter: symbol: the symbol name
parameter: unit: optional
return: the physical address associated with the symbol, 0 on error

## Method: convertToUnitAddress
- parameter: `address`, type: `java.lang.String`
- return type: `com.pnfsoftware.jeb.core.units.UnitAddress<com.pnfsoftware.jeb.core.units.code.ICodeUnit>`

Description: 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 not [handled by this debugger](#getPotentialDebuggees()).
parameter: address: debugger\-global address
return: unit address, or null if conversion failed

## Method: detach
- return type: `boolean`

Description: Detach from the target \(if possible\).
return: true if the debugger was detached

## Method: getBreakpoint
- parameter: `address`, type: `java.lang.String`
- parameter: `unit`, type: `com.pnfsoftware.jeb.core.units.code.ICodeUnit`
- return type: `com.pnfsoftware.jeb.core.units.code.debug.IDebuggerBreakpoint`

Description: Get the execution breakpoint set at the given address.
parameter: address: address, as defined by interactive units
parameter: unit: optional code unit relevant to the address
return: the breakpoint object on success, null if none or the operation failed

## Method: getBreakpoints
- return type: `java.util.List<? extends com.pnfsoftware.jeb.core.units.code.debug.IDebuggerBreakpoint>`

Description: Retrieve a list of execution breakpoints.
return: a list of breakpoints, possibly empty; null on error

## Method: getDefaultThread
- return type: `com.pnfsoftware.jeb.core.units.code.debug.IDebuggerThread`

Description: Get the default thread. Note that clients may call this method very frequently.
return: default thread, or null

## Method: getModules
- return type: `java.util.List<? extends com.pnfsoftware.jeb.core.units.code.debug.IDebuggerModule>`

Description: Get the list of modules or libraries that are relevant to the target.
return: target modules, or null on error

## Method: getPotentialDebuggees
- return type: `java.util.List<? extends com.pnfsoftware.jeb.core.units.code.ICodeUnit>`

Description: 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 is [attached](#attach(IDebuggerSetupInformation)) to a target. Note that a potential debuggee may not have been processed.
return: candidate debuggee units, or null on error

## Method: getSuspendPolicy
- parameter: `eventType`, type: `com.pnfsoftware.jeb.core.units.code.debug.DebuggerEventType`
- return type: `com.pnfsoftware.jeb.core.units.code.debug.DebuggerSuspendPolicy`

Description: Get the suspend policy.
parameter: eventType: event type
return: suspend policy, or null if unavailable

## Method: getTargetApplication
- return type: `com.pnfsoftware.jeb.core.units.IUnit`

Description: Retrieve the optional target application.
return: target application, or null

## Method: getTargetEnumerator
- return type: `com.pnfsoftware.jeb.core.units.code.debug.IDebuggerTargetEnumerator`

Description: Provide an optional target enumerator.
return: target enumerator, or null

## Method: getTargetInformation
- return type: `com.pnfsoftware.jeb.core.units.code.debug.IDebuggerTargetInformation`

Description: Retrieve information about the target being debugged.
return: target information, or null

## Method: getThreadById
- parameter: `threadId`, type: `long`
- return type: `com.pnfsoftware.jeb.core.units.code.debug.IDebuggerThread`

Description: Get a thread by its identifier.
parameter: threadId: thread id
return: thread, or null

## Method: getThreads
- return type: `java.util.List<? extends com.pnfsoftware.jeb.core.units.code.debug.IDebuggerThread>`

Description: Get a list of threads running on the target.
return: a list of threads \(possibly, but unlikely, empty\), null on error

## Method: hasDefaultThread
- return type: `boolean`

Description: Non blocking method that checks a default thread is set.
return: true if a default thread is set

## Method: isAttached
- return type: `boolean`

Description: Determine whether or not this debugger is attached to a target. Unless attached, most operations are likely to fail.
return: true if the debugger is attached

## Method: isPaused
- parameter: `allThreadsMustBeSuspended`, type: `boolean`
- return type: `boolean`

Description: Determine if the target is paused.
parameter: allThreadsMustBeSuspended: 
return: true if the target is suspended

## Method: isPaused
- return type: `boolean`

Description: Determine if the target is fully paused. This is equivalent to determining that all threads are suspended.
return: true if the target is paused

## Method: pause
- return type: `boolean`

Description: 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.
return: success indicator

## Method: registerDebuggee
- parameter: `unit`, type: `com.pnfsoftware.jeb.core.units.code.ICodeUnit`
- return type: `boolean`

Description: Register a code unit as a debuggee candidate.
parameter: unit: code unit
return: true if the unit was registered

## Method: restart
- return type: `boolean`

Description: Restart the target \(if possible\).
return: true if the target was restarted

## Method: run
- return type: `boolean`

Description: Run or resume execution of the target.
return: success indicator

## Method: setBreakpoint
- parameter: `address`, type: `java.lang.String`
- parameter: `unit`, type: `com.pnfsoftware.jeb.core.units.code.ICodeUnit`
- parameter: `flags`, type: `int`
- parameter: `overwrite`, type: `boolean`
- return type: `com.pnfsoftware.jeb.core.units.code.debug.IDebuggerBreakpoint`

Description: 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.
parameter: address: address, as defined by interactive units
parameter: unit: code unit relevant to the address
parameter: flags: optional, or a combination of `IDebuggerBreakpoint.BREAK_ON_xxx` flags and            other flags offered in that type
parameter: overwrite: overwrite an existing breakpoint at the same address
return: a breakpoint object, representing a new or existing breakpoint; null on error

## Method: setBreakpoint
- parameter: `address`, type: `java.lang.String`
- parameter: `unit`, type: `com.pnfsoftware.jeb.core.units.code.ICodeUnit`
- return type: `com.pnfsoftware.jeb.core.units.code.debug.IDebuggerBreakpoint`

Description: 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.
parameter: address: address, as defined by interactive units
parameter: unit: code unit relevant to the address
return: a breakpoint object, representing a new or existing breakpoint; null on error

## Method: setDefaultThread
- parameter: `threadId`, type: `long`
- return type: `boolean`

Description: Set the default thread.
parameter: threadId: thread id
return: true on success, false if the thread cannot be set as the default thread

## Method: setSuspendPolicy
- parameter: `eventType`, type: `com.pnfsoftware.jeb.core.units.code.debug.DebuggerEventType`
- parameter: `suspendPolicy`, type: `com.pnfsoftware.jeb.core.units.code.debug.DebuggerSuspendPolicy`
- return type: `boolean`

Description: Set the suspend policy, that is what threads are/are not paused when a breakpoint\-like event is reported to the debugger.
parameter: eventType: event type
parameter: suspendPolicy: suspend policy
return: true if the policy was set

## Method: terminate
- return type: `boolean`

Description: Kill the target \(if possible\).
return: true if the target was terminated

## Method: unregisterDebuggee
- parameter: `unit`, type: `com.pnfsoftware.jeb.core.units.code.ICodeUnit`
- return type: `boolean`

Description: Unregister a code unit as a debuggee candidate.
parameter: unit: code unit
return: true if the unit was unregistered

