GNU bug report logs - #7461
23.2; gud.el always uses comint-prompt-regexp; things can break if prompt is changed

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Rolando Pereira <finalyugi@HIDDEN>; dated Sun, 21 Nov 2010 19:23:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.
Removed tag(s) moreinfo. Request was from Lars Ingebrigtsen <larsi@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
Added tag(s) moreinfo. Request was from Lars Ingebrigtsen <larsi@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 7461 <at> debbugs.gnu.org:


Received: (at 7461) by debbugs.gnu.org; 26 Aug 2021 17:48:07 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Aug 26 13:48:07 2021
Received: from localhost ([127.0.0.1]:50376 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mJJTy-0003ko-S5
	for submit <at> debbugs.gnu.org; Thu, 26 Aug 2021 13:48:07 -0400
Received: from quimby.gnus.org ([95.216.78.240]:49684)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1mJJTx-0003kG-IO
 for 7461 <at> debbugs.gnu.org; Thu, 26 Aug 2021 13:48:06 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:
 References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:
 Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
 Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=4SoWH6etJn76CorsBXljQrWanc7nZYJa+o8D1MOlwZo=; b=aCovNC7K0p16RNLNzm4fUwyhs0
 vHUWkcE6H/mzvgry3zT+7+DuaIJI6Otp3CzoZptvjFVN0lrkf8R8C9z65F3MPRlgSGEkNShG/JZ00
 DqHP22qXctcdURS4NtbSS4YdFn1PaRnuT2dzit/sx+N/Ap83ZPIHVFR4d50DUcBGsjVI=;
Received: from [84.212.220.105] (helo=elva)
 by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1mJJTm-0003dJ-OA; Thu, 26 Aug 2021 19:47:59 +0200
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: Glenn Morris <rgm@HIDDEN>
Subject: Re: bug#7461: 23.2; gud.el always uses comint-prompt-regexp; things
 can break if prompt is changed
References: <20101121174502.GA14674@rolando-laptop>
 <bwmxp06bo5.fsf@HIDDEN>
Date: Thu, 26 Aug 2021 19:47:54 +0200
In-Reply-To: <bwmxp06bo5.fsf@HIDDEN> (Glenn Morris's message of
 "Mon, 22 Nov 2010 21:01:14 -0500")
Message-ID: <8735qwxflh.fsf_-_@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview: Glenn Morris <rgm@HIDDEN> writes: >> When running gdb inside
 emacs, either by doing M-x gdb or M-x gud-gdb, >> if the prompt is set to
 something that isn't "(gdb)" (or similar, see >> the examples below), pressing
 TAB doesn't do the c [...] 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 7461
Cc: Rolando Pereira <finalyugi@HIDDEN>, 7461 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Glenn Morris <rgm@HIDDEN> writes:

>> When running gdb inside emacs, either by doing M-x gdb or M-x gud-gdb,
>> if the prompt is set to something that isn't "(gdb)" (or similar, see
>> the examples below), pressing TAB doesn't do the completion of
>> commands, functions or variables.
>
> Thank you for the complete example.
>
> It looks like, after you have changed the prompt, you can set the
> local value of comint-prompt-regexp to match it.
>
> More generally, when comint-use-prompt-regexp is nil (which it is by
> default), gud.el probably ought not to try and use comint-prompt-regexp.
> Instead it should use whatever field properties comint adds.

(I'm going through old bug reports that unfortunately weren't
resolved at the time.)

Looking at the gud code, that sounds like a good idea --- but
unfortunately comint doesn't put any specific field property on the
prompt.  Instead it seems like it marks all the data output, including
the prompt, as `output'.  Which makes sense, but doesn't help us with
distinguishing whether the line we're at is a prompt.

I think.

And I don't think we can change the fields here, because I'm guessing a
lot of stuff depends on all the output being the same field.

But comint does indeed know that it's a prompt...  so we could add
another property here -- like `comint-prompt' on the prompts, and then
use that.

