next up previous contents index
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:

  $\blacktriangleright$ help
[NAME] 
  Show information about tdb command NAME.

  $\blacktriangleright$ cont
[nb] 
  Restart the execution. The optional argument is the number of breakpoints to ignore. $\vartriangleright$ Example 68:

      cont		     : continue the execution

cont 10 : continue the execution but ignore 10 breakpoints

  $\blacktriangleright$ print
[VAR] 
  Display the content of the variable VAR.

  $\blacktriangleright$ quit
 
  Quit the debugger and close the tdbcons window.

  $\blacktriangleright$ break
[SCRIPT] [NAME] 
  Enable the breakpoint NAME in the specified SCRIPT.
SCRIPT: NAME: $\vartriangleright$ Example 69:

  $\blacktriangleright$ delete
[SCRIPT] [NAME] 
  Disable the breakpoint NAME in the specified SCRIPT.

SCRIPT:

NAME:

$\vartriangleright$ 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

  $\blacktriangleright$ list
[SCRIPT] 
  Display the status of the breakpoints.

$\vartriangleright$ Example 71:


      list		     : list all breakpoints

list main : list the breakpoints in the function main
  $\blacktriangleright$ display
[VAR] 
  Print the content of the variable VAR after each breakpoint. $\vartriangleright$ Example 72:

    display i 

  $\blacktriangleright$ trace
[on/off] 
  Activate/desactivate the breakpoint tracing.
  $\blacktriangleright$ dump
 
  Print all variables.
  $\blacktriangleright$ where
 
  Print the position in the stack.
  $\blacktriangleright$ up
 
  Go up in the stack.
  $\blacktriangleright$ down
 
  Go down in the stack.
  $\blacktriangleright$ stack
 
  Display the stack.
  $\blacktriangleright$ go[LEVEL

  Move directly at the specified level in the stack.
  $\blacktriangleright$ undisplay
[VAR] 
  Disable a display command.

$\vartriangleright$ Example 73:


      display i

undisplay i
  $\blacktriangleright$ 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.
  $\blacktriangleright$ 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.

  $\blacktriangleright$ 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 up previous contents index
Next: FAQ Up: TSF: A Tool Set Previous: Pattern Abstractors
Yann Mevel
1999-04-30