Subject: bug#14597: 24.3.50; Can't stop the program being debugged with gdb-mi

From: Daimrod <[email-masked]>
Date: Tue, 25 Jun 2013 18:53:23 +0200

[email-masked] (Grégoire Jadi) writes:

> `gdb-io-stop' fails to stop the program being debugged when using the
> GDB/MI interface (M-x gdb run gdb -i=mi). C-c C-z also fails to stop the
> program. However, no error is reported, it fails silently, without doing
> anything.
>
> Recipe:
>
> emacs -Q
> M-x cd RET path/to/emacs-sources/src RET
> M-x gdb RET (edit the minibuffer to use "gdb -i=mi ./emacs") RET
> gdb> run -Q
> [emacs starts]
> Now try C-c C-z in *gud-emacs* or M-x gdb-io-stop RET
>
> This bug is only present when using the GDB/MI interpreter. It doesn't
> happen using just the GUD interaction buffer interface (with M-x gud-gdb
> RET), C-c C-z and `gdb-io-stop' can be used to stop the program being
> debugged in *gud-emacs*.

Here a workaround, it sends a raw string with "C-z" instead of a signal.
There is probably a nicer solution but I don't know `gdb-mi.el' and the
GDB/MI interface enough.

With this, C-c C-z can be used in the gdb-inferior-io buffer to stop the
program being debugged.

>From 30217881358cb685d8f1327dfb476f765a0d48a8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gr=C3=A9goire=20Jadi?= <[email-masked]>
Date: Tue, 25 Jun 2013 18:40:07 +0200
Subject: [PATCH] * lisp/progmodes/gdb-mi.el (gdb-io-stop): Temporarily
 workaround for bug #14597.

Send raw "C-z" via `gdb-inferior-io' buffer instead of sending a signal.
---
 lisp/progmodes/gdb-mi.el | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el
index 0b52302..a597a32 100644
--- a/lisp/progmodes/gdb-mi.el
+++ b/lisp/progmodes/gdb-mi.el
@@ -1646,8 +1646,9 @@ this trigger is subscribed to `gdb-buf-publisher' and called with
 (defun gdb-io-stop ()
   "Stop the program being debugged."
   (interactive)
-  (stop-process
-   (get-buffer-process gud-comint-buffer) comint-ptyp))
+  (process-send-string (get-buffer-process
+                        (gdb-get-buffer-create 'gdb-inferior-io))
+                       (kbd "C-z")))
 
 (defun gdb-io-eof ()
   "Send end-of-file to the program being debugged."
-- 
1.8.0.2722.gc0242e5

-- 
Daimrod/Greg