# HG changeset patch # User laurent # Date 1260193498 -3600 # Node ID fc0b3c064208913f755775434c010e41947e8f35 # Parent 80eb3bde98e3c2ee2c1d8f551e46aae1ad6d9a58# Parent 98a39261db9ee9471a98f32a909e059c28de0019 Changes merged diff -r 80eb3bde98e3 -r fc0b3c064208 targets/Win32/plc_Win32_main.c --- a/targets/Win32/plc_Win32_main.c Mon Dec 07 14:43:27 2009 +0100 +++ b/targets/Win32/plc_Win32_main.c Mon Dec 07 14:44:58 2009 +0100 @@ -147,7 +147,14 @@ int TryEnterDebugSection(void) { //printf("TryEnterDebugSection\n"); - return WaitForSingleObject(debug_sem, 0) == WAIT_OBJECT_0; + if(WaitForSingleObject(debug_sem, 0) == WAIT_OBJECT_0){ + /* Only enter if debug active */ + if(__DEBUG){ + return 1; + } + ReleaseSemaphore(debug_sem, 1, NULL); + return 0; + } } void LeaveDebugSection(void) @@ -171,7 +178,6 @@ /* from plc_debugger.c */ int WaitDebugData(unsigned long *tick) -unsigned long WaitDebugData() { *tick = __debug_tick; /* Wait signal from PLC thread */ @@ -188,11 +194,12 @@ ReleaseSemaphore(debug_wait_sem, 1, NULL); } -void suspendDebug() -{ - __DEBUG = 0; +void suspendDebug(int disable) +{ /* Prevent PLC to enter debug code */ WaitForSingleObject(debug_sem, INFINITE); + /*__DEBUG is protected by this mutex */ + __DEBUG = !disable; } void resumeDebug() diff -r 80eb3bde98e3 -r fc0b3c064208 tests/python/beremiz.xml --- a/tests/python/beremiz.xml Mon Dec 07 14:43:27 2009 +0100 +++ b/tests/python/beremiz.xml Mon Dec 07 14:44:58 2009 +0100 @@ -1,6 +1,4 @@ - - - - - - + + + +