unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#63084: 30.0.50; gud: set breakpoint while program is running
@ 2023-04-25 19:18                   ` tatrics
  2023-04-26  6:10                     ` Eli Zaretskii
       [not found]                     ` <handler.63084.D64186.168862741914107.notifdone@debbugs.gnu.org>
  0 siblings, 2 replies; 33+ messages in thread
From: tatrics @ 2023-04-25 19:18 UTC (permalink / raw)
  To: 63084


Hi!

When I try to set a breakpoint with
    "C-x C-a C-b" or (gud-break 1)
it doesn't seem to work.

But if I do
    (gud-call (format "break %s:%d" (buffer-file-name) (line-number-at-pos)))
it does work.



In GNU Emacs 30.0.50 (build 3, x86_64-pc-linux-gnu, GTK+ Version
 3.24.37, cairo version 1.17.8) of 2023-04-14 built on home
Repository revision: d664969544b13fe93a548c9908ce566f9b5cde9c
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101007
System Description: Arch Linux

Configured using:
 'configure --with-native-compilation=yes --with-xinput2
 --with-sound=alsa --without-compress-install --with-x-toolkit=gtk3
 --without-xaw3d --without-gconf --prefix=/usr --sysconfdir=/etc
 --libexecdir=/usr/lib --localstatedir=/var --mandir=/usr/share/man
 --with-gameuser=:games --with-modules --without-libotf
 --without-m17n-flt'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
JSON LCMS2 LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER
PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS
TREE_SITTER WEBP X11 XDBE XIM XINPUT2 XPM GTK3 ZLIB

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: ELisp/l

Minor modes in effect:
  global-git-commit-mode: t
  magit-auto-revert-mode: t
  hi-lock-mode: t
  smerge-mode: t
  auto-revert-mode: t
  show-smartparens-global-mode: t
  show-smartparens-mode: t
  smartparens-mode: t
  display-line-numbers-mode: t
  pyvenv-mode: t
  pdf-occur-global-minor-mode: t
  global-hl-todo-mode: t
  hl-todo-mode: t
  repeat-mode: t
  savehist-mode: t
  fido-vertical-mode: t
  icomplete-vertical-mode: t
  icomplete-mode: t
  fido-mode: t
  window-numbering-mode: t
  recentf-mode: t
  save-place-mode: t
  shell-dirtrack-mode: t
  yas-minor-mode: t
  minibuffer-depth-indicate-mode: t
  global-subword-mode: t
  subword-mode: t
  override-global-mode: t
  desktop-save-mode: t
  delete-selection-mode: t
  server-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tab-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  line-number-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
/home/tatrix/.emacs.d/elpa/cmake-mode-20221130.1357/cmake-mode hides /usr/share/emacs/site-lisp/cmake-mode
~/.emacs.d/scel/el/sclang-util hides /usr/share/emacs/site-lisp/SuperCollider/sclang-util
~/.emacs.d/scel/el/sclang-interp hides /usr/share/emacs/site-lisp/SuperCollider/sclang-interp
~/.emacs.d/scel/el/sclang hides /usr/share/emacs/site-lisp/SuperCollider/sclang
~/.emacs.d/scel/el/sclang-menu hides /usr/share/emacs/site-lisp/SuperCollider/sclang-menu
~/.emacs.d/scel/el/sclang-document hides /usr/share/emacs/site-lisp/SuperCollider/sclang-document
~/.emacs.d/scel/el/sclang-dev hides /usr/share/emacs/site-lisp/SuperCollider/sclang-dev
~/.emacs.d/scel/el/sclang-browser hides /usr/share/emacs/site-lisp/SuperCollider/sclang-browser
~/.emacs.d/scel/el/sclang-widgets hides /usr/share/emacs/site-lisp/SuperCollider/sclang-widgets
~/.emacs.d/scel/el/sclang-help hides /usr/share/emacs/site-lisp/SuperCollider/sclang-help
~/.emacs.d/scel/el/sclang-server hides /usr/share/emacs/site-lisp/SuperCollider/sclang-server
~/.emacs.d/scel/el/sclang-mode hides /usr/share/emacs/site-lisp/SuperCollider/sclang-mode
~/.emacs.d/scel/el/sclang-minor-mode hides /usr/share/emacs/site-lisp/SuperCollider/sclang-minor-mode
~/.emacs.d/scel/el/sclang-keys hides /usr/share/emacs/site-lisp/SuperCollider/sclang-keys
~/.emacs.d/scel/el/sclang-language hides /usr/share/emacs/site-lisp/SuperCollider/sclang-language
/home/tatrix/.emacs.d/elpa/transient-20221202.1727/transient hides /usr/share/emacs/30.0.50/lisp/transient
/home/tatrix/.emacs.d/elpa/use-package-2.4.4/use-package-bind-key hides /usr/share/emacs/30.0.50/lisp/use-package/use-package-bind-key
/home/tatrix/.emacs.d/elpa/use-package-2.4.4/use-package-lint hides /usr/share/emacs/30.0.50/lisp/use-package/use-package-lint
/home/tatrix/.emacs.d/elpa/use-package-2.4.4/use-package-core hides /usr/share/emacs/30.0.50/lisp/use-package/use-package-core
/home/tatrix/.emacs.d/elpa/use-package-2.4.4/use-package-jump hides /usr/share/emacs/30.0.50/lisp/use-package/use-package-jump
/home/tatrix/.emacs.d/elpa/use-package-2.4.4/use-package-ensure-system-package hides /usr/share/emacs/30.0.50/lisp/use-package/use-package-ensure-system-package
/home/tatrix/.emacs.d/elpa/bind-key-2.4.1/bind-key hides /usr/share/emacs/30.0.50/lisp/use-package/bind-key
/home/tatrix/.emacs.d/elpa/use-package-2.4.4/use-package-diminish hides /usr/share/emacs/30.0.50/lisp/use-package/use-package-diminish
/home/tatrix/.emacs.d/elpa/use-package-2.4.4/use-package hides /usr/share/emacs/30.0.50/lisp/use-package/use-package
/home/tatrix/.emacs.d/elpa/use-package-2.4.4/use-package-delight hides /usr/share/emacs/30.0.50/lisp/use-package/use-package-delight
/home/tatrix/.emacs.d/elpa/use-package-2.4.4/use-package-ensure hides /usr/share/emacs/30.0.50/lisp/use-package/use-package-ensure

Features:
(shadow sort emacsbug find-dired ielm macros ispell nodejs-repl
vc-annotate mail-extr arc-mode archive-mode graphviz-dot-mode goto-addr
tabify man semantic/symref/grep semantic/symref em-unix em-term term
disp-table ehelp em-script em-prompt em-pred em-ls em-hist em-glob
em-extpipe em-cmpl em-dirs em-basic em-banner em-alias em-smart esh-mode
esh-var net-utils prescient char-fold prescient-autoloads loaddefs-gen
lisp-mnt mm-archive network-stream url-cache url-http url-auth url-gw
nsm finder-inf cus-start vc-hg vc-bzr vc-src vc-sccs vc-svn vc-cvs
vc-rcs log-view magit-extras magit-bookmark magit-submodule
magit-obsolete magit-blame magit-stash magit-reflog magit-bisect
magit-push magit-pull magit-fetch magit-clone magit-remote magit-commit
magit-sequence magit-notes magit-worktree magit-tag magit-merge
magit-branch magit-reset magit-files magit-refs magit-status magit
magit-repos magit-apply magit-wip magit-log magit-diff git-commit
log-edit pcvs-util add-log magit-core magit-autorevert magit-margin
magit-transient magit-process with-editor magit-mode magit-git
completion misc cl-print cmacexp magit-base which-func magit-section crm
compat-27 compat-26 info-look misearch multi-isearch shortdoc dabbrev
pulse smartparens-go go-mode find-file ffap orderless asm-mode
emacs-news-mode restclient mule-util make-mode dired-aux flymake-cc
citre citre-global citre-tags citre-ctags citre-readtags
citre-readtags-tables citre-backend-interface citre-ui-peek color
citre-ui-jump citre-common-tag citre-common-util c-ts-mode hi-lock
smerge-mode diff vc bug-reference autorevert smartparens-config
smartparens-javascript smartparens-org smartparens-text
smartparens-python smartparens-c smartparens display-line-numbers time
inspector edebug treeview tshell transient erc erc-backend erc-networks
erc-common erc-compat erc-loaddefs alert log4e notifications diary-lib
diary-loaddefs cal-iso vc-git vc-dispatcher org-indent oc-basic ol-eww
eww url-queue mm-url ol-rmail ol-mhe ol-irc ol-info ol-gnus nnselect
gnus-art mm-uu mml2015 mm-view mml-smime smime gnutls dig gnus-sum shr
pixel-fill kinsoku url-file svg dom gnus-group gnus-undo gnus-start
gnus-dbus dbus gnus-cloud nnimap nnmail mail-source utf7 nnoo gnus-spec
gnus-int gnus-range message sendmail yank-media puny rfc822 mml mml-sec
epa epg rfc6068 epg-config mm-decode mm-bodies mm-encode mail-parse
rfc2231 rfc2047 rfc2045 ietf-drums mailabbrev gmm-utils mailheader
gnus-win gnus nnheader gnus-util mail-utils range mm-util mail-prsvr
ol-docview doc-view ol-bibtex bibtex ol-bbdb ol-w3m ol-doi org-link-doi
face-remap org-agenda org-element org-persist xdg org-id avl-tree
org-refile xml gntp highlight-indentation company-capf company help-fns
radix-tree elpy elpy-rpc pyvenv elpy-shell elpy-profile elpy-django
elpy-refactor diff-mode python ido hideshow grep etags fileloop
pdf-occur ibuf-ext ibuffer ibuffer-loaddefs tablist advice
tablist-filter semantic/wisent/comp semantic/wisent
semantic/wisent/wisent semantic/util-modes semantic/util semantic
semantic/tag semantic/lex semantic/fw mode-local cedet pdf-isearch
pdf-misc pdf-loader pdf-tools pdf-view bookmark jka-compr pdf-cache
pdf-info tq pdf-util pdf-macs image-mode dired dired-loaddefs exif
sql-indent sql view hl-todo compat compat-macs kotlin-mode
kotlin-mode-lexer typescript-mode jai-mode derived cl let-alist repeat
gdb-mi bindat gud dumb-jump popup eglot external-completion jsonrpc xref
flymake-proc flymake thingatpt ert ewoc debug backtrace filenotify
compile text-property-search pcase savehist icomplete deadgrep project
spinner dash s transpose-frame window-numbering recentf tree-widget
saveplace tramp-sh tramp tramp-loaddefs trampver tramp-integration
tramp-compat shell parse-time iso8601 ls-lisp yasnippet-snippets
yasnippet mb-depth js c-ts-common treesit imenu cc-mode cc-fonts
cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs
use-package-bind-key cap-words superword subword edmacro kmacro bind-key
easy-mmode eshell esh-cmd generator esh-ext esh-opt esh-proc esh-io
esh-arg esh-module esh-groups esh-util files-x desktop frameset delsel
org ob ob-tangle ob-ref ob-lob ob-table ob-exp org-macro org-src
ob-comint org-pcomplete pcomplete comint ansi-osc ansi-color ring
org-list org-footnote org-faces org-entities time-date noutline outline
ob-emacs-lisp ob-core ob-eval org-cycle org-table ol org-fold
org-fold-core org-keys oc org-loaddefs find-func cal-menu calendar
cal-loaddefs org-version org-compat org-macs format-spec
use-package-core comp comp-cstr warnings cl-extra help-mode cus-edit pp
cus-load icons wid-edit server zig-mode-autoloads hl-todo-autoloads
cmake-mode-autoloads magit-autoloads consult-autoloads wgrep-autoloads
kakoune-autoloads corfu-autoloads loc-changes-autoloads
deadgrep-autoloads shader-mode-autoloads rustic-autoloads
rust-mode-autoloads orderless-autoloads undo-tree-autoloads f-autoloads
multiple-cursors-autoloads transpose-frame-autoloads inspector-autoloads
treeview-autoloads kotlin-mode-autoloads pdf-tools-autoloads
tablist-autoloads graphviz-dot-mode-autoloads magit-section-autoloads
yasnippet-snippets-autoloads async-autoloads nodejs-repl-autoloads
use-package-autoloads bind-key-autoloads spinner-autoloads
load-relative-autoloads ryo-modal-autoloads dumb-jump-autoloads
popup-autoloads dart-mode-autoloads smartparens-autoloads dash-autoloads
vertico-autoloads expand-region-autoloads flutter-autoloads
queue-autoloads restclient-autoloads test-simple-autoloads
xterm-color-autoloads avy-autoloads elpy-autoloads s-autoloads
yasnippet-autoloads pyvenv-autoloads highlight-indentation-autoloads
company-autoloads systemd-autoloads rx citre-autoloads alert-autoloads
log4e-autoloads gntp-autoloads markdown-mode-autoloads
git-commit-autoloads with-editor-autoloads transient-autoloads info
compat-autoloads package browse-url url url-proxy url-privacy url-expand
url-methods url-history url-cookie generate-lisp-file url-domsuf
url-util mailcap url-handlers url-parse auth-source cl-seq eieio
eieio-core cl-macs password-cache json subr-x map byte-opt gv bytecomp
byte-compile url-vars cl-loaddefs cl-lib rmc iso-transl tooltip cconv
eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type
elisp-mode mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd
fontset image regexp-opt fringe tabulated-list replace newcomment
text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow
isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax
font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic
indonesian philippine cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
composite emoji-zwj charscript charprop case-table epa-hook
jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs
theme-loaddefs faces cus-face macroexp files window text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget keymap
hashtable-print-readable backquote threads dbusbind inotify lcms2
dynamic-setting system-font-setting font-render-setting cairo
move-toolbar gtk x-toolkit xinput2 x multi-tty make-network-process
native-compile emacs)

Memory information:
((conses 16 1699631 306868)
 (symbols 48 65082 11)
 (strings 32 318425 37548)
 (string-bytes 1 10087048)
 (vectors 16 121578)
 (vector-slots 8 3145591 317141)
 (floats 8 1064 1366)
 (intervals 56 97458 3425)
 (buffers 984 239))





^ permalink raw reply	[flat|nested] 33+ messages in thread

* bug#63084: 30.0.50; gud: set breakpoint while program is running
  2023-04-25 19:18                   ` bug#63084: 30.0.50; gud: set breakpoint while program is running tatrics
