winIDEA SDK
Loading...
Searching...
No Matches
test_run_until_expression.py
# This script is licensed under BSD License, see file LICENSE.txt, or search for `License` in the SDK online help.
#
# (c) TASKING Germany GmbH, 2023
import isystem.connect as ic
winidea_id = ''
def test_runUntilExpression():
connMgr = ic.ConnectionMgr()
connMgr.connect(ic.CConnectionConfig().instanceId(winidea_id))
dbgCtrl = ic.CDebugFacade(connMgr)
execCtrl = dbgCtrl.getExecutionController()
addCtrl = dbgCtrl.getAddressController()
execCtrl.reset()
print("Use `runUntilExpression` function to run to 'main()'...")
dbgCtrl.runUntilExpression("main")
assert dbgCtrl.waitWhileRunning(5000) is True
mainAddress = addCtrl.getFunctionAddress("main").getAddress()
address = execCtrl.getCPUStatus().getExecutionPoint()
print(f"Current location: {hex(address)}, expecting: {hex(mainAddress)}")
# the same with timeout
print("Use `runUntilExpression` function with timeout to run to 'target_init()'...")
dbgCtrl.runUntilExpression("target_init",
ic.CExecutionController.TOUT_1s)
tiAddress = addCtrl.getFunctionAddress("target_init").getAddress()
address = execCtrl.getCPUStatus().getExecutionPoint()
print(f"Current location: {hex(address)}, expecting: {hex(tiAddress)}")
if __name__ == "__main__":
test_runUntilExpression()