[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Debugging M-x gdb
From: |
Manuel Giraud |
Subject: |
Re: Debugging M-x gdb |
Date: |
Fri, 31 Mar 2023 15:58:38 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Eli Zaretskii <eliz@gnu.org> writes:
[...]
> Doesn't produce any output after attaching GDB to the Emacs process
> which consumes CPU? That's not possible. Please show all the
> commands you did, starting from invoking Emacs that will later consume
> CPU, including commands inside Emacs and outside it.
>
> Note that the GDB you attach to Emacs should be a new GDB process, not
> the one you ran inside Emacs.
Disclaimer: I'm using OpenBSD. 'egdb' is the somewhat recent
versionĀ (9.2) from packages (there is an old bundled gdb but it does not
support -i=mi). In the mean time, I've found that this shows with other
executables I would try to debug from Emacs: I'm usin xclock here.
'~/bin/emacs-debug' is Emacs compiled with the following options:
CFLAGS="-O0 -g3" ./configure \
--bindir=$HOME/bin --program-suffix=-debug \
--enable-checking="yes,glyphs" \
--enable-check-lisp-object-type
Here is my recipe:
* From a xterm:
egdb ~/bin/emacs-debug
(gdb) source ~/emacs-repo/src/.gdbinit
(gdb) set args -Q
(gdb) run
* Into this Emacs:
M-x gdb
Run gdb (like this): egdb -i=mi /usr/X11R6/bin/xclock
Enable querying debuginfod servers for this session? (y or n) n
M-x gdb-many-windows
* Into this Emacs *gud-xclock* buffer:
(gdb) run # then from another terminal: pkill xclock
[Inferior 1 (process 76899) exited with code 01]
Now Emacs starts spinning the CPU.
* Into the first xterm with GDB:
(gdb) thread apply all bt
... nothing (even after quitting the Emacs *gud-xclock* buffer and
that the CPU goes back to normal).
--
Manuel Giraud