Eli Zaretskii 于2023年6月29日周四 14:08写道: > > > From: Wang Diancheng > > Date: Wed, 28 Jun 2023 11:51:39 +0800 > > Cc: luangruo@yahoo.com, 64186@debbugs.gnu.org > > > > I did some hacks to make gdb-non-stop work, patch is attached. The > > patch try to set `gdb-non-stop` when target is running or at first > > stop. Sorry for rough patch. I'm new for elisp. > > Thanks. This looks about right to me, except that "run&" is not the > only command whose side effect is that the debuggee is running in the > background mode. We also need to at least consider "attach&", I > think. Maybe it would be useful to have a list of such commands, so > that we could expand it as needed in the future, because currently I > don't really understand what triggers background execution that causes > "-list-target-features" to report "async". It sounds possible that > this happens only after the first command that ends with "&", in which > case we will need to add to the list all the commands mentioned in the > "Background Execution" node of the GDB manual. This affects the test > below: > 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.