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

From: [email-masked] (GNU bug Tracking System)
Date: Thu, 06 Jul 2023 07:11:02 +0000

Your bug report

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

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
64186: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=64186
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#64186: Patch: Suppress deprecated '-gdb-set target-async' warning message in gdb-mi.el
From: Eli Zaretskii <[email-masked]>
To: Wang Diancheng <[email-masked]>
Cc: [email-masked], [email-masked]
Date: Thu, 06 Jul 2023 10:10:07 +0300
List-Id: <debbugs-submit.debbugs.gnu.org>

> From: Wang Diancheng <[email-masked]>
> Date: Fri, 30 Jun 2023 15:08:18 +0800
> Cc: [email-masked], [email-masked]
> 
> Thanks for your comments.I think what exactly the value of
> `gdb-last-command’ is not essential for us.
> We just need to know  whether `gdb-last-command' is a CLI command in
> the background or a MI command,
> since here we have already got its "running" status.  We must check
> the target "async" feature after stopping
> the debuggee at the first time in function `gdb-stopped' if
> `gdb-last-command' is not a background CLI command or a MI command.
> 
> > > +  ;; Set `gdb-non-stop` when `gdb-last-command` is a CLI background
> > > +  ;; `run` command e.g. r& or MI command `-exec-run`
> > > +  (when (or (string-match "&\s*$" gdb-last-command)
> > > +            (string-match "-exec-run" gdb-last-command))
> > > +    (gdb-try-check-target-async-support))
> >
> > And I'm not sure I understand the idea behind this part:
> >
> > > @@ -2722,6 +2744,9 @@ gdb-stopped
> > >
> > >      ;; Print "(gdb)" to GUD console
> > >      (when gdb-first-done-or-error
> > > +      ;; If run target with CLI foreground command `run`, `target
> > > +      ;; async` can only be checked when target is stopped
> > > +      (gdb-try-check-target-async-support)
> > >        (setq gdb-filter-output (concat gdb-filter-output gdb-prompt-name)))
> >
> > Can you elaborate?
> 
> Thanks for your questions, according to my comments above, If the
> debuggee has been started by
> a non-background CLI command e.g. “run" or "attach" (no trailing "&")
> commands, we can only
> check the target "async" feature at the code stack.
> 
> >
> > Finally, please don't quote symbols `like this` in comments.  Our
> > conventions are to quote symbols 'like this' or `like this'.
> 
> I updated the patch, see the attachment.

Thanks, installed on the master branch, and closing the bug.

Note that, with this patch you have exhausted the amount of changes we
can accept from you without copyright assignment to the FSF.  Would
you like to start the copyright assignment paperwork at this time, so
that we could accept more changes from you in the future?  If you are
willing to start the assignment process, I will send you the form to
fill and the instructions to go with it.

Subject: Patch: Suppress deprecated '-gdb-set target-async' warning message in gdb-mi.el
From: Wang Diancheng <[email-masked]>
To: bug-gnu-emacs <[email-masked]>
Date: Tue, 20 Jun 2023 10:21:48 +0800
List-Id: <debbugs-submit.debbugs.gnu.org>

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)