# HG changeset patch # User laurent # Date 1343583232 -7200 # Node ID afcc13faecd5cf1bcbe395bf33fd723bbb7de5da # Parent 5bbf5790501170fbaee80aff48cd6793b57b1047 Fix bug debugger unable to restart after stopping PLC diff -r 5bbf57905011 -r afcc13faecd5 runtime/PLCObject.py --- a/runtime/PLCObject.py Fri Jul 27 00:38:45 2012 +0200 +++ b/runtime/PLCObject.py Sun Jul 29 19:33:52 2012 +0200 @@ -365,29 +365,29 @@ size = ctypes.c_uint32() buffer = ctypes.c_void_p() offset = 0 - if self.PLClibraryLock.acquire(False) and \ - self._GetDebugData(ctypes.byref(tick), - ctypes.byref(size), - ctypes.byref(buffer)) == 0 : - if size.value: - for idx, iectype, forced in self._Idxs: - cursor = ctypes.c_void_p(buffer.value + offset) - c_type,unpack_func, pack_func = \ - TypeTranslator.get(iectype, - (None,None,None)) - if c_type is not None and offset < size.value: - res.append(unpack_func( - ctypes.cast(cursor, - ctypes.POINTER(c_type)).contents)) - offset += ctypes.sizeof(c_type) - else: - if c_type is None: - PLCprint("Debug error - " + iectype + - " not supported !") - #if offset >= size.value: - #PLCprint("Debug error - buffer too small ! %d != %d"%(offset, size.value)) - break - self._FreeDebugData() + if self.PLClibraryLock.acquire(False): + if self._GetDebugData(ctypes.byref(tick), + ctypes.byref(size), + ctypes.byref(buffer)) == 0: + if size.value: + for idx, iectype, forced in self._Idxs: + cursor = ctypes.c_void_p(buffer.value + offset) + c_type,unpack_func, pack_func = \ + TypeTranslator.get(iectype, + (None,None,None)) + if c_type is not None and offset < size.value: + res.append(unpack_func( + ctypes.cast(cursor, + ctypes.POINTER(c_type)).contents)) + offset += ctypes.sizeof(c_type) + else: + if c_type is None: + PLCprint("Debug error - " + iectype + + " not supported !") + #if offset >= size.value: + #PLCprint("Debug error - buffer too small ! %d != %d"%(offset, size.value)) + break + self._FreeDebugData() self.PLClibraryLock.release() if offset and offset == size.value: return self.PLCStatus, tick.value, res