next up previous contents index
Next: Predefined Functions and Variables Up: DebuggingLogging, and Error Previous: Input/Output Logging

Trace

 

      Despite carefully designing a Glish script, sometimes it will refuse to execute properly and may appear to be non-determinate. With most languages, this type of debugging is handled with a symbolic debugger. Glish doesn't have a symbolic debugger (yet), but setting system.output.trace to ``T'' will cause Glish to print out a breif summary of each statement just before it executes it. This can be useful for debugging, and in some cases, it is even better than a symbolic debugger. It is particularly useful for understanding the sometimes very compilcated interplay of asynchronious events. This input:

    func fib(n)
        {
        if ( n <= 1 ) return 1
        return fib(n-1) + fib(n-2)
        }
    system.output.trace := T   
    fib(3)
will generate output which looks like:
            |-> fib(3)
            |-> if (n <= 1)
            |-> return (fib((n - 1)) + fib((n - 2)))
            |-> fib((n - 1))
            |-> if (n <= 1)
            |-> return (fib((n - 1)) + fib((n - 2)))
            |-> fib((n - 1))
            |-> if (n <= 1)
            |-> return 1
            |-> fib((n - 2))
            |-> if (n <= 1)
            |-> return 1
            |-> fib((n - 2))
            |-> if (n <= 1)
            |-> return 1
    3
   



Thu Nov 13 16:44:05 EST 1997