Re: GDB cannot access memory after Emacs abort

Stephen Berman
2007-11-14T10:00:11Z

On Tue, 13 Nov 2007 15:26:33 -0800 Dan Nicolaescu <dann@ics.uci.edu> wrote:

> Michael Snyder <msnyder@specifix.com> writes:
[...]
> > What we need, I guess, is to get back into control of
> > the gdb without killing the emacs. Otherwise it is
> > kind of hard to debug this gdb problem further.
>
> You can do that by using the power of emacs :-)
>
> Run emacs from CVS
> M-x server-start RET
> M-x gdb
> from this gdb start another emacs session and do whatever you need to
> induce the crash (just make sure that in the second instance of emacs
> you don't run `server-start')
>
> switch to a console and run
> emacsclient -t
>
> this should connect to the first emacs instance and give you access to
> gdb, you can run all the gdb commands there ...
>
> Hope this helps.

Indeed it does, thanks. (I actually combined your suggestion to use
Emacs's multi-tty capability with Michael Snyder's to attach the emacs
process to gdb: I did the latter from within the Emacs client. This had
the advantage over running gdb directly from the shell that I could copy
and paste the backtrace from the shell buffer to my followup buffer in
Gnus.)

(Before reading your post I had tried sort of the inverse strategy: I
started emacs under gdb from a virtual console, switched to X, invoked
emacsclient -c from an X terminal and induced the abort. However, when
I switched back to the virtual console the gdb process was dead. In
hindsight this was obviously a flawed strategy, but I'm still learning
how to use the multi-tty capability. When will the doc be ready? ;-) )

Steve Berman