Applies To:
  • CitectSCADA 3.00

Summary:
Question: Can I enable the CodeTrace() from the cicode window.? 

Solution:
Yes you can call the CodeTrace() function from the cicode window as with any other cicode function. If you want to trace a cicode thread you may look at the kernel PAGE TABLE CICODE to find the TaskHnd of the cicode thread you want to trace then call the CodeTrace() function for that thread. If you want to trace a cicode task that you are about to start in the cicode window you may use the mode -2 in the task handle. For example CodeTrace(-2, 3) will enable code tracing for the next cicode thread created. You then call your function in the cicode window and that task will be traced.

Sometimes in the time you enter the CodeTrace() to entering the function you want to trace, Citect may start another cicode task and then that task will be traced. To work around this problem and allow easier tracing of cicode the cicode to window can call the CodeTrace function automatically for you just before it creates any cicode task. To use this method of tracing you enter TRACE <sMode> where nMode is the same as the nMode in CodeTrace function. Once you have set a mode the cicode window will then call the CodeTrace() function for all cicode task created in the window. To turn off the trace mode enter TRACE 0. For example if you wanted use trace mode 3 to trace the execution of your function called myfunc() you would enter the bold text below. The cicode window will respond with the italic text:

>trace 3
Trace Mode 3
>myfunc()
Task still running, TaskHnd() = 5
>trace 0
Trace Mode 0

 

Keywords:
 

Attachments