8.8.1.1.2.2.17. Target

class Target
connect() None

Connect or reconnect the debugger to the target.

# connects and disconnects from the target
session.target.connect()
session.target.disconnect()
Return type:

None

disconnect() None

Disconnect the debugger from the target

# connects and disconnects from the target
session.target.connect()
session.target.disconnect();
Return type:

None

isConnected() bool

Query if the target is connected

session.target.connect()
status = session.target.isConnected() # will be True
session.target.disconnect()
status = session.target.isConnected() # will be False
Return type:

bool

getResets() dict[str, bool]

Query the target's available reset types. These can be performed using :py:meth:~Target.reset

# Get a list of the resets which can currently be performed
resets = session.target.getResets()
# This might look like
# resets = {
#   "CPU Reset": True,
#   "Board Reset": False
# }

allowedResets = [reset for reset, allowed in resets.items() if allowed]
# allowedResets = ["CPU Reset"]
Returns:

A mapping where the keys are the reset types, and the associated values indicate whether is it currently valid to issue a reset of this type.

Return type:

dict[str, bool]

reset(resetType=None) None

Issue the specified reset on the target

# Issue the System Reset (possible reset types vary by target)
session.target.reset("System Reset")
Parameters:

resetType (str) -- (optional) The type of reset to be issued. If not provided, the default reset is issued. You can query the available resets using getResets()

Return type:

None

run(waitForHalt=None) None

Issue a run command to the target, and wait until it has halted.

# run to foo
session.breakpoints.add("foo")
session.target.run()

# run and return once the target is running
session.target.run(False)
Parameters:

waitForHalt (bool) -- (optional) Whether the command should wait until the target halts. Defaults to true.

Return type:

None

halt() None

Halt the target.

session.target.halt()
Return type:

None

waitForHalt() None

Waits until the target has halted for any reason.

# run the target and separately wait until it is halted
session.target.run(False)
session.target.waitForHalt()
Return type:

None

isHalted() bool

Query if the target is halted.

session.target.halt()
status = session.target.isHalted() # will be True
session.target.run(False)
status = session.target.isHalted() # will be False
Return type:

bool

stepInto(explicitlyAsm=None) None

Steps the target, stepping into function calls. Returns once the step operation is completed and the target is once again halted.

If symbol information is loaded for the location at which the target is currently halted, then a source step is performed. Otherwise, or if explicitly ordered to do so, an assembly step is performed.

# source step into (assuming symbol information is loaded for the target's current location)
session.target.stepInto()

# explicit assembly step into
session.target.stepInto(True)
Parameters:

explicitlyAsm (bool) -- (optional) If true, an assembly step into operation will always be performed regardless of loaded symbols. Defaults to false.

Return type:

None

stepOver(explicitlyAsm=None) None

Steps the target, stepping over function calls. Returns once the step operation is completed and the target is once again halted.

If symbol information is loaded for the location at which the target is currently halted, then a source step is performed. Otherwise, or if explicitly ordered to do so, an assembly step is performed.

# source step over (assuming symbol information is loaded for the target's current location)
session.target.stepOver()

# explicit assembly step over
session.target.stepOver(True)
Parameters:

explicitlyAsm (bool) -- (optional) If true, an assembly step over operation will always be performed regardless of loaded symbols. Defaults to false.

Return type:

None

stepOut() None

Steps the target, stepping out of the current function. Returns once the step operation is completed and the target is once again halted.

session.target.stepOut()
Return type:

None

restart() None

Restart the target.

A restart sets the PC to the entry point, calls the OnRestart GEL callback, and, if configured in the settings, runs to a label (usually main). Returns once the step operation is completed and the target is once again halted.

session.target.restart()
Return type:

None