crystal-lang

Is there an equivalent to Pry for Crystal?


I am very new in crystal language. I would like to know if a debugger like Ruby's Pry exists in Crystal?

It means that you can put in code something like 'binding.pry' at program stop execution at this line and let you control of variables.


Solution

  • Although very incomplete, there is support for LLDB.

    You may add debugger anywhere in your code to initiate a breakpoint for LLDB to stop at. You should (must?) build a binary with the -d or --debug flag, then run it using LLDB:

    $ crystal build -d foo.cr
    $ lldb ./foo
    (lldb) run
    

    See https://groups.google.com/forum/m/#!topic/crystal-lang/gRf-yDNdZ-Y for a more detailed example.