Subject: bug#39140: 28.0.50; gdb-mode incorrectly responds to C-d when a python interpreter is running

From: Vladimir Nikishkin <[email-masked]>
Date: Mon, 20 Jan 2020 09:15:38 +0800

No, which is quite weird.

There is also a bug report in the gdb bugzilla.
https://sourceware.org/bugzilla/show_bug.cgi?id=25388

сб, 18 янв. 2020 г. в 18:54, Eli Zaretskii <[email-masked]>:
>
> > From: Vladimir Nikishkin <[email-masked]>
> > Date: Wed, 15 Jan 2020 09:25:16 +0800
> >
> > So, Emacs ships a GDB-mode, runnable by M-x gdb RET
> > Inside this inferior gdb session, we can run a python
> > interpreter by typing: pi RET
> >
> > In GDB that is run inside a plain terminal, the C-d command
> > (the EOF character) returns from python to the standard GDB
> > prompt.
> >
> > Not so in Emacs. If you type C-d, there is either just:
> > `quit>'
> > printed, and nothing else, or the line:
> > `Use quit() or Ctrl-D (i.e. EOF) to exit'
> > However, sending C-q C-d RET, or using the window menu
> > `menu-bar signals eof' ends the whole GDB session.
>
> Does the patch below fix the problem?
>
> diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el
> index b08d487..d841f74 100644
> --- a/lisp/progmodes/gdb-mi.el
> +++ b/lisp/progmodes/gdb-mi.el
> @@ -1001,8 +1001,10 @@ gdb-delchar-or-quit
>         ;; Sending an EOF does not work with GDB-MI; submit an
>         ;; explicit quit command.
>         (progn
> -         (insert "quit")
> -         (comint-send-input t t))
> +          (if (> gdb-control-level 0)
> +              (process-send-eof proc)
> +            (insert "quit")
> +            (comint-send-input t t)))
>        (delete-char arg))))
>
>  (defvar gdb-define-alist nil "Alist of #define directives for GUD tooltips.")

-- 
Yours sincerely, Vladimir Nikishkin