unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Ken Brown <kbrown@cornell.edu>
Cc: tatrics@gmail.com, 63084@debbugs.gnu.org
Subject: bug#63084: 30.0.50; gud: set breakpoint while program is running
Date: Wed, 26 Apr 2023 14:19:31 +0300	[thread overview]
Message-ID: <83mt2uubzw.fsf@gnu.org> (raw)
In-Reply-To: <83wn1zt1tu.fsf@gnu.org> (message from Eli Zaretskii on Wed, 26 Apr 2023 12:44:29 +0300)

> 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





  reply	other threads:[~2023-04-26 11:19 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83mt2uubzw.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=63084@debbugs.gnu.org \
    --cc=kbrown@cornell.edu \
    --cc=tatrics@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).