From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#63084: 30.0.50; gud: set breakpoint while program is running Date: Wed, 26 Apr 2023 14:19:31 +0300 Message-ID: <83mt2uubzw.fsf@gnu.org> References: <874jp3n52b.fsf@home.mail-host-address-is-not-set> <838refuqa8.fsf@gnu.org> <83wn1zt1tu.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37367"; mail-complaints-to="usenet@ciao.gmane.io" Cc: tatrics@gmail.com, 63084@debbugs.gnu.org To: Ken Brown Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Apr 26 13:20:21 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1prdC8-0009Wr-V8 for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 26 Apr 2023 13:20:20 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1prdC2-000565-CA; Wed, 26 Apr 2023 07:20:14 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1prdBs-00053L-Ec for bug-gnu-emacs@gnu.org; Wed, 26 Apr 2023 07:20:05 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1prdBr-00039v-3L for bug-gnu-emacs@gnu.org; Wed, 26 Apr 2023 07:20:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1prdBq-0005TF-Bd for bug-gnu-emacs@gnu.org; Wed, 26 Apr 2023 07:20:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 26 Apr 2023 11:20:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63084 X-GNU-PR-Package: emacs Original-Received: via spool by 63084-submit@debbugs.gnu.org id=B63084.168250798220989 (code B ref 63084); Wed, 26 Apr 2023 11:20:02 +0000 Original-Received: (at 63084) by debbugs.gnu.org; 26 Apr 2023 11:19:42 +0000 Original-Received: from localhost ([127.0.0.1]:54410 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1prdBV-0005SS-KI for submit@debbugs.gnu.org; Wed, 26 Apr 2023 07:19:41 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:33914) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1prdBQ-0005SC-R9 for 63084@debbugs.gnu.org; Wed, 26 Apr 2023 07:19:39 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1prdBL-000364-1p; Wed, 26 Apr 2023 07:19:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=RE/stvQoAp6eJNXtIvoo5jdwMxQkqILcX6F/dItOqn4=; b=pHifKfuCqxOX i6kRn85O7FxWa1k6f6bdykgwdZHZx2VHRueP7NjxQgKE48yulV8MiloB3WlgVKKntT7f5y58cqB1u jLJ7RXO6PNVZ/0bfiwU928oImBcfUDhK/KmmVBgnGpah1HhiPwx3EyriIrXYvlR7+t95+YuZ1HCSk qCi0bWc9yPtptpr4TXszhqrskaZuvigi8u9autZaqU92WrkUn8TEI0MnEP4+M/feNVlaeW1Y7KfNs fSpGbRlDlrwKgxWsBXFyRzUzd5ZnwgH1Bb8gGA8dmjnazDpDur/VuqH0pJakJrZg770joCHPJYdh1 Hq7b7oQKbjopu2DyTvVWug==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1prdAu-000658-3D; Wed, 26 Apr 2023 07:19:30 -0400 In-Reply-To: <83wn1zt1tu.fsf@gnu.org> (message from Eli Zaretskii on Wed, 26 Apr 2023 12:44:29 +0300) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:260668 Archived-At: > Cc: 63084@debbugs.gnu.org > Date: Wed, 26 Apr 2023 12:44:29 +0300 > From: Eli Zaretskii > > > From: TatriX > > 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 > > #include > > > > 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