@ 2023-04-26  6:10                     ` Eli Zaretskii
  2023-04-26  8:48                       ` TatriX
       [not found]                     ` <handler.63084.D64186.168862741914107.notifdone@debbugs.gnu.org>
  1 sibling, 1 reply; 33+ messages in thread
From: Eli Zaretskii @ 2023-04-26  6:10 UTC (permalink / raw)
  To: tatrics; +Cc: 63084

> From: tatrics@gmail.com
> Date: Tue, 25 Apr 2023 21:18:52 +0200
> 
> When I try to set a breakpoint with
>     "C-x C-a C-b" or (gud-break 1)
> it doesn't seem to work.

I cannot reproduce this: "C-x C-a C-b" does work for me.  Please
describe the recipe for reproducing the problem completely, starting
from "emacs -Q" and including all the commands you need to type/invoke
to reproduce the issue.

Thanks.





^ permalink raw reply	[flat|nested] 33+ messages in thread

* bug#63084: 30.0.50; gud: set breakpoint while program is running
  2023-04-26  6:10                     ` Eli Zaretskii
@ 2023-04-26  8:48                       ` TatriX
  2023-04-26  9:44                         ` Eli Zaretskii
  0 siblings, 1 reply; 33+ messages in thread
From: TatriX @ 2023-04-26  8:48 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 63084

