--- 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()
--- 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 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<BeremizRoot URI_location="PYRO://127.0.0.1:61596">
- <TargetType>
- <Linux CFLAGS="" LDFLAGS=""/>
- </TargetType>
-</BeremizRoot>
+<?xml version="1.0" encoding="UTF-8"?>
+<BeremizRoot URI_location="LOCAL://">
+ <TargetType/>
+</BeremizRoot>