Subject: bug#64186: Patch: Suppress deprecated '-gdb-set target-async' warning message in gdb-mi.el

From: Wang Diancheng <[email-masked]>
Date: Tue, 20 Jun 2023 10:21:48 +0800

Hi,

The command "-gdb-set target-async" is deprecated since gdb 7.7, It is
annoyed that there is a message "Warning: 'set target-async', an alias for
the command 'set mi-async', is deprecated. Use 'set mi-async'." when gdb
buffer is ready for command. Following is a patch to suppress that
warning.

Thanks.
diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el
index 4428fa72c78..f51b53c2eb3 100644
--- a/lisp/progmodes/gdb-mi.el
+++ b/lisp/progmodes/gdb-mi.el
@@ -1143,9 +1143,14 @@ gdb-non-stop-handler
 	(setq gdb-non-stop nil)
 	(setq gdb-supports-non-stop nil))
     (setq gdb-supports-non-stop t)
-    (gdb-input "-gdb-set target-async 1" 'ignore)
+    (gdb-input "-gdb-set mi-async 1" 'gdb-set-mi-async-handler)
     (gdb-input "-list-target-features" 'gdb-check-target-async)))
 
+(defun gdb-set-mi-async-handler()
+  (goto-char (point-min))
+  (if (re-search-forward "No symbol" nil t)
+    (gdb-input "-gdb-set target-async 1" 'ignore)))
+
 (defun gdb-check-target-async ()
   (goto-char (point-min))
   (unless (re-search-forward "async" nil t)