[-- Attachment #1: Type: text/plain, Size: 1157 bytes --]

Oh, sorry. I tried on a different machine, and realized one have to use
"run&".

So, here's what I did:

$ cat main.c
    #include <stdio.h>
    #include <unistd.h>

    int main(void) {
        for (int i = 0; ; i++) {
            printf("%d\n", i);
            sleep(1);
        }
    }

$ gcc -g -o break main.c
$ emacs -Q main.c
M-x gdb RET
# in *gud-break*, NOTE it's "run&"
(gdb) run&
# in main.c
(goto-line 6)
(gud-break 1) ; or C-x C-a C-b
# nothing happens
M-: (gud-call "break 6") RET
# breakpoint is set and process execution is paused on hitting that
breakpoint

Hope that's more clear now!

On Wed, Apr 26, 2023 at 8:10 AM Eli Zaretskii <eliz@gnu.org> wrote:

> > From: tatrics@gmail.com
> > Date: Tue, 25 Apr 2023 21:18:52 +0200
> >
> > When I try to set a breakpoint with
> >     "C-x C-a C-b" or (gud-break 1)
> > it doesn't seem to work.
>
> I cannot reproduce this: "C-x C-a C-b" does work for me.  Please
> describe the recipe for reproducing the problem completely, starting
> from "emacs -Q" and including all the commands you need to type/invoke
> to reproduce the issue.
>
> Thanks.
>

[-- Attachment #2: Type: text/html, Size: 1901 bytes --]

^ permalink raw reply	[flat|nested] 33+ messages in thread

* bug#63084: 30.0.50; gud: set breakpoint while program is running
  2023-04-26  8:48                       ` TatriX
@ 2023-04-26  9:44                         ` Eli Zaretskii
  2023-04-26 11:19                           ` Eli Zaretskii
  2023-05-05  5:53                           ` Eli Zaretskii
  0 siblings, 2 replies; 33+ messages in thread
From: Eli Zaretskii @ 2023-04-26  9:44 UTC (permalink / raw)
  To: TatriX; +Cc: 63084

> From: TatriX <tatrics@gmail.com>
> Date: Wed, 26 Apr 2023 10:48:53 +0200
> Cc: 63084@debbugs.gnu.org
> 
> Oh, sorry. I tried on a different machine, and realized one have to use "run&".
> 
> So, here's what I did:
> 
> $ cat main.c
>     #include <stdio.h>
>     #include <unistd.h>
> 
>     int main(void) {
>         for (int i = 0; ; i++) {
>             printf("%d\n", i);
>             sleep(1);
>         }
>     }
> 
> $ gcc -g -o break main.c
> $ emacs -Q main.c
> M-x gdb RET
> # in *gud-break*, NOTE it's "run&"
> (gdb) run&
> # in main.c
> (goto-line 6)
> (gud-break 1) ; or C-x C-a C-b
> # nothing happens
> M-: (gud-call "break 6") RET
> # breakpoint is set and process execution is paused on hitting that breakpoint

What is the value of gdb-running and of gdb-non-stop after you "run&"
the program?





^ permalink raw reply	[flat|nested] 33+ messages in thread

* bug#63084: 30.0.50; gud: set breakpoint while program is running
  2023-04-26  9:44                         ` Eli Zaretskii
@ 2023-04-26 11:19                           ` Eli Zaretskii
  2023-04-26 11:49                             ` TatriX
  2023-05-05  5:52                             ` Eli Zaretskii
  2023-05-05  5:53                           ` Eli Zaretskii
  1 sibling, 2 replies; 33+ messages in thread
From: Eli Zaretskii @ 2023-04-26 11:19 UTC (permalink / raw)
  To: Ken Brown; +Cc: tatrics, 63084

> Cc: 63084@debbugs.gnu.org
> Date: Wed, 26 Apr 2023 12:44:29 +0300
> From: Eli Zaretskii <eliz@gnu.org>
> 
> > From: TatriX <tatrics@gmail.com>
> > Date: Wed, 26 Apr 2023 10:48:53 +0200
> > Cc: 63084@debbugs.gnu.org
> > 
> > Oh, sorry. I tried on a different machine, and realized one have to use "run&".
> > 
> > So, here's what I did:
> > 
> > $ cat main.c
> >     #include <stdio.h>
> >     #include <unistd.h>
> > 
> >     int main(void) {
> >         for (int i = 0; ; i++) {
> >             printf("%d\n", i);
> >             sleep(1);
> >         }
> >     }
> > 
> > $ gcc -g -o break main.c
> > $ emacs -Q main.c
> > M-x gdb RET
> > # in *gud-break*, NOTE it's "run&"
> > (gdb) run&
> > # in main.c
> > (goto-line 6)
> > (gud-break 1) ; or C-x C-a C-b
> > # nothing happens
> > M-: (gud-call "break 6") RET
> > # breakpoint is set and process execution is paused on hitting that breakpoint
> 
> What is the value of gdb-running and of gdb-non-stop after you "run&"
> the program?

Ken, could you please take a look at this bug report?  AFAICT, it has
something to do with the code you changed some 11 years ago (see
bug#9878).

Basically, what "M-x gdb" now does is send the "-gdb-set non-stop 1"
command, then, when we get a valid response for it, it sends the
"-gdb-set target-async 1" command.  So far so good, but when we get
the response for the latter, we send the "-list-target-features"
command and expect it to report "async" as one of the features, and if
not, we decide that non-stop mode is not supported.

My testing indicates that -list-target-features will only report
"async" after we run the program or attach to a process.  So we are
(almost) always disabling the non-stop mode, which doesn't seem right
to me.

So I'm interested to know how you tested this particular addition of
the -list-target-features command back then (if you remember).  Also,
what happens today when you start "M-x gdb" with a modern version of
GDB that does support target-async and non-stop mode.

The root cause that "C-x C-a C-b" doesn't work in the OP is that
gud-break (and any other command defined via gud-def) does nothing
when gud-running is non-nil.  This needs to be changed if we are
running the program in the background, but the question is how to know
that reliably, and that is related -list-target-features, among other
things.

TIA





^ permalink raw reply	[flat|nested] 33+ messages in thread

* bug#63084: 30.0.50; gud: set breakpoint while program is running
  2023-04-26 11:19                           ` Eli Zaretskii
@ 2023-04-26 11:49                             ` TatriX
  2023-05-05  5:52                             ` Eli Zaretskii
  1 sibling, 0 replies; 33+ messages in thread
From: TatriX @ 2023-04-26 11:49 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 63084, Ken Brown

[-- Attachment #1: Type: text/plain, Size: 2857 bytes --]

> What is the value of gdb-running and of gdb-non-stop after you "run&"
> the program?

ELISP> gdb-running
*** Eval error ***  Symbol’s value as variable is void: gdb-running
ELISP> gud-running
t
ELISP> gdb-non-stop
nil

On Wed, Apr 26, 2023 at 1:19 PM Eli Zaretskii <eliz@gnu.org> wrote:

> > Cc: 63084@debbugs.gnu.org
> > Date: Wed, 26 Apr 2023 12:44:29 +0300
> > From: Eli Zaretskii <eliz@gnu.org>
> >
> > > From: TatriX <tatrics@gmail.com>
> > > Date: Wed, 26 Apr 2023 10:48:53 +0200
> > > Cc: 63084@debbugs.gnu.org
> > >
> > > Oh, sorry. I tried on a different machine, and realized one have to
> use "run&".
> > >
> > > So, here's what I did:
> > >
> > > $ cat main.c
> > >     #include <stdio.h>
> > >     #include <unistd.h>
> > >
> > >     int main(void) {
> > >         for (int i = 0; ; i++) {
> > >             printf("%d\n", i);
> > >             sleep(1);
> > >         }
> > >     }
> > >
> > > $ gcc -g -o break main.c
> > > $ emacs -Q main.c
> > > M-x gdb RET
> > > # in *gud-break*, NOTE it's "run&"
> > > (gdb) run&
> > > # in main.c
> > > (goto-line 6)
> > > (gud-break 1) ; or C-x C-a C-b
> > > # nothing happens
> > > M-: (gud-call "break 6") RET
> > > # breakpoint is set and process execution is paused on hitting that
> breakpoint
> >
> > What is the value of gdb-running and of gdb-non-stop after you "run&"
> > the program?
>
> Ken, could you please take a look at this bug report?  AFAICT, it has
> something to do with the code you changed some 11 years ago (see
> bug#9878).
>
> Basically, what "M-x gdb" now does is send the "-gdb-set non-stop 1"
> command, then, when we get a valid response for it, it sends the
> "-gdb-set target-async 1" command.  So far so good, but when we get
> the response for the latter, we send the "-list-target-features"
> command and expect it to report "async" as one of the features, and if
> not, we decide that non-stop mode is not supported.
>
> My testing indicates that -list-target-features will only report
> "async" after we run the program or attach to a process.  So we are
> (almost) always disabling the non-stop mode, which doesn't seem right
> to me.
>
> So I'm interested to know how you tested this particular addition of
> the -list-target-features command back then (if you remember).  Also,
> what happens today when you start "M-x gdb" with a modern version of
> GDB that does support target-async and non-stop mode.
>
> The root cause that "C-x C-a C-b" doesn't work in the OP is that
> gud-break (and any other command defined via gud-def) does nothing
> when gud-running is non-nil.  This needs to be changed if we are
> running the program in the background, but the question is how to know
> that reliably, and that is related -list-target-features, among other
> things.
>
> TIA
>

[-- Attachment #2: Type: text/html, Size: 3989 bytes --]

^ permalink raw reply	[flat|nested] 33+ messages in thread

* bug#63084: 30.0.50; gud: set breakpoint while program is running
  2023-04-26 11:19                           ` Eli Zaretskii
  2023-04-26 11:49                             ` TatriX
@ 2023-05-05  5:52                             ` Eli Zaretskii
  1 sibling, 0 replies; 33+ messages in thread
From: Eli Zaretskii @ 2023-05-05  5:52 UTC (permalink / raw)
  To: kbrown; +Cc: tatrics, 63084

Ping!  Ken, could you please look into this, if you have time?

> Cc: tatrics@gmail.com, 63084@debbugs.gnu.org
> Date: Wed, 26 Apr 2023 14:19:31 +0300
> From: Eli Zaretskii <eliz@gnu.org>
> 
> > Cc: 63084@debbugs.gnu.org
> > Date: Wed, 26 Apr 2023 12:44:29 +0300
> > From: Eli Zaretskii <eliz@gnu.org>
> > 
> > > From: TatriX <tatrics@gmail.com>
> > > Date: Wed, 26 Apr 2023 10:48:53 +0200
> > > Cc: 63084@debbugs.gnu.org
> > > 
> > > Oh, sorry. I tried on a different machine, and realized one have to use "run&".
> > > 
> > > So, here's what I did:
> > > 
> > > $ cat main.c
> > >     #include <stdio.h>
> > >     #include <unistd.h>
> > > 
> > >     int main(void) {
> > >         for (int i = 0; ; i++) {
> > >             printf("%d\n", i);
> > >             sleep(1);
> > >         }
> > >     }
> > > 
> > > $ gcc -g -o break main.c
> > > $ emacs -Q main.c
> > > M-x gdb RET
> > > # in *gud-break*, NOTE it's "run&"
> > > (gdb) run&
> > > # in main.c
> > > (goto-line 6)
> > > (gud-break 1) ; or C-x C-a C-b
> > > # nothing happens
> > > M-: (gud-call "break 6") RET
> > > # breakpoint is set and process execution is paused on hitting that breakpoint
> > 
> > What is the value of gdb-running and of gdb-non-stop after you "run&"
> > the program?
> 
> Ken, could you please take a look at this bug report?  AFAICT, it has
> something to do with the code you changed some 11 years ago (see
> bug#9878).
> 
> Basically, what "M-x gdb" now does is send the "-gdb-set non-stop 1"
> command, then, when we get a valid response for it, it sends the
> "-gdb-set target-async 1" command.  So far so good, but when we get
> the response for the latter, we send the "-list-target-features"
> command and expect it to report "async" as one of the features, and if
> not, we decide that non-stop mode is not supported.
> 
> My testing indicates that -list-target-features will only report
> "async" after we run the program or attach to a process.  So we are
> (almost) always disabling the non-stop mode, which doesn't seem right
> to me.
> 
> So I'm interested to know how you tested this particular addition of
> the -list-target-features command back then (if you remember).  Also,
> what happens today when you start "M-x gdb" with a modern version of
> GDB that does support target-async and non-stop mode.
> 
> The root cause that "C-x C-a C-b" doesn't work in the OP is that
> gud-break (and any other command defined via gud-def) does nothing
> when gud-running is non-nil.  This needs to be changed if we are
> running the program in the background, but the question is how to know
> that reliably, and that is related -list-target-features, among other
> things.
> 
> TIA
> 
> 
> 
> 





^ permalink raw reply	[flat|nested] 33+ messages in thread

* bug#63084: 30.0.50; gud: set breakpoint while program is running
  2023-04-26  9:44                         ` Eli Zaretskii
  2023-04-26 11:19                           ` Eli Zaretskii
@ 2023-05-05  5:53                           ` Eli Zaretskii
  2023-05-05  7:15                             ` TatriX
  1 sibling, 1 reply; 33+ messages in thread
From: Eli Zaretskii @ 2023-05-05  5:53 UTC (permalink / raw)
  To: tatrics; +Cc: 63084

Ping!  Could you please answer my questions below?  Knowing the
answers is necessary for investigating this issue.

Thanks.

> Cc: 63084@debbugs.gnu.org
> Date: Wed, 26 Apr 2023 12:44:29 +0300
> From: Eli Zaretskii <eliz@gnu.org>
> 
> > From: TatriX <tatrics@gmail.com>
> > Date: Wed, 26 Apr 2023 10:48:53 +0200
> > Cc: 63084@debbugs.gnu.org
> > 
> > Oh, sorry. I tried on a different machine, and realized one have to use "run&".
> > 
> > So, here's what I did:
> > 
> > $ cat main.c
> >     #include <stdio.h>
> >     #include <unistd.h>
> > 
> >     int main(void) {
> >         for (int i = 0; ; i++) {
> >             printf("%d\n", i);
> >             sleep(1);
> >         }
> >     }
> > 
> > $ gcc -g -o break main.c
> > $ emacs -Q main.c
> > M-x gdb RET
> > # in *gud-break*, NOTE it's "run&"
> > (gdb) run&
> > # in main.c
> > (goto-line 6)
> > (gud-break 1) ; or C-x C-a C-b
> > # nothing happens
> > M-: (gud-call "break 6") RET
> > # breakpoint is set and process execution is paused on hitting that breakpoint
> 
> What is the value of gdb-running and of gdb-non-stop after you "run&"
> the program?
> 
> 
> 
> 





^ permalink raw reply	[flat|nested] 33+ messages in thread

* bug#63084: 30.0.50; gud: set breakpoint while program is running
  2023-05-05  5:53                           ` Eli Zaretskii
@ 2023-05-05  7:15                             ` TatriX
  2023-05-06 11:43                               ` Eli Zaretskii
  0 siblings, 1 reply; 33+ messages in thread
From: TatriX @ 2023-05-05  7:15 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 63084

> Could you please answer my questions below?

Sorry, I'm not sure what questions you are referring to.

>> What is the value of gdb-running and of gdb-non-stop after you "run&"
>> the program?
> gud-running is t
> gdb-non-stop is nil

in case my last email didn't get through.





^ permalink raw reply	[flat|nested] 33+ messages in thread

* bug#63084: 30.0.50; gud: set breakpoint while program is running
  2023-05-05  7:15                             ` TatriX
@ 2023-05-06 11:43                               ` Eli Zaretskii
  2023-05-27 21:22                                 ` TatriX
  0 siblings, 1 reply; 33+ messages in thread
From: Eli Zaretskii @ 2023-05-06 11:43 UTC (permalink / raw)
  To: TatriX; +Cc: 63084

> From: TatriX <tatrics@gmail.com>
> Date: Fri, 5 May 2023 09:15:19 +0200
> Cc: 63084@debbugs.gnu.org
> 
> > Could you please answer my questions below?
> 
> Sorry, I'm not sure what questions you are referring to.
> 
> >> What is the value of gdb-running and of gdb-non-stop after you "run&"
> >> the program?
> > gud-running is t
> > gdb-non-stop is nil
> 
> in case my last email didn't get through.

Thanks.  The value of gdb-non-stop is the problem: it basically means
that gdb-mi thinks GDB doesn't support async execution, and therefore
doesn't behave accordingly, which is evidenced by gud-running being
non-nil.

I hope Ken responds soon, because I think we need to redesign the part
which asks GDB about support for target-async and non-stop mode.





^ permalink raw reply	[flat|nested] 33+ messages in thread

* bug#63084: 30.0.50; gud: set breakpoint while program is running
  2023-05-06 11:43                               ` Eli Zaretskii
@ 2023-05-27 21:22                                 ` TatriX
  2023-05-28  5:28                                   ` Eli Zaretskii
  0 siblings, 1 reply; 33+ messages in thread
From: TatriX @ 2023-05-27 21:22 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 63084

While we waiting for a reply, may I ask what is the relationship
between gdb-mi.el and gud.el?





^ permalink raw reply	[flat|nested] 33+ messages in thread

* bug#63084: 30.0.50; gud: set breakpoint while program is running
  2023-05-27 21:22                                 ` TatriX
@ 2023-05-28  5:28                                   ` Eli Zaretskii
  2023-05-28 21:10                                     ` TatriX
  0 siblings, 1 reply; 33+ messages in thread
From: Eli Zaretskii @ 2023-05-28  5:28 UTC (permalink / raw)
  To: TatriX; +Cc: 63084, kbrown

> From: TatriX <tatrics@gmail.com>
> Date: Sat, 27 May 2023 23:22:52 +0200
> Cc: 63084@debbugs.gnu.org
> 
> While we waiting for a reply

Actually, I've given up on waiting for a reply (Ken, are you there?),
so now we basically wait for me to get enough free time to work on
this non-trivial issue.  I've meanwhile set up one of my systems to
support asynchronous and non-stop execution in GDB, so that I could
test the changes.  Stay tuned.

> may I ask what is the relationship between gdb-mi.el and gud.el?

gdb-mi.el is basically a (very significant) extension of gud.el.
gdb-mi.el builds on the basic features provided by gud.el for GDB, and
adds a lot of stuff of its own, both to support the GDB/MI protocol
and provide a GUI front-end display, similar to other debugging UIs.





^ permalink raw reply	[flat|nested] 33+ messages in thread

* bug#63084: 30.0.50; gud: set breakpoint while program is running
  2023-05-28  5:28                                   ` Eli Zaretskii
@ 2023-05-28 21:10                                     ` TatriX
  2023-05-29 11:45                                       ` Eli Zaretskii
  0 siblings, 1 reply; 33+ messages in thread
From: TatriX @ 2023-05-28 21:10 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 63084, kbrown

[-- Attachment #1: Type: text/plain, Size: 1251 bytes --]

Nice! Thank you!

I tend to use `M-x gdb` with `gdb-many-windows` disabled but easily
reachable via a custom keybinding that toggles it.

One feature I'm really missing is a variable watcher.

There's a locals view which is useful sometimes, but gets messy when
there are handfull of variables in scope.  Then there's a speedbar,
but as far as I can tell it's impossible to make it into a regular
window, which means it and cannot participate in my regular emacs
window workflow, which is sub-optimal. But the biggest issue with it
is that it forgets what was added to it on every program restart,
making it pretty much unusable for my needs.

I've played a bit with gdb-mi and managed to make something that
somewhat works. Please check a screenshot in the attachment.

I can add variables to watch via the minibuffer. They get updated in
the *gdb-watch* window through `-data-evaluate-expression` in the
`gdb-stopped-functions` hook.

I've also started looking at "GDB/MI Variable Objects"(1) which looks
like a proper way to add that functionality. But it requires a bit
more work.

How do you feel about having something similar in gdb-mi?

1: https://sourceware.org/gdb/onlinedocs/gdb/GDB_002fMI-Variable-Objects.html#GDB_002fMI-Variable-Objects

[-- Attachment #2: 2023-05-28-225817_3838x2124_scrot.png --]
[-- Type: image/png, Size: 667093 bytes --]

^ permalink raw reply	[flat|nested] 33+ messages in thread

* bug#63084: 30.0.50; gud: set breakpoint while program is running
  2023-05-28 21:10                                     ` TatriX
@ 2023-05-29 11:45                                       ` Eli Zaretskii
  0 siblings, 0 replies; 33+ messages in thread
From: Eli Zaretskii @ 2023-05-29 11:45 UTC (permalink / raw)
  To: TatriX; +Cc: 63084, kbrown

> From: TatriX <tatrics@gmail.com>
> Date: Sun, 28 May 2023 23:10:21 +0200
> Cc: 63084@debbugs.gnu.org, kbrown@cornell.edu
> 
> One feature I'm really missing is a variable watcher.
> 
> There's a locals view which is useful sometimes, but gets messy when
> there are handfull of variables in scope.  Then there's a speedbar,
> but as far as I can tell it's impossible to make it into a regular
> window, which means it and cannot participate in my regular emacs
> window workflow, which is sub-optimal.

I'm not sure I understand: how does using Speedbar interfere with your
workflow?

> But the biggest issue with it is that it forgets what was added to
> it on every program restart, making it pretty much unusable for my
> needs.

I'm not sure how can this work otherwise: watchpoints are usually
context-dependent, and are automatically deleted when their component
variables go out of scope.  How would you know when to re-apply
watchpoint settings when you re-run the program?  You must be in the
correct call-stack frame to be able to do that, or else all you get as
an error from GDB.

The way to automate re-application of watchpoints is to create one or
more breakpoints, at suitable locations in the program, and have the
"commands" of those breakpoints insert watchpoints, then continue the
program.  This is usually done in a .gdbinit file (or some other
script file read by GDB), and I'm not sure I understand how you can do
that programmatically, since Emacs is not really aware of GDB
call-stack frames.

> I've played a bit with gdb-mi and managed to make something that
> somewhat works. Please check a screenshot in the attachment.
> 
> I can add variables to watch via the minibuffer. They get updated in
> the *gdb-watch* window through `-data-evaluate-expression` in the
> `gdb-stopped-functions` hook.
> 
> I've also started looking at "GDB/MI Variable Objects"(1) which looks
> like a proper way to add that functionality. But it requires a bit
> more work.

AFAIK, Variable Objects cannot be replacements for watchpoints, since
GDB must actively poll for updates of the values, as opposed to
watchpoints, whose changes cause the program to stop.

> How do you feel about having something similar in gdb-mi?

It would be a useful addition, but I'd expect it to be easily doable
by reusing what we currently have (I'm not sure I understand why we
currently insist on Speedbar for these displays).

Anyway, this should be discussed as a separate feature request, not as
part of this bug report.





^ permalink raw reply	[flat|nested] 33+ messages in thread

* bug#64186: Patch: Suppress deprecated '-gdb-set target-async' warning message in gdb-mi.el
@ 2023-06-20  2:21 Wang Diancheng
  2023-06-20  7:24 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 33+ messages in thread
From: Wang Diancheng @ 2023-06-20  2:21 UTC (permalink / raw)
  To: 64186

[-- Attachment #1: Type: text/plain, Size: 309 bytes --]

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.

[-- Attachment #2: gdb-mi-suppress-target-async-warning.patch --]
[-- Type: text/x-patch, Size: 760 bytes --]

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)

^ permalink raw reply related	[flat|nested] 33+ messages in thread

* bug#64186: Patch: Suppress deprecated '-gdb-set target-async' warning message in gdb-mi.el
  2023-06-20  2:21 bug#64186: Patch: Suppress deprecated '-gdb-set target-async' warning message in gdb-mi.el Wang Diancheng
@ 2023-06-20  7:24 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-06-20  9:25   ` Wang Diancheng
  0 siblings, 1 reply; 33+ messages in thread
From: Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-06-20  7:24 UTC (permalink / raw)
  To: Wang Diancheng; +Cc: 64186

Wang Diancheng <dianchengwang@gmail.com> writes:

> 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.

What about versions of GDB earlier than 7.7?  We should detect them, and
use `set mi-async' there.






^ permalink raw reply	[flat|nested] 33+ messages in thread

* bug#64186: Patch: Suppress deprecated '-gdb-set target-async' warning message in gdb-mi.el
  2023-06-20  7:24 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-06-20  9:25   ` Wang Diancheng
  2023-06-20  9:43     ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-06-20 11:55     ` Eli Zaretskii
  0 siblings, 2 replies; 33+ messages in thread
From: Wang Diancheng @ 2023-06-20  9:25 UTC (permalink / raw)
  To: Po Lu; +Cc: 64186

Po Lu <luangruo@yahoo.com> 于2023年6月20日周二 15:24写道:
>
> Wang Diancheng <dianchengwang@gmail.com> writes:
>
> > 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.
>
> What about versions of GDB earlier than 7.7?  We should detect them, and
> use `set mi-async' there.
>
Like other places of gdb-mi.el,  function gdb-set-mi-async-handler()
will use 'set target-async' if GDB (versions earlier than 7.7) reports
"No symbol".





^ permalink raw reply	[flat|nested] 33+ messages in thread

* bug#64186: Patch: Suppress deprecated '-gdb-set target-async' warning message in gdb-mi.el
  2023-06-20  9:25   ` Wang Diancheng
@ 2023-06-20  9:43     ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-06-20 11:55     ` Eli Zaretskii
  1 sibling, 0 replies; 33+ messages in thread
From: Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-06-20  9:43 UTC (permalink / raw)
  To: Wang Diancheng; +Cc: 64186

Wang Diancheng <dianchengwang@gmail.com> writes:

> Like other places of gdb-mi.el,  function gdb-set-mi-async-handler()
> will use 'set target-async' if GDB (versions earlier than 7.7) reports
> "No symbol".

OK, good.  Thanks.





^ permalink raw reply	[flat|nested] 33+ messages in thread

* bug#64186: Patch: Suppress deprecated '-gdb-set target-async' warning message in gdb-mi.el
  2023-06-20  9:25   ` Wang Diancheng
  2023-06-20  9:43     ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-06-20 11:55     ` Eli Zaretskii
  2023-06-21  6:49       ` Wang Diancheng
  1 sibling, 1 reply; 33+ messages in thread
From: Eli Zaretskii @ 2023-06-20 11:55 UTC (permalink / raw)
  To: Wang Diancheng; +Cc: luangruo, 64186

> Cc: 64186@debbugs.gnu.org
> From: Wang Diancheng <dianchengwang@gmail.com>
> Date: Tue, 20 Jun 2023 17:25:06 +0800
> 
> Po Lu <luangruo@yahoo.com> 于2023年6月20日周二 15:24写道:
> >
> > What about versions of GDB earlier than 7.7?  We should detect them, and
> > use `set mi-async' there.
> >
> Like other places of gdb-mi.el,  function gdb-set-mi-async-handler()
> will use 'set target-async' if GDB (versions earlier than 7.7) reports
> "No symbol".

Isn't that too late, though?  The GDB manual says:

  On some targets, GDB is capable of processing MI commands even while the
  target is running.  This is called "asynchronous command execution"
  (*note Background Execution::).  The frontend may specify a preference
  for asynchronous execution using the '-gdb-set mi-async 1' command,
  which should be emitted before either running the executable or
  attaching to the target.

However, the gdb-input call sends the request without waiting for the
response, so the handler of the response will be invoked much later,
after GDB already processed quite a few commands sent to it by Emacs
in the meantime.  Thus, by the time gdb-set-mi-async-handler is
called, and we see the "No symbol" thingy and send the target-async
command instead, it could be too late, because the executable was
already run.

There's actually more here than meets the eye; see bug#63084.

Given all that mess, I wonder if "M-x gdb" in its current shape indeed
supports the asynchronous execution.  If it doesn't, we may be better
off not sending that command at all for now, until bug#63084 is fixed.





^ permalink raw reply	[flat|nested] 33+ messages in thread

* bug#64186: Patch: Suppress deprecated '-gdb-set target-async' warning message in gdb-mi.el
  2023-06-20 11:55     ` Eli Zaretskii
@ 2023-06-21  6:49       ` Wang Diancheng
  2023-06-21 13:12         ` Eli Zaretskii
  0 siblings, 1 reply; 33+ messages in thread
From: Wang Diancheng @ 2023-06-21  6:49 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: luangruo, 64186

Eli Zaretskii <eliz@gnu.org> 于2023年6月20日周二 19:55写道:
>
> > Cc: 64186@debbugs.gnu.org
> > From: Wang Diancheng <dianchengwang@gmail.com>
> > Date: Tue, 20 Jun 2023 17:25:06 +0800
> >
> > Po Lu <luangruo@yahoo.com> 于2023年6月20日周二 15:24写道:
> > >
> > > What about versions of GDB earlier than 7.7?  We should detect them, and
> > > use `set mi-async' there.
> > >
> > Like other places of gdb-mi.el,  function gdb-set-mi-async-handler()
> > will use 'set target-async' if GDB (versions earlier than 7.7) reports
> > "No symbol".
>
> Isn't that too late, though?  The GDB manual says:
>
>   On some targets, GDB is capable of processing MI commands even while the
>   target is running.  This is called "asynchronous command execution"
>   (*note Background Execution::).  The frontend may specify a preference
>   for asynchronous execution using the '-gdb-set mi-async 1' command,
>   which should be emitted before either running the executable or
>   attaching to the target.
>
> However, the gdb-input call sends the request without waiting for the
> response, so the handler of the response will be invoked much later,
> after GDB already processed quite a few commands sent to it by Emacs
> in the meantime.  Thus, by the time gdb-set-mi-async-handler is
> called, and we see the "No symbol" thingy and send the target-async
> command instead, it could be too late, because the executable was
> already run.
>
> There's actually more here than meets the eye; see bug#63084.
>
> Given all that mess, I wonder if "M-x gdb" in its current shape indeed
> supports the asynchronous execution.  If it doesn't, we may be better
> off not sending that command at all for now, until bug#63084 is fixed.

Yes, I agree. Currently gdb-mi doesn't actually support asynchronous
execution because of bug#63084. Before it is fixed, to suppress the
annoying warning, we can set gdb-non-stop-setting to nil as a
workaround.





^ permalink raw reply	[flat|nested] 33+ messages in thread

* bug#64186: Patch: Suppress deprecated '-gdb-set target-async' warning message in gdb-mi.el
  2023-06-21  6:49       ` Wang Diancheng
@ 2023-06-21 13:12         ` Eli Zaretskii
  2023-06-28  3:51           ` Wang Diancheng
  0 siblings, 1 reply; 33+ messages in thread
From: Eli Zaretskii @ 2023-06-21 13:12 UTC (permalink / raw)
  To: Wang Diancheng; +Cc: luangruo, 64186

merge 64186 63084
thanks

> From: Wang Diancheng <dianchengwang@gmail.com>
> Date: Wed, 21 Jun 2023 14:49:01 +0800
> Cc: luangruo@yahoo.com, 64186@debbugs.gnu.org
> 
> Eli Zaretskii <eliz@gnu.org> 于2023年6月20日周二 19:55写道:
> >
> > Given all that mess, I wonder if "M-x gdb" in its current shape indeed
> > supports the asynchronous execution.  If it doesn't, we may be better
> > off not sending that command at all for now, until bug#63084 is fixed.
> 
> Yes, I agree. Currently gdb-mi doesn't actually support asynchronous
> execution because of bug#63084. Before it is fixed, to suppress the
> annoying warning, we can set gdb-non-stop-setting to nil as a
> workaround.

Thanks, I've now done so on the emacs-29 branch.  I will leave this
bug open (and merge it to bug#63084), so that they could be fixed in
the future, hopefully not too distant future.





^ permalink raw reply	[flat|nested] 33+ messages in thread

* bug#64186: Patch: Suppress deprecated '-gdb-set target-async' warning message in gdb-mi.el
  2023-06-21 13:12         ` Eli Zaretskii
@ 2023-06-28  3:51           ` Wang Diancheng
  2023-06-29  6:09             ` Eli Zaretskii
  0 siblings, 1 reply; 33+ messages in thread
From: Wang Diancheng @ 2023-06-28  3:51 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: luangruo, 64186

[-- Attachment #1: Type: text/plain, Size: 1197 bytes --]

Hi,
Eli Zaretskii <eliz@gnu.org> 于2023年6月21日周三 21:12写道:
>
> merge 64186 63084
> thanks
>
> > From: Wang Diancheng <dianchengwang@gmail.com>
> > Date: Wed, 21 Jun 2023 14:49:01 +0800
> > Cc: luangruo@yahoo.com, 64186@debbugs.gnu.org
> >
> > Eli Zaretskii <eliz@gnu.org> 于2023年6月20日周二 19:55写道:
> > >
> > > Given all that mess, I wonder if "M-x gdb" in its current shape indeed
> > > supports the asynchronous execution.  If it doesn't, we may be better
> > > off not sending that command at all for now, until bug#63084 is fixed.
> >
> > Yes, I agree. Currently gdb-mi doesn't actually support asynchronous
> > execution because of bug#63084. Before it is fixed, to suppress the
> > annoying warning, we can set gdb-non-stop-setting to nil as a
> > workaround.
>
> Thanks, I've now done so on the emacs-29 branch.  I will leave this
> bug open (and merge it to bug#63084), so that they could be fixed in
> the future, hopefully not too distant future.

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.

[-- Attachment #2: gdb-mi-support-non-stop.patch --]
[-- Type: text/x-patch, Size: 4599 bytes --]

diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el
index c9afe502a50..62645a54244 100644
--- a/lisp/progmodes/gdb-mi.el
+++ b/lisp/progmodes/gdb-mi.el
@@ -237,6 +237,7 @@ gdb-handler-list
 (defvar gdb-source-file-list nil
   "List of source files for the current executable.")
 (defvar gdb-first-done-or-error t)
+(defvar gdb-target-async-checked nil)
 (defvar gdb-source-window-list nil
   "List of windows used for displaying source files.
 Sorted in most-recently-visited-first order.")
@@ -453,9 +454,7 @@ gdb-debug-log-max
           (const   :tag "Unlimited" nil))
   :version "22.1")
 
-;; This is disabled by default because we don't really support
-;; asynchronous execution of the debuggee; see bug#63084.  FIXME.
-(defcustom gdb-non-stop-setting nil
+(defcustom gdb-non-stop-setting (not (eq system-type 'windows-nt))
   "If non-nil, GDB sessions are expected to support the non-stop mode.
 When in the non-stop mode, stopped threads can be examined while
 other threads continue to execute.
@@ -470,7 +469,7 @@ gdb-non-stop-setting
 GDB session needs to be restarted for this setting to take effect."
   :type 'boolean
   :group 'gdb-non-stop
-  :version "29.1")
+  :version "30.1")
 
 (defcustom gdb-debuginfod-enable-setting
   ;; debuginfod servers are only for ELF executables, and elfutils, of
@@ -1069,6 +1068,7 @@ gdb-init-1
 	gdb-handler-list '()
 	gdb-prompt-name nil
 	gdb-first-done-or-error t
+        gdb-target-async-checked nil
 	gdb-buffer-fringe-width (car (window-fringes))
 	gdb-debug-log nil
 	gdb-source-window-list nil
@@ -1078,7 +1078,8 @@ gdb-init-1
         gdb-threads-list '()
         gdb-breakpoints-list '()
         gdb-register-names '()
-        gdb-non-stop gdb-non-stop-setting
+        gdb-supports-non-stop nil
+        gdb-non-stop nil
         gdb-debuginfod-enable gdb-debuginfod-enable-setting)
   ;;
   (gdbmi-bnf-init)
@@ -1110,7 +1111,7 @@ gdb-init-1
     (gdb-input "-gdb-set interactive-mode on" 'ignore))
   (gdb-input "-gdb-set height 0" 'ignore)
 
-  (when gdb-non-stop
+  (when gdb-non-stop-setting
     (gdb-input "-gdb-set non-stop 1" 'gdb-non-stop-handler))
 
   (gdb-input "-enable-pretty-printing" 'ignore)
@@ -1145,16 +1146,30 @@ 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)
+    ;; Try to use "mi-async" first, needs GDB 7.7 onwards.  Note if
+    ;; "mi-async" is not available, GDB is still running in "sync"
+    ;; mode, "No symbol" for "mi-async" must appear before other
+    ;; commands.
+    (gdb-input "-gdb-set mi-async 1" 'gdb-set-mi-async-handler)))
+
+(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-try-check-target-async-support()
+  (when (and gdb-non-stop-setting gdb-supports-non-stop
+             (not gdb-target-async-checked))
     (gdb-input "-list-target-features" 'gdb-check-target-async)))
 
 (defun gdb-check-target-async ()
   (goto-char (point-min))
-  (unless (re-search-forward "async" nil t)
+  (if (re-search-forward "async" nil t)
+      (setq gdb-non-stop t)
     (message
      "Target doesn't support non-stop mode.  Turning it off.")
-    (setq gdb-non-stop nil)
-    (gdb-input "-gdb-set non-stop 0" 'ignore)))
+    (gdb-input "-gdb-set non-stop 0" 'ignore))
+  (setq gdb-target-async-checked t))
 
 (defun gdb-delchar-or-quit (arg)
   "Delete ARG characters or send a quit command to GDB.
@@ -2652,6 +2667,13 @@ gdb-running
 (defun gdb-starting (_output-field _result)
   ;; CLI commands don't emit ^running at the moment so use gdb-running too.
   (setq gdb-inferior-status "running")
+
+  ;; 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))
+
   (gdb-force-mode-line-update
    (propertize gdb-inferior-status 'face font-lock-type-face))
   (setq gdb-active-process t)
@@ -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)))
 
     ;; In non-stop, we update information as soon as another thread gets

^ permalink raw reply related	[flat|nested] 33+ messages in thread

* bug#64186: Patch: Suppress deprecated '-gdb-set target-async' warning message in gdb-mi.el
  2023-06-28  3:51           ` Wang Diancheng
@ 2023-06-29  6:09             ` Eli Zaretskii
  2023-06-30  7:08               ` Wang Diancheng
  0 siblings, 1 reply; 33+ messages in thread
From: Eli Zaretskii @ 2023-06-29  6:09 UTC (permalink / raw)
  To: Wang Diancheng; +Cc: luangruo, 64186

> From: Wang Diancheng <dianchengwang@gmail.com>
> 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:

> +  ;; 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?

Finally, please don't quote symbols `like this` in comments.  Our
conventions are to quote symbols 'like this' or `like this'.





^ permalink raw reply	[flat|nested] 33+ messages in thread

* bug#64186: Patch: Suppress deprecated '-gdb-set target-async' warning message in gdb-mi.el
  2023-06-29  6:09             ` Eli Zaretskii
@ 2023-06-30  7:08               ` Wang Diancheng
  2023-07-06  7:10                 ` Eli Zaretskii
  0 siblings, 1 reply; 33+ messages in thread
From: Wang Diancheng @ 2023-06-30  7:08 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: luangruo, 64186

[-- Attachment #1: Type: text/plain, Size: 2833 bytes --]

Eli Zaretskii <eliz@gnu.org> 于2023年6月29日周四 14:08写道:
>
> > From: Wang Diancheng <dianchengwang@gmail.com>
> > 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.

[-- Attachment #2: gdb-mi-support-non-stop-v2.patch --]
[-- Type: text/x-patch, Size: 4709 bytes --]

diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el
index c9afe502a50..199be3318a1 100644
--- a/lisp/progmodes/gdb-mi.el
+++ b/lisp/progmodes/gdb-mi.el
@@ -237,6 +237,7 @@ gdb-handler-list
 (defvar gdb-source-file-list nil
   "List of source files for the current executable.")
 (defvar gdb-first-done-or-error t)
+(defvar gdb-target-async-checked nil)
 (defvar gdb-source-window-list nil
   "List of windows used for displaying source files.
 Sorted in most-recently-visited-first order.")
@@ -453,9 +454,7 @@ gdb-debug-log-max
           (const   :tag "Unlimited" nil))
   :version "22.1")
 
-;; This is disabled by default because we don't really support
-;; asynchronous execution of the debuggee; see bug#63084.  FIXME.
-(defcustom gdb-non-stop-setting nil
+(defcustom gdb-non-stop-setting (not (eq system-type 'windows-nt))
   "If non-nil, GDB sessions are expected to support the non-stop mode.
 When in the non-stop mode, stopped threads can be examined while
 other threads continue to execute.
@@ -470,7 +469,7 @@ gdb-non-stop-setting
 GDB session needs to be restarted for this setting to take effect."
   :type 'boolean
   :group 'gdb-non-stop
-  :version "29.1")
+  :version "30.1")
 
 (defcustom gdb-debuginfod-enable-setting
   ;; debuginfod servers are only for ELF executables, and elfutils, of
@@ -1069,6 +1068,7 @@ gdb-init-1
 	gdb-handler-list '()
 	gdb-prompt-name nil
 	gdb-first-done-or-error t
+	gdb-target-async-checked nil
 	gdb-buffer-fringe-width (car (window-fringes))
 	gdb-debug-log nil
 	gdb-source-window-list nil
@@ -1078,7 +1078,8 @@ gdb-init-1
         gdb-threads-list '()
         gdb-breakpoints-list '()
         gdb-register-names '()
-        gdb-non-stop gdb-non-stop-setting
+        gdb-supports-non-stop nil
+        gdb-non-stop nil
         gdb-debuginfod-enable gdb-debuginfod-enable-setting)
   ;;
   (gdbmi-bnf-init)
@@ -1110,7 +1111,7 @@ gdb-init-1
     (gdb-input "-gdb-set interactive-mode on" 'ignore))
   (gdb-input "-gdb-set height 0" 'ignore)
 
-  (when gdb-non-stop
+  (when gdb-non-stop-setting
     (gdb-input "-gdb-set non-stop 1" 'gdb-non-stop-handler))
 
   (gdb-input "-enable-pretty-printing" 'ignore)
@@ -1145,16 +1146,30 @@ 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)
+    ;; Try to use "mi-async" first, needs GDB 7.7 onwards.  Note if
+    ;; "mi-async" is not available, GDB is still running in "sync"
+    ;; mode, "No symbol" for "mi-async" must appear before other
+    ;; commands.
+    (gdb-input "-gdb-set mi-async 1" 'gdb-set-mi-async-handler)))
+
+(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-try-check-target-async-support()
+  (when (and gdb-non-stop-setting gdb-supports-non-stop
+             (not gdb-target-async-checked))
     (gdb-input "-list-target-features" 'gdb-check-target-async)))
 
 (defun gdb-check-target-async ()
   (goto-char (point-min))
-  (unless (re-search-forward "async" nil t)
+  (if (re-search-forward "async" nil t)
+      (setq gdb-non-stop t)
     (message
      "Target doesn't support non-stop mode.  Turning it off.")
-    (setq gdb-non-stop nil)
-    (gdb-input "-gdb-set non-stop 0" 'ignore)))
+    (gdb-input "-gdb-set non-stop 0" 'ignore))
+  (setq gdb-target-async-checked t))
 
 (defun gdb-delchar-or-quit (arg)
   "Delete ARG characters or send a quit command to GDB.
@@ -2652,6 +2667,14 @@ gdb-running
 (defun gdb-starting (_output-field _result)
   ;; CLI commands don't emit ^running at the moment so use gdb-running too.
   (setq gdb-inferior-status "running")
+
+  ;; Set `gdb-non-stop' when `gdb-last-command' is a CLI background
+  ;; running command e.g. "run &", attach &" or a MI command
+  ;; e.g. "-exec-run" or "-exec-attach".
+  (when (or (string-match "&\s*$" gdb-last-command)
+            (string-match "^-" gdb-last-command))
+    (gdb-try-check-target-async-support))
+
   (gdb-force-mode-line-update
    (propertize gdb-inferior-status 'face font-lock-type-face))
   (setq gdb-active-process t)
@@ -2722,6 +2745,10 @@ gdb-stopped
 
     ;; Print "(gdb)" to GUD console
     (when gdb-first-done-or-error
+      ;; If running target with a non-background CLI command
+      ;; e.g. "run" (no trailing '&'), target async feature can only
+      ;; be checked when when the program stops for the first time
+      (gdb-try-check-target-async-support)
       (setq gdb-filter-output (concat gdb-filter-output gdb-prompt-name)))
 
     ;; In non-stop, we update information as soon as another thread gets

^ permalink raw reply related	[flat|nested] 33+ messages in thread

* bug#64186: Patch: Suppress deprecated '-gdb-set target-async' warning message in gdb-mi.el
  2023-06-30  7:08               ` Wang Diancheng
@ 2023-07-06  7:10                 ` Eli Zaretskii
  2023-04-25 19:18                   ` bug#63084: 30.0.50; gud: set breakpoint while program is running tatrics
  2023-07-07  6:25                   ` bug#64186: Patch: Suppress deprecated '-gdb-set target-async' warning message in gdb-mi.el Wang Diancheng
  0 siblings, 2 replies; 33+ messages in thread
From: Eli Zaretskii @ 2023-07-06  7:10 UTC (permalink / raw)
  To: Wang Diancheng; +Cc: luangruo, 64186-done

> From: Wang Diancheng <dianchengwang@gmail.com>
> Date: Fri, 30 Jun 2023 15:08:18 +0800
> Cc: luangruo@yahoo.com, 64186@debbugs.gnu.org
> 
> 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.





^ permalink raw reply	[flat|nested] 33+ messages in thread

* bug#64186: Patch: Suppress deprecated '-gdb-set target-async' warning message in gdb-mi.el
  2023-07-06  7:10                 ` Eli Zaretskii
  2023-04-25 19:18                   ` bug#63084: 30.0.50; gud: set breakpoint while program is running tatrics
@ 2023-07-07  6:25                   ` Wang Diancheng
  2023-07-07  6:42                     ` Eli Zaretskii
  1 sibling, 1 reply; 33+ messages in thread
From: Wang Diancheng @ 2023-07-07  6:25 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: luangruo, 64186-done

Eli Zaretskii <eliz@gnu.org> 于2023年7月6日周四 15:10写道:
>
> > From: Wang Diancheng <dianchengwang@gmail.com>
> > Date: Fri, 30 Jun 2023 15:08:18 +0800
> > Cc: luangruo@yahoo.com, 64186@debbugs.gnu.org
> >
> > 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.

I'd like to start the copyright assignment paperwork, send me the form
please.  Thank you.





^ permalink raw reply	[flat|nested] 33+ messages in thread

* bug#64186: Patch: Suppress deprecated '-gdb-set target-async' warning message in gdb-mi.el
  2023-07-07  6:25                   ` bug#64186: Patch: Suppress deprecated '-gdb-set target-async' warning message in gdb-mi.el Wang Diancheng
@ 2023-07-07  6:42                     ` Eli Zaretskii
  0 siblings, 0 replies; 33+ messages in thread
From: Eli Zaretskii @ 2023-07-07  6:42 UTC (permalink / raw)
  To: Wang Diancheng; +Cc: luangruo, 64186-done

> From: Wang Diancheng <dianchengwang@gmail.com>
> Date: Fri, 7 Jul 2023 14:25:58 +0800
> Cc: luangruo@yahoo.com, 64186-done@debbugs.gnu.org
> 
> Eli Zaretskii <eliz@gnu.org> 于2023年7月6日周四 15:10写道:
> >
> > 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.
> 
> I'd like to start the copyright assignment paperwork, send me the form
> please.  Thank you.

Thanks, form sent off-list.





^ permalink raw reply	[flat|nested] 33+ messages in thread

* bug#63084: closed (Re: bug#64186: Patch: Suppress deprecated '-gdb-set target-async' warning message in gdb-mi.el)
       [not found]                     ` <handler.63084.D64186.168862741914107.notifdone@debbugs.gnu.org>
@ 2023-07-11  7:31                       ` TatriX
  2023-07-11 12:24                         ` Eli Zaretskii
  0 siblings, 1 reply; 33+ messages in thread
From: TatriX @ 2023-07-11  7:31 UTC (permalink / raw)
  To: 63084

Hi!
I've compiled latest master and still can't set breakpoints while the
program is running.
Am I missing anything in the config perhaps?





^ permalink raw reply	[flat|nested] 33+ messages in thread

* bug#63084: closed (Re: bug#64186: Patch: Suppress deprecated '-gdb-set target-async' warning message in gdb-mi.el)
  2023-07-11  7:31                       ` bug#63084: closed (Re: bug#64186: Patch: Suppress deprecated '-gdb-set target-async' warning message in gdb-mi.el) TatriX
@ 2023-07-11 12:24                         ` Eli Zaretskii
  2023-07-11 15:30                           ` TatriX
  0 siblings, 1 reply; 33+ messages in thread
From: Eli Zaretskii @ 2023-07-11 12:24 UTC (permalink / raw)
  To: TatriX; +Cc: 63084

> From: TatriX <tatrics@gmail.com>
> Date: Tue, 11 Jul 2023 09:31:18 +0200
> 
> I've compiled latest master and still can't set breakpoints while the
> program is running.
> Am I missing anything in the config perhaps?

Works for me.  What exactly did you try?  Please show the exact steps.

I did the steps shown here:

  https://debbugs.gnu.org/cgi/bugreport.cgi?bug=63084#11

and after "C-x C-a C-b", the program stopped on line 6, as expected.
Then I typed "c&", and the program printed one more line, and stopped,
again as expected.  If I remove the breakpoint with "C-x C-a C-d" and
type "c&", the program starts running without stopping again.

If those steps don't work for you, please tell which GDB version are
you using (I used GDB 12.1) and on what OS.





^ permalink raw reply	[flat|nested] 33+ messages in thread

* bug#63084: closed (Re: bug#64186: Patch: Suppress deprecated '-gdb-set target-async' warning message in gdb-mi.el)
  2023-07-11 12:24                         ` Eli Zaretskii
@ 2023-07-11 15:30                           ` TatriX
  2023-07-11 15:56                             ` Eli Zaretskii
  0 siblings, 1 reply; 33+ messages in thread
From: TatriX @ 2023-07-11 15:30 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 63084

I've used the same example with the same set of steps.

> If those steps don't work for you, please tell which GDB version are

GNU gdb (GDB) 13.1

Linux home 6.3.8-arch1-1 #1 SMP PREEMPT_DYNAMIC Wed, 14 Jun 2023
20:10:31 +0000 x86_64 GNU/Linux

GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.38,
cairo version 1.17.8) of 2023-07-06





^ permalink raw reply	[flat|nested] 33+ messages in thread

* bug#63084: closed (Re: bug#64186: Patch: Suppress deprecated '-gdb-set target-async' warning message in gdb-mi.el)
  2023-07-11 15:30                           ` TatriX
@ 2023-07-11 15:56                             ` Eli Zaretskii
  2023-07-11 17:49                               ` TatriX
  0 siblings, 1 reply; 33+ messages in thread
From: Eli Zaretskii @ 2023-07-11 15:56 UTC (permalink / raw)
  To: TatriX; +Cc: 63084

> From: TatriX <tatrics@gmail.com>
> Date: Tue, 11 Jul 2023 17:30:16 +0200
> Cc: 63084@debbugs.gnu.org
> 
> I've used the same example with the same set of steps.
> 
> > If those steps don't work for you, please tell which GDB version are
> 
> GNU gdb (GDB) 13.1
> 
> Linux home 6.3.8-arch1-1 #1 SMP PREEMPT_DYNAMIC Wed, 14 Jun 2023
> 20:10:31 +0000 x86_64 GNU/Linux
> 
> GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.38,
> cairo version 1.17.8) of 2023-07-06

So what doesn't work, and how does it not work?  Are you saying that
you see the same behavior as before the recent changes in gdb-mi.el?
Including the fact that after "run&" the value of gud-running is t?
(It should be nil.)

If you try the same steps in "emacs -Q", does it work?  What about
"emacs -Q -nw"?

Also, do you have anything in your .gdbinit files, both system-wide
and your private ones?  If you do, maybe those settings somehow get in
the way?





^ permalink raw reply	[flat|nested] 33+ messages in thread

* bug#63084: closed (Re: bug#64186: Patch: Suppress deprecated '-gdb-set target-async' warning message in gdb-mi.el)
  2023-07-11 15:56                             ` Eli Zaretskii
@ 2023-07-11 17:49                               ` TatriX
  2023-07-13  6:26                                 ` Eli Zaretskii
  0 siblings, 1 reply; 33+ messages in thread
From: TatriX @ 2023-07-11 17:49 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 63084

> So what doesn't work, and how does it not work?
Did a few more tests to see what actually happens.
I'm running the same code as before in "emacs -Q"
    > run &
    C-x C-a C-b ;; sets breakpoint successfully
    C-x C-a C-d ;; removes breakpoint
    > c &
After that program continues, but 'gud-running' is now t, even if I ">
kill" the program and "> run&" it again.





^ permalink raw reply	[flat|nested] 33+ messages in thread

* bug#63084: closed (Re: bug#64186: Patch: Suppress deprecated '-gdb-set target-async' warning message in gdb-mi.el)
  2023-07-11 17:49                               ` TatriX
@ 2023-07-13  6:26                                 ` Eli Zaretskii
  0 siblings, 0 replies; 33+ messages in thread
From: Eli Zaretskii @ 2023-07-13  6:26 UTC (permalink / raw)
  To: TatriX; +Cc: 63084

> From: TatriX <tatrics@gmail.com>
> Date: Tue, 11 Jul 2023 19:49:15 +0200
> Cc: 63084@debbugs.gnu.org
> 
> > So what doesn't work, and how does it not work?
> Did a few more tests to see what actually happens.
> I'm running the same code as before in "emacs -Q"
>     > run &
>     C-x C-a C-b ;; sets breakpoint successfully
>     C-x C-a C-d ;; removes breakpoint
>     > c &
> After that program continues, but 'gud-running' is now t, even if I ">
> kill" the program and "> run&" it again.

So it's a separate problem: some code sets gud-running even though
this is async mode.

Can you figure which function sets gud-running when you type "c&"?  My
first suspect is gdb-starting, because it sets gud-running
unconditionally instead of doing this:

  (when (not gdb-non-stop)
    (setq gud-running t))

like gdb-running does.  The other suspect is gdb-update-gud-running.





^ permalink raw reply	[flat|nested] 33+ messages in thread

end of thread, other threads:[~2023-07-13  6:26 UTC | newest]

Thread overview: 33+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-20  2:21 bug#64186: Patch: Suppress deprecated '-gdb-set target-async' warning message in gdb-mi.el Wang Diancheng
2023-06-20  7:24 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-20  9:25   ` Wang Diancheng
2023-06-20  9:43     ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-20 11:55     ` Eli Zaretskii
2023-06-21  6:49       ` Wang Diancheng
2023-06-21 13:12         ` Eli Zaretskii
2023-06-28  3:51           ` Wang Diancheng
2023-06-29  6:09             ` Eli Zaretskii
2023-06-30  7:08               ` Wang Diancheng
2023-07-06  7:10                 ` Eli Zaretskii
2023-04-25 19:18                   ` bug#63084: 30.0.50; gud: set breakpoint while program is running tatrics
2023-04-26  6:10                     ` Eli Zaretskii
2023-04-26  8:48                       ` TatriX
2023-04-26  9:44                         ` Eli Zaretskii
2023-04-26 11:19                           ` Eli Zaretskii
2023-04-26 11:49                             ` TatriX
2023-05-05  5:52                             ` Eli Zaretskii
2023-05-05  5:53                           ` Eli Zaretskii
2023-05-05  7:15                             ` TatriX
2023-05-06 11:43                               ` Eli Zaretskii
2023-05-27 21:22                                 ` TatriX
2023-05-28  5:28                                   ` Eli Zaretskii
2023-05-28 21:10                                     ` TatriX
2023-05-29 11:45                                       ` Eli Zaretskii
     [not found]                     ` <handler.63084.D64186.168862741914107.notifdone@debbugs.gnu.org>
2023-07-11  7:31                       ` bug#63084: closed (Re: bug#64186: Patch: Suppress deprecated '-gdb-set target-async' warning message in gdb-mi.el) TatriX
2023-07-11 12:24                         ` Eli Zaretskii
2023-07-11 15:30                           ` TatriX
2023-07-11 15:56                             ` Eli Zaretskii
2023-07-11 17:49                               ` TatriX
2023-07-13  6:26                                 ` Eli Zaretskii
2023-07-07  6:25                   ` bug#64186: Patch: Suppress deprecated '-gdb-set target-async' warning message in gdb-mi.el Wang Diancheng
2023-07-07  6:42                     ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).