Anybody have any other ideas here?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#7461; Package emacs. Full text available.
Removed tag(s) notabug. Request was from Lars Ingebrigtsen <larsi@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
Added tag(s) notabug. Request was from Chong Yidong <cyd@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 7461 <at> debbugs.gnu.org:


Received: (at 7461) by debbugs.gnu.org; 23 Nov 2010 01:56:05 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Nov 22 20:56:04 2010
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1PKi72-0002op-GX
	for submit <at> debbugs.gnu.org; Mon, 22 Nov 2010 20:56:04 -0500
Received: from fencepost.gnu.org ([140.186.70.10])
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <rgm@HIDDEN>) id 1PKi70-0002oN-2V
	for 7461 <at> debbugs.gnu.org; Mon, 22 Nov 2010 20:56:02 -0500
Received: from localhost ([127.0.0.1]:59168)
	by fencepost.gnu.org with esmtp (Exim 4.69)
	(envelope-from <rgm@HIDDEN>)
	id 1PKiC3-00031t-Aa; Mon, 22 Nov 2010 21:01:15 -0500
To: Rolando Pereira <finalyugi@HIDDEN>
Subject: Re: bug#7461: 23.2;
	Gdb only does tab completion inside Emacs when prompt is (gdb)
References: <20101121174502.GA14674@rolando-laptop>
From: Glenn Morris <rgm@HIDDEN>
X-Spook: DRM Mafia ANDVT pink noise Agfa Iran afsatcom Security
X-Ran: /|K{7wC\P"yVt\riGgZfK`hgR3\`63c+b|W/Dp-FC-CQ,``y^a\9_.cL.(G*>BVC4KtpnC
X-Hue: cyan
X-Debbugs-No-Ack: yes
X-Attribution: GM
Date: Mon, 22 Nov 2010 21:01:14 -0500
In-Reply-To: <20101121174502.GA14674@rolando-laptop> (Rolando Pereira's
	message of "Sun\, 21 Nov 2010 17\:45\:14 +0000")
Message-ID: <bwmxp06bo5.fsf@HIDDEN>
User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Spam-Score: -6.2 (------)
X-Debbugs-Envelope-To: 7461
Cc: 7461 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/pipermail/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -6.2 (------)

Rolando Pereira wrote:

> When running gdb inside emacs, either by doing M-x gdb or M-x gud-gdb,
> if the prompt is set to something that isn't "(gdb)" (or similar, see
> the examples below), pressing TAB doesn't do the completion of
> commands, functions or variables.

Thank you for the complete example.

It looks like, after you have changed the prompt, you can set the
local value of comint-prompt-regexp to match it.

More generally, when comint-use-prompt-regexp is nil (which it is by
default), gud.el probably ought not to try and use comint-prompt-regexp.
Instead it should use whatever field properties comint adds.

> Emacs version is: GNU Emacs 23.2.1 (i686-pc-linux-gnu, GTK+ Version
> 2.16.1)
>
> GDB version is: GNU gdb (GDB) 7.2




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs@HIDDEN:
bug#7461; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 21 Nov 2010 19:22:12 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Nov 21 14:22:12 2010
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1PKFUJ-0003hL-Bk
	for submit <at> debbugs.gnu.org; Sun, 21 Nov 2010 14:22:12 -0500
Received: from eggs.gnu.org ([140.186.70.92])
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <finalyugi@HIDDEN>) id 1PKDth-0002JV-DK
	for submit <at> debbugs.gnu.org; Sun, 21 Nov 2010 12:40:18 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <finalyugi@HIDDEN>) id 1PKDyj-0004Wi-V4
	for submit <at> debbugs.gnu.org; Sun, 21 Nov 2010 12:45:30 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,
	T_TO_NO_BRKTS_FREEMAIL autolearn=unavailable version=3.3.1
