GNU bug report logs -
#79403
30.1; M-x gdb startup problem with (eq gdb-debuginfod-enable-setting 'ask)
Previous Next
Full log
View this message in rfc822 format
> From: Gustav Hållberg <gustav <at> gmail.com>
> Date: Sun, 7 Sep 2025 17:16:41 +0200
>
> If gdb-debuginfod-enable-setting is set to 'ask, gdb-init-1 may be called recursively, causing
> gdb-token-number (and other variables) to be reset in the middle of startup.
>
> This causes an "gdb-handle-reply: Wrong type argument: gdb-handler, nil" error message and other
> "strange" behavior.
>
> It triggers every time for me when attaching gdb to a running process: "emacs -nw -q" and M-x gdb, "gdb -
> i=mi -p <some-pid>". I only tested it with emacs 30.1 but the code seems to be the same at origin/master.
>
> If you insert (when (> gdb-token-number 0) (edebug)) in the begining of (gdb-init-1) you'll see what
> happens. Partial call trace:
>
> gdb-init-1()
> :
> gdb-update()
> :
> gdb-stopped(...)
> :
> gud-filter(...)
> read-from-minibuffer(...)
> y-or-n-p("Enable querying debuginfod servers for this session?")
> :
> gdb-init-1()
> :
> gdb-update()
> gdb("gdb -i=mi -p ...")
>
> I don't know what the right fix is, but it doesn't seem right to wait for user input in the middle of gdb-init-1.
Thanks. Does the patch below give good results?
diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el
index 74dff32..ebaff4a2 100644
--- a/lisp/progmodes/gdb-mi.el
+++ b/lisp/progmodes/gdb-mi.el
@@ -1108,7 +1108,9 @@ gdb-init-1
;; trigger questions about debuginfod queries.
(if (eq gdb-debuginfod-enable 'ask)
(setq gdb-debuginfod-enable
- (y-or-n-p "Enable querying debuginfod servers for this session?")))
+ (let ((gud-filter-defer-flag t))
+ (y-or-n-p
+ "Enable querying debuginfod servers for this session?"))))
(gdb-input (format "-gdb-set debuginfod enabled %s"
(if gdb-debuginfod-enable "on" "off"))
'gdb-debuginfod-message)
This bug report was last modified today.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.