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()