# HG changeset patch # User Edouard Tisserant # Date 1367137582 -32400 # Node ID 92a009dc58269fc2e02c9fd23aa87cc18a00543b # Parent 3cc7d6951cf4e9dee95238e4301cec0a6e0b5c26 Optimzed tracing of STRING type variables value. Now, only used size is transfered in debug buffer. diff -r 3cc7d6951cf4 -r 92a009dc5826 runtime/PLCObject.py --- a/runtime/PLCObject.py Fri Apr 26 23:08:41 2013 +0900 +++ b/runtime/PLCObject.py Sun Apr 28 17:26:22 2013 +0900 @@ -471,7 +471,7 @@ res.append(unpack_func( ctypes.cast(cursor, ctypes.POINTER(c_type)).contents)) - offset += ctypes.sizeof(c_type) + offset += ctypes.sizeof(c_type) if iectype != "STRING" else len(res[-1])+1 else: if c_type is None: PLCprint("Debug error - " + iectype + diff -r 3cc7d6951cf4 -r 92a009dc5826 targets/plc_debug.c --- a/targets/plc_debug.c Fri Apr 26 23:08:41 2013 +0900 +++ b/targets/plc_debug.c Sun Apr 28 17:26:22 2013 +0900 @@ -152,6 +152,10 @@ /* compute next cursor positon. No need to check overflow, as BUFFER_SIZE is computed large enough */ + if(vartype == STRING_ENUM){ + /* optimization for strings */ + size = ((STRING*)visible_value_p)->len + 1; + } char* next_cursor = buffer_cursor + size; /* copy data to the buffer */ memcpy(buffer_cursor, visible_value_p, size);