Subject: Re: bug#11939: 24.1; `save-buffers-kill-emacs' loses minibuffer focus when it calls `list-processes'

From: Eli Zaretskii <[email-masked]>
Date: Mon, 23 Jul 2012 20:58:18 +0300

> From: "Drew Adams" <[email-masked]>
> Cc: <[email-masked]>, <[email-masked]>
> Date: Mon, 23 Jul 2012 09:28:00 -0700
> 
> > I suggest that instead of invoking Emacs from GDB, you
> > invoke it normally (presumably from a desktop shortcut); then
> > immediately attach GDB to it, like you do when Emacs crashes; then
> > type "continue" at GDB's prompt to let Emacs run; and finally do
> > whatever Martin asked you to for which he wanted GDB to kick in.
> 
> That I would like to try, but I don't know the recipe.
> 
> What I have done in the past I did after getting the Emacs popup dialog window
> about a fatal crash (what you have called the "Emacs abort dialog"), following
> instructions that you gave me in the past.
> 
> For the current crash, which presents no such dialog box, I tried following
> Martin's instructions for invoking gdb from within Emacs.

Don't wait for the crash.  Instead, attach GDB to Emacs right after
starting Emacs, with "gdb -p PID".  When GDB attaches to a program,
the program stops, so to let Emacs run normally thereafter, you will
need to type "continue" at GDB prompt.  After that, operate Emacs
normally, and do whatever is needed to reproduce the problem.

> If you give me the recipe for invoking gdb from within Emacs the right way then
> I will be glad to try it.  In sum, this is not clear to me: "immediately attach
> GDB to it, like you do when Emacs crashes".

  . invoke Emacs as you normally do
  . find out its PID
  . from the shell prompt, type "gdb -p PID" from the directory where
    you have .gdbinit
  . wait until GDB starts and displays its prompt, then type
    "continue" at that prompt.
  . go to the Emacs window and reproduce the problem.
  . when the problem (crash) happens, the debugger will kick in and
    display its prompt again, so you can type GDB command there.

> P.S. These are the instructions from you that I follow when I do get the "Emacs
> abort dialog" box:
> 
> > when you see the Emacs abort dialog do this in order:
> > 
> >   . Find out the PID of the Emacs process
> >   . Open a shell window and chdir to the directory where you have GDB
> >     and .gdbinit
> >   . Type "./gdb -p PID" and hit RET
> >   . When you see the "(gdb)" prompt, type "c RET"
> >   . Click YES on the Emacs abort dialog

Do the same, just don't wait for the abort dialog.