--- a/plugger.py Thu Apr 09 15:27:45 2009 +0200
+++ b/plugger.py Fri Apr 10 07:53:42 2009 +0200
@@ -629,6 +629,27 @@
# Construct debugger natively supported types
DebugTypes = [t for t in zip(*TypeHierarchy_list)[0] if not t.startswith("ANY")] + \
["STEP","TRANSITION","ACTION"]
+DebugTypesSize = {"BOOL" : 1, @@ -1106,6 +1127,7 @@
debug_code = targets.code("plc_debug") % {
+ "buffer_size": reduce(lambda x, y: x + y, [DebugTypesSize.get(v["type"], 0) for v in self._VariablesList], 0), "\n".join(["extern %(type)s %(C_path)s;"%p for p in self._ProgramList]),
"extern_variables_declarations":"\n".join([
@@ -1245,6 +1267,8 @@
code_path = os.path.join(buildpath,filename)
open(code_path, "w").write(code)
# Insert this file as first file to be compiled at root plugin
--- a/targets/plc_debug.c Thu Apr 09 15:27:45 2009 +0200
+++ b/targets/plc_debug.c Fri Apr 10 07:53:42 2009 +0200
@@ -14,8 +14,9 @@
-#define BUFFER_SIZE 1024
+#define BUFFER_SIZE %(buffer_size)d #define MAX_SUBSCRIBTION %(subscription_table_count)d
/* Atomically accessed variable for buffer state */
@@ -158,13 +159,14 @@
*type_name = __get_type_enum_name(my_var->type);
USINT size = __get_type_enum_size(my_var->type);
- /* compute next cursor positon*/
+ /* compute next cursor position*/ buffer_cursor = buffer_cursor + size;
if(old_cursor < debug_buffer + BUFFER_SIZE)
+ printf("%%d > %%d\n", old_cursor - debug_buffer, BUFFER_SIZE);