Software Manual Owner manual

SimplIQ Software Manual Program Development and Execution
MAN-SIMSW (Ver. 1.4)
6-34
6.7.14 Viewing Local Variables
Local variables cannot be accessed through the Interpreter, and there is no special debug
command for this. The IDE manager can access local variables by using existing debug
commands and analyzing their results as when retrieving a call stack. The procedure for
doing this is as follows:
DB##PS[N];
Get current status
Check current status: If it is not halted, return an error.
DB##GS[N]=BP-3,BP-2;
Get an index of the function in Function Symbol
table, located in the stack at (BP - 3).
Search in the Variable Symbol table for all local variables of this function. These
variables are sorted first according to an index of the function to which they belong and
afterwards according to variable name (case sensitive). The Symbol table contains full
information about type and location of the variable (section A.5.6).
To view a specified local variable, use
DB##GS
command.
To set a new value of a specified local variable, use the
DB##ST
command.
The LINK command allocates place for local variables, inserting N entries at the top of
the stack and resetting them, where N is the number of local variables. Usually, LINK
is the first opcode of the function. If a local variable is accessed before the opcode
LINK is executed, the relevant stack entries will contain garbage.