Next: FAQ
Up: TSF: A Tool Set
Previous: Pattern Abstractors
tdb: the TSF debugger
In order to help users to follow the execution of their scripts and to
understand problems, a debugger has been developed. This one provides the
usual operations that you can expect from a tool of this kind.
The debugger is launched from the main TSF window (menu Options/Debugger). Its invocation starts a new window which corresponds to
the console of the debugger. Once started, it reads commands from the
terminal until you tell it to exit with the tdb command quit. You can get
online help from tdb itself by using the command help.
Here is a description of the tdb commands:
-
help
- [NAME]
Show information about tdb command NAME.
-
cont
- [nb]
Restart the execution. The optional argument is the number
of breakpoints to ignore.
Example 68:
cont : continue the execution
cont 10 : continue the execution but ignore 10 breakpoints
-
print
- [VAR]
Display the content of the variable VAR.
-
quit
-
Quit the debugger and close the tdbcons window.
-
break
- [SCRIPT] [NAME]
Enable the breakpoint NAME in the specified SCRIPT.
SCRIPT:
- The symbol . is a shortcut for the current script.
- The symbol * is a shortcut for all scripts (only with @enter and
@exit)
NAME:
- A name must start by the symbol @
- Some breakpoints of names @enter and @exit are implicitaly created
at the beginning and at the end of each scripts.
Example 69:
- break : enable all users breakpoints (not @exit and @enter)
- break test @1 : enable the breakpoint @1 in the script test
- break . : enable all breakpoints in the current script
- break * @exit : enable a breakpoint at the end of each
script
-
delete
- [SCRIPT] [NAME]
Disable the breakpoint NAME in the specified SCRIPT.
SCRIPT:
- The symbol . is a shortcut for the current script.
- The symbol * is a shortcut for all scripts (only with @enter and
@exit)
NAME:
- A name must start by the symbol @
- Some breakpoints of names @enter and @exit are implicitaly created
at the beginning and at the end of each scripts.
Example 70:
delete : disable all users breakpoints (not @exit and @enter)
delete test @1 : disable the breakpoint @1 in the script test
delete . : disable all breakpoints in the current script
delete * @exit : disable a breakpoint at the end of each script
-
list
- [SCRIPT]
Display the status of the breakpoints.
Example 71:
list : list all breakpoints
list main : list the breakpoints in the function main
-
display
- [VAR]
Print the content of the variable VAR after each breakpoint.
Example 72:
display i
-
trace
- [on/off]
Activate/desactivate the breakpoint tracing.
-
dump
-
Print all variables.
-
where
-
Print the position in the stack.
-
up
-
Go up in the stack.
-
down
-
Go down in the stack.
-
stack
-
Display the stack.
-
go[LEVEL
- ]
Move directly at the specified level in the stack.
-
undisplay
- [VAR]
Disable a display command.
Example 73:
display i
undisplay i
-
ABORT
-
When a script is running, the key CTRL-C aborts the execution
at the next BREAKPOINT even if it is not activated. A loop
without a BREAKPOINT or a script call cannot be stopped.
-
error
-
Terminate the script by an error. Warning, you have to
execute a cont command after the error command to quit the
script.
Breakpoints are set directly in TSF scripts by using the keyword BREAKPOINT. The syntax of the command is the following.
-
BREAKPOINT
- [N]
Set a breakpoint in the script. N will be the identifier of the
breakpoint and will be used by the tdb commands at the console level.
Figure 10:
Example of TSF script which use breakpoints
SCRIPT facto(n,res)
xx:="test"
BREAKPOINT(2)
IF (n<=1) THEN
res:=1
ELSE
CALL facto(n-1,&res)
res := res*n
ENDIF
ENDSCRIPT
SCRIPT main()
a:=1
PRINT a
BREAKPOINT(1)
a:=2
res:=9999
CALL facto(5,&n)
PRINT n
BREAKPOINT(3)
ENDSCRIPT
|
|
The figure 11 illustrates the use of the tdb commands during the
execution of the script presented figure 10.
Figure 11:
Example of use of the tdb commands
Action |
tdb commands (in console) |
Results |
Launch the execution of the script |
|
(tdb) Script is running |
|
|
BREAK in script main at @enter |
|
list |
All breakpoints are ON |
|
cont |
BREAK in script main at @1 |
|
cont |
BREAK in script facto at @2 |
|
stack |
3:
<TOPLEVEL> |
|
|
2: main |
|
|
* 1: facto |
|
cont 3 |
BREAK in script facto at @2 |
|
stack |
6:
<TOPLEVEL> |
|
|
5: main |
|
|
4: facto |
|
|
3: facto |
|
|
2: facto |
|
|
* 1: facto |
|
dump |
# Symtab facto |
|
|
- n = 2 - xx = 'test' - res -> res # Symtab <COMMON> - $cstat = FALSE - $cforlib : TYPE forlib - $verbose = FALSE - $cfile : TYPE flb-file - $version = 1.01 - $csel = FALSE - $debug = TRUE - $cunit : TREE unit # Symtab <GLOBAL>
|
|
where |
At level 1/6 in facto |
|
up |
At level 2/6 in facto |
|
display n |
n = 3 |
|
down |
At level 1/6 in facto |
|
print n |
n = 2 |
|
delete facto @2 |
|
|
list |
facto @2 : OFF |
|
|
facto + : ON |
|
|
Other breakpoints are ON |
|
cont |
BREAK in script facto at @enter |
|
delete facto * |
|
|
list |
facto @2 : OFF |
|
|
facto * : OFF |
|
|
facto + : ON |
|
|
Other breakpoints are ON |
|
cont |
BREAK in script facto at @exit |
|
delete . |
|
|
list |
facto * : OFF |
|
|
Other breakpoints are ON |
|
cont |
BREAK in script main at @3 |
|
dump |
# Symtab main |
|
|
- n = 120 - a = 2 - res = 9999 # Symtab <COMMON> - $cstat = FALSE - $cforlib : TYPE forlib - $verbose = FALSE - $cfile : TYPE flb-file - $version = 1.01 - $csel = FALSE - $debug = TRUE - $cunit : TREE unit # Symtab <GLOBAL>
|
|
cont |
Script is terminated |
|
Next: FAQ
Up: TSF: A Tool Set
Previous: Pattern Abstractors
Yann Mevel
1999-04-30