Hey there, everyone! This is just a quick post to share a debugging technique
I’ve found useful and that I recently added to mb-util. Today I’m talking
about using SIGQUIT
to trigger some kind of debugging action in an
application, such as opening a REPL or logging a stack trace.
The reason SIGQUIT
is useful is that most terminals will send that signal if
you press Ctrl-\ (control and backslash), and many server environments also
have a mechanism for sending UNIX signals.
I’m not the first person to do this of course. My inspiration comes from the JVM, where SIGQUIT will print stack traces and JVM statistics, but I believe the idea goes back further. Here I’ll show how to apply this concept to a Ruby application, but you can do the same thing in any language.