XLISP baktrace

Nyquist / XLISP 2.0 - Contents | Tutorials | Examples | Reference

# baktrace

Type: | - | function (subr)
Source: | - | xldbug.c, xlsys.c

## Syntax

(baktrace [level])
  level - an optional integer expression
  returns - NIL

## Description

The 'baktrace' function is used to examine the system execution stack from within the Break Loop. It shows the nested forms that got the system to the current state. The Break Loop can be entered by a system error, or by the Nyquist/XLISP error, cerror, or break functions. If the 'levels' parameter is not specified, all the nested forms will be shown back to the main loop form that started the execution. If 'level' is specified the most recent 'level' nested forms will be shown.

## Examples

    (defun out (x)
      (print x)
      (mid 99))

    (defun mid (x)
      (print x)
      (in 999))

    (defun in (x)
      (print x)
      (break "in" x))  ; break

    > (out 9)
    9
    99
    999
    break: in - 999
    if continued: return from BREAK

    1> (baktrace)   ; the 1 before the > indicates a break loop
    Function: #<Subr-BAKTRACE: #9af6688>
    Function: #<Subr-BREAK: #9af6778>
    Arguments:
      "in"
      999
    Function: #<Closure-IN: #9b99574>
    Arguments:
      999
    Function: #<Closure-MID: #9b99670>
    Arguments:
      99
    Function: #<Closure-OUT: #9b99778>
    Arguments:
      9
    NIL

See also:

- Contents → Debugging and Error Handling
- XLISP 2.0 Manual → Break Loop

Back to Top

Nyquist / XLISP 2.0 - Contents | Tutorials | Examples | Reference