winIDEA SDK
Loading...
Searching...
No Matches
test_wait_state.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
#
# This Python example runs the program and uses the waitUntilStopped and
# waitWhileRunning functions to wait for the breakpoint to be hit.
# Once the breakpoint is hit, the script deletes all breakpoints and exits.
import isystem.connect as ic
winidea_id = ''
def test_waitState():
connMgr = ic.ConnectionMgr()
connMgr.connect(ic.CConnectionConfig().instanceId(winidea_id))
execCtrl = ic.CExecutionController(connMgr)
addCtrl = ic.CAddressController(connMgr)
bpCtrl = ic.CBreakpointController(connMgr)
execCtrl.reset()
address = addCtrl.getFunctionAddress("main").getAddress()
print(f"Setting BP at function 'main': {hex(address)}")
bpCtrl.setBP(0, address)
print(f"Run and use `waitUntilStopped()` with 1 sec timeout...")
execCtrl.resetAndRun()
execCtrl.waitUntilStopped(1000, isThrow=False)
print(f"\tCPU stopped on BP.")
print(f"Run and use `waitWhileRunning()` with 1 sec timeout...")
execCtrl.resetAndRun()
execCtrl.waitWhileRunning(1000, isThrow=False)
print(f"\tCPU stopped on BP.")
bpCtrl.deleteAll()
if __name__ == "__main__":
test_waitState()