Received: from lists.gnu.org ([199.232.76.165]:53033)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <finalyugi@HIDDEN>) id 1PKDyj-0004We-N5
	for submit <at> debbugs.gnu.org; Sun, 21 Nov 2010 12:45:29 -0500
Received: from [140.186.70.92] (port=38823 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1PKDyh-0003Ko-K5
	for bug-gnu-emacs@HIDDEN; Sun, 21 Nov 2010 12:45:28 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <finalyugi@HIDDEN>) id 1PKDyf-0004WE-Ro
	for bug-gnu-emacs@HIDDEN; Sun, 21 Nov 2010 12:45:26 -0500
Received: from smtp.fe.up.pt ([193.136.28.30]:31816)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <finalyugi@HIDDEN>) id 1PKDyf-0004Vw-JE
	for bug-gnu-emacs@HIDDEN; Sun, 21 Nov 2010 12:45:25 -0500
Received: from localhost (localhost [127.0.0.1])
	by smtp.fe.up.pt (Postfix) with ESMTP id A3D4013F75C
	for <bug-gnu-emacs@HIDDEN>; Sun, 21 Nov 2010 17:45:24 +0000 (WET)
Received: from smtp.fe.up.pt ([127.0.0.1])
	by localhost (smtp2.fe.up.pt [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id HXn5qIiQbERZ for <bug-gnu-emacs@HIDDEN>;
	Sun, 21 Nov 2010 17:45:24 +0000 (WET)
Received: from rolando-laptop (unknown [192.168.56.20])
	by smtp.fe.up.pt (Postfix) with ESMTPA id BCC8713F714
	for <bug-gnu-emacs@HIDDEN>; Sun, 21 Nov 2010 17:45:22 +0000 (WET)
Date: Sun, 21 Nov 2010 17:45:14 +0000
From: Rolando Pereira <finalyugi@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 23.2; Gdb only does tab completion inside Emacs when prompt is (gdb)
Message-ID: <20101121174502.GA14674@rolando-laptop>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.5.18 (2008-05-17)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Spam-Score: -5.9 (-----)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Sun, 21 Nov 2010 14:22:08 -0500
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/pipermail/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -5.9 (-----)

When running gdb inside emacs, either by doing M-x gdb or M-x gud-gdb,
if the prompt is set to something that isn't "(gdb)" (or similar, see
the examples below), pressing TAB doesn't do the completion of
commands, functions or variables.

Use the following steps to reproduce the error using emacs -Q:

1) Create a new C file, for example code.c, with the following
contents:

#include <stdio.h>

int main(void) {
	printf("Hello World\n");
	return 0;
}

2) Compile code using gcc -g code.c -o code

3) Open emacs -Q

4) Start debugging the file using M-x gdb

5) Prompt should be "(gdb) ". Try to type "b ma" and press TAB. It
should expand to "b main".

6) Change gdb's prompt to something else using "set prompt". I changed
it to "gdb> ".

7) Try to type "b ma" and press TAB. It should display on the
minibuffer the message "No completions of ma".


Prompts I've tried where TAB completion still worked:

* "(gdb)"
* "        (gdb)        " (the prefix whitespace is discarded by gdb,
  so this is the same as "(gdb)        ")
* "( gdb) "
* "(gdb)_______________________"
* "(GDB) "
* "( GDB) "

Prompts I've tried where TAB completion DIDN'T work:

* "(gdb )"
* "_(gdb)"
* "(gdb "
* "gdb) "
* "( gdb )"
* "" (removed prompt by typing "set prompt" in gdb)
* "gdb> "
* "gdb>"
* "gdb "
* "gdb"
* "<gdb "
* "<gdb"

Emacs version is: GNU Emacs 23.2.1 (i686-pc-linux-gnu, GTK+ Version
2.16.1)

GDB version is: GNU gdb (GDB) 7.2




Acknowledgement sent to Rolando Pereira <finalyugi@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs@HIDDEN:
bug#7461; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sat, 25 Sep 2021 02:45:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.