beautypg.com

14 viewing local variables, Viewing local variables -34, Simpliq – ElmoMC SimplIQ Software Manual User Manual

Page 96

background image

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.