Skip to content

Debugging Clojure source

David Miller edited this page Oct 15, 2010 · 2 revisions

Debugging information has been added to the assemblies generated by AOT-compilation. This means that stack traces include file and line number information on stack frames coming from Clojure source files (*.clj). When the DLL has been loaded, you can use Visual Studio to set breakpoints in Clojure source files. Locals will show properly.

The expressions that have source information attached are function invocations such as (f x y z) and host expressions such as (.method x arg). Inlined methods preserve source information. Macros are not, though you can certainly set breakpoints on the methods that are called by a macro expansion.

All the core bootstrap files such as core.clj are compiled with this info, so you can set breakpoints in them, too.

At the moment, this is only supported for AOT-compiled files, due to a limitation in the CLR regarding debug info and dynamic methods. Definition loaded directly from clj source files will not have this information.