How to debug Emacs lisp, what makes Emacs fail / use 100% processor?

There, the external library I work with often binds my processor. I would like to help the author fix this (since I really like the library), but I don’t know how to properly debug the crash.

Any tips on debugging Emacs lisp? Keep in mind when it crashes Emacs no longer works and I have to kill it (so the solutions in Emacs themselves may not be practical).

Change I have to clarify that it is compiled in bytes, and this problem does not always happen to others, so it may be specific to my / init architecture files. It is definitely related to this library.

+6
source share
1 answer

First, always debug an uncompiled version of Emacs-Lisp if you are not sure if the problem is in the byte compiler.

Secondly, if the code is hanging on Emacs, then the code is probably in an infinite loop with a non-closing non-closing lock. So, the first thing to do is go through the library source and change all the ban-exit links so that Cg works to stop the loop. After that, load the library, set debug-on-quit to t, and you should get a nice debug trace when you press Cg, which shows you where the loop is looping. From there, debugging a problem should be as simple as debugging any other infinite loop.

+6
source

Source: https://habr.com/ru/post/905471/


All Articles