views:

221

answers:

5

During web searching, I found the following comment : Traditional Lisp debugging practices can still be used.

  • What are the traditional debugging practices?
  • Normally, what tools are used for debugging lisp (with/without emacs)?
A: 

Basically just things like adding code to print out values as it runs so you can see what's happening.

Jerry Coffin
Sounds lika a C# programmer.. (it's a compliment)
Flinkman
+3  A: 

Run edebug-defun in emacs and you will see that lisp is magic.

Flinkman
+4  A: 

I don't know what Bill meant specifically, but IME:

Typically your editor will have a running instance connected to it. You can compile functions immediately to insert them into the running image -- since Lisp has its own compiler, you're just telling the running image to read and compile a small section of text. Or you can run functions directly, to see what they do.

When an exception is thrown (or a condition is signaled, if you're lucky enough to be in a dialect with conditions), the debugger will show you the stack trace and let you decide how to continue.

The major difference between Lisp and other high-level compiled languages is that in Lisp you're basically always writing code with the debugger attached.

Ken
+4  A: 

As clojure was tagged in the question, I'll give our perspective.

Class files generated by the clojure compiler include line- and method-based debugging info, so any java debugger will interoperate directly with clojure code, including breakpoints and object inspection.

If you use emacs/slime as your development environment, integration with slime's debugger has recently been included. As documentation is a little sparse, it's probably best to check out the scope of the support on github directly.

Mike Douglas
+2  A: 

In something that I would call approaches a "traditional set of Lisp debugging techniques" are:

  • Debug printouts
  • Function tracing (each invocation of a traced function is printed with an indentation that corresponds to call depth, on return the return value is printed).
  • Explicit invocation of the in-image debugger
  • Ending up in the in-image debugger due to a bug (trying to add an integer and a symbol, for example)
Vatine