unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Lars Magne Ingebrigtsen <larsi@gnus.org>
To: Helmut Eller <eller.helmut@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: Random idea: Debugging `quit'
Date: Sun, 11 Sep 2011 23:01:12 +0200	[thread overview]
Message-ID: <m3aaaan693.fsf@stories.gnus.org> (raw)
In-Reply-To: <m2ehzn9g41.fsf@gmail.com> (Helmut Eller's message of "Sun, 11 Sep 2011 18:51:58 +0200")

Helmut Eller <eller.helmut@gmail.com> writes:

> Not so nice, but  kill -SIGUSR2 <emacs-pid>  in shell tells Emacs to
> enter the debugger.

I didn't know that.  That sounds useful.

> Another possibility would be to set debug-on-quit permanently to t
> and at the same time set the variable debugger to some function
> that is smart enough to look at the queued events:
>
> (require 'cl)
> (require 'debug) ; load it now to avoid resetting debugger
> (setq debug-on-quit t)
> (setq debugger 'my-debug)
> (defun my-debug (&rest args)
>   (cond ((equal args '(error (quit)))
> 	 (let ((unread-events (loop while (input-pending-p)
> 				    collect (read-event nil nil 0.1))))
> 	   (cond ((equal (subseq unread-events -4)
> 			 '(21 54 54 54)) ;  C-u 6 6 6
> 		  (debug nil 'my-break))
> 		 (t
> 		  (discard-input)
> 		  (let ((debug-on-quit nil))
> 		    (signal 'quit nil))))))
> 	(t
> 	 (apply #'debug args))))

That works great!  Thanks!  It's now in my .emacs.

I think Emacs 24.2 should have something along these lines switched on
by default.  I think it would make a lot of bug reporting easier, since
it would enable users to get a backtrace on hangs very easily.

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/



      reply	other threads:[~2011-09-11 21:01 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-11  4:01 Random idea: Debugging `quit' Lars Magne Ingebrigtsen
2011-09-11  7:58 ` Andreas Schwab
2011-09-11 14:38   ` Antoine Levitt
2011-09-11 15:24   ` Lars Magne Ingebrigtsen
2011-09-11 15:42     ` Andreas Schwab
2011-09-11 23:28     ` Stephen J. Turnbull
2011-09-11 11:25 ` Sean Sieger
2011-09-11 16:51 ` Helmut Eller
2011-09-11 21:01   ` Lars Magne Ingebrigtsen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3aaaan693.fsf@stories.gnus.org \
    --to=larsi@gnus.org \
    --cc=eller.helmut@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).