Where Am I
In the current scenario, I am about to execute "expr 1+$x" in the procedure p4. I can remind myself of this by displaying the stack of procedure scopes using the w command.
7: expr 1+$x
dbg8.6> w
0: expect -D 1 debug-test.exp
*1: p4 1
7: expr 1+1The first line of the response describes scope 0. This is the top-level scope of the file itself, and the command used to invoke the program is shown. The second line describes scope 1 which is the invocation of procedure p4. The last line is not a scope but just repeats the evaluation stack level and the command about to be executed.
Notice that when w prints commands, they are displayed using the actual values of each parameter. In contrast, when the debugger automatically prints out the next command to be executed, the command is printed as it was originally entered in the script. For example, the debugger initially stopped and printed "expr 1+$w“, but the same instruction shows as "expr 1+1" in the output from the w command. Being able to see the values of the parameters this way is exceedingly useful.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access