--- a/targets/LPC/plc_LPC_main.c Thu Feb 24 15:54:45 2011 +0100
+++ b/targets/LPC/plc_LPC_main.c Wed Mar 16 17:26:54 2011 +0100
@@ -48,7 +48,6 @@
if(__init(argc,argv) == 0){
- memcpy(RetainedIdBuf, idBuf, idLen);
PLC_SetTimer(0, common_ticktime__);
@@ -112,15 +111,23 @@
+void ValidateRetainBuffer(void) + memcpy(RetainedIdBuf, idBuf, idLen); +void InValidateRetainBuffer(void) + /* invalidate that buffer */ int CheckRetainBuffer(void)
/* compare RETAIN ID buffer with MD5 */
/* return true if identical */
int res = memcmp(RetainedIdBuf, idBuf, idLen) == 0;
- /* invalidate that buffer, might help when value cause PLC crash before next publish */
void Retain(unsigned int offset, unsigned int count, void *p)
--- a/targets/Linux/plc_Linux_main.c Thu Feb 24 15:54:45 2011 +0100
+++ b/targets/Linux/plc_Linux_main.c Wed Mar 16 17:26:54 2011 +0100
@@ -206,6 +206,14 @@
+void ValidateRetainBuffer(void) +void InValidateRetainBuffer(void) void Retain(unsigned int offset, unsigned int count, void *p)
--- a/targets/Win32/plc_Win32_main.c Thu Feb 24 15:54:45 2011 +0100
+++ b/targets/Win32/plc_Win32_main.c Wed Mar 16 17:26:54 2011 +0100
@@ -234,6 +234,14 @@
+void ValidateRetainBuffer(void) +void InValidateRetainBuffer(void) void Retain(unsigned int offset, unsigned int count, void * p)
--- a/targets/plc_debug.c Thu Feb 24 15:54:45 2011 +0100
+++ b/targets/plc_debug.c Wed Mar 16 17:26:54 2011 +0100
@@ -101,7 +101,7 @@
-int CheckRetainBuffer(void);
+extern int CheckRetainBuffer(void); @@ -187,10 +187,13 @@
extern int TryEnterDebugSection(void);
extern long AtomicCompareExchange(long*, long, long);
extern void LeaveDebugSection(void);
+extern void ValidateRetainBuffer(void); +extern void InValidateRetainBuffer(void); void __publish_debug(void)
+ InValidateRetainBuffer(); /* Check there is no running debugger re-configuration */
if(TryEnterDebugSection()){
@@ -217,6 +220,7 @@
/* when not debugging, do only retain */
__for_each_variable_do(RetainIterator);
+ ValidateRetainBuffer(); #define __RegisterDebugVariable_case_t(TYPENAME) \