unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Manuel Giraud <manuel@ledu-giraud.fr>
Cc: emacs-devel@gnu.org
Subject: Re: Debugging M-x gdb
Date: Fri, 31 Mar 2023 17:28:02 +0300	[thread overview]
Message-ID: <83wn2x0zd9.fsf@gnu.org> (raw)
In-Reply-To: <875yah10q9.fsf@ledu-giraud.fr> (message from Manuel Giraud on Fri, 31 Mar 2023 15:58:38 +0200)

> From: Manuel Giraud <manuel@ledu-giraud.fr>
> Cc: emacs-devel@gnu.org
> Date: Fri, 31 Mar 2023 15:58:38 +0200
> 
> * 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).

You didn't attach GDB to Emacs.  Instead, you started Emacs under GDB.

You should do it like this:

  * From exterm:

     $ ~/bin/emacs-debug &

  * From 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:

     $ egdb -p PID

where PID is the process ID of the Emacs process that spins the CPU.
Then at the prompt of this GDB:

     (gdb) thread apply all bt



  reply	other threads:[~2023-03-31 14:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-26 18:09 Debugging M-x gdb Manuel Giraud via Emacs development discussions.
2023-03-26 18:23 ` Eli Zaretskii
2023-03-31  8:09   ` Manuel Giraud via Emacs development discussions.
2023-03-31 10:55     ` Eli Zaretskii
2023-03-31 13:58       ` Manuel Giraud via Emacs development discussions.
2023-03-31 14:28         ` Eli Zaretskii [this message]
2023-03-31 17:25           ` Manuel Giraud via Emacs development discussions.
2023-03-31 18:04             ` Eli Zaretskii

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=83wn2x0zd9.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=manuel@ledu-giraud.fr \
    /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).