Previous: , Up: General Lisp Advice   [Contents][Index]


C.3 General Lisp Debugging Advice

C.3.1 Log all interaction with the system shell

For problems related to the execution of external commands turn on logging of all execution of shell commands by SEL. This may be done by setting the ‘*shell-debug*‘ variable to a non-nil value.

(setq *shell-debug* t)

All subsequent executions of shell will now print logging information.

C.3.2 Tracing specific functions

Common Lisp provides support for function-level tracing. This may be enabled and disabled using the cl-user::trace and cl-user::untrace functions respectively, as shown in the following.

    CL-USER> (in-package :software-evolution-library/test)
    #<PACKAGE "SOFTWARE-EVOLUTION-LIBRARY/TEST">
    SE-TEST> (hello-world-clang)
    T
    SE-TEST> (cl-user::trace snippet->clang-type)
    (SNIPPET->CLANG-TYPE)
    SE-TEST> (update-asts *hello-world*)
      0: (SNIPPET->CLANG-TYPE
          ((:ARRAY . "") (:COL . 0) (:DECL . "") (:FILE . "")
           (:HASH . 342363981814211589) (:LINE . 0) (:POINTER . T) (:REQS)
           (:SIZE . 4) (:TYPE . "char")))
      0: SNIPPET->CLANG-TYPE returned
           #S(CLANG-TYPE
              :ARRAY ""
              :COL 0
    ;;;...
    #<CLANG {1003AD88D3}>
    SE-TEST>

C.3.3 Use extra verbosity in command-line tools

Many command-line tools compiled from sel support various levels of verbosity in their output. The simplest first step in debugging these tools should be to maximize the level of verbosity, e.g. -v 5.