How to debug a console app from the REPL?

大兔子大兔子 提交于 2019-12-25 09:16:32

问题


It's really confortable to use emacs+cider for the daily development. All the stuff I've configured in my text editor makes it ideal for the task.

The current project that I'm working on my spare time is a text editor. I've already implmented one in C++ and I used gdb to debug, from emacs. To run it, I entered set new-console on and run in the gdb buffer. This would pop a new console that would handle all the I/O.

Now I'm trying to reimplement it in Clojure. By far, one of my biggest concerns is debugging. I think it wouldn't be bad something similar to what I used with gdb.

For reading the keyboard without buffering, I'm using JLine. This means read-line won't provide the desired result.

What is a reasonable way to debug this kind of app (with lots of I/O from the console)?

How to do so from emacs/cider preferently?

I'm using lein, if this matters.


P.S.: Here's a similar question I made, with a more broad "intend". I think it's worth seeing.


回答1:


CIDER comes with an excellent debugger nowadays. See also this screenshot.

The easiest thing for you will probably be to create a lein/boot build profile which includes nREPL and CIDER as dependencies and make use of an embedded CIDER instance. This will let you run your app "standalone" from a terminal where you'll be able to get unbuffered keyboard I/O, and you can connect via M-x cider-connect to the embedded nREPL+CIDER instance to take full advantage of the debugger and code loading as you normally would.



来源:https://stackoverflow.com/questions/41037093/how-to-debug-a-console-app-from-the-repl

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!