winIDEA SDK
test_wait_state.py
1# This script is licensed under BSD License, see file LICENSE.txt.
2#
3# (c) TASKING Germany GmbH, 2023
4
5import isystem.connect as ic
6
7
8winidea_id = ''
9
10
11def test_waitState():
12 connMgr = ic.ConnectionMgr()
13 connMgr.connect(ic.CConnectionConfig().instanceId(winidea_id))
14
15 execCtrl = ic.CExecutionController(connMgr)
16 addCtrl = ic.CAddressController(connMgr)
17 bpCtrl = ic.CBreakpointController(connMgr)
18 execCtrl.reset()
19 address = addCtrl.getFunctionAddress("target_init").getAddress()
20 print(f"Setting BP at function 'target_init': {hex(address)}")
21 bpCtrl.setBP(0, address)
22
23 print(f"Run and use `waitUntilStopped()` with 1 sec timeout...")
24 execCtrl.resetAndRun()
25 execCtrl.waitUntilStopped(1000, isThrow=True)
26 print(f"\tCPU stopped on BP.")
27
28 print(f"Run and use `waitWhileRunning()` with 1 sec timeout...")
29 execCtrl.resetAndRun()
30 execCtrl.waitWhileRunning(1000, isThrow=True)
31 print(f"\tCPU stopped on BP.")
32
33 bpCtrl.deleteAll()
34
35
36if __name__ == "__main__":
37 test_waitState()