From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#61453: It is annoying to have to type 'print foo' before each .gdbinit command. Date: Sun, 12 Feb 2023 16:14:49 +0000 Message-ID: References: <83mt5jghej.fsf@gnu.org> <83k00ngeu8.fsf@gnu.org> <83fsbbgcra.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3584"; mail-complaints-to="usenet@ciao.gmane.io" Cc: acm@muc.de, 61453@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Feb 12 17:15:33 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 1pRF0n-0000n1-Gl for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 12 Feb 2023 17:15:33 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pRF0Y-000434-CU; Sun, 12 Feb 2023 11:15:18 -0500 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 1pRF0I-0003yq-Km for bug-gnu-emacs@gnu.org; Sun, 12 Feb 2023 11:15:02 -0500 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 1pRF0I-00016V-8Z for bug-gnu-emacs@gnu.org; Sun, 12 Feb 2023 11:15:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pRF0I-0000as-1A for bug-gnu-emacs@gnu.org; Sun, 12 Feb 2023 11:15:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 12 Feb 2023 16:15:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61453 X-GNU-PR-Package: emacs Original-Received: via spool by 61453-submit@debbugs.gnu.org id=B61453.16762184982260 (code B ref 61453); Sun, 12 Feb 2023 16:15:01 +0000 Original-Received: (at 61453) by debbugs.gnu.org; 12 Feb 2023 16:14:58 +0000 Original-Received: from localhost ([127.0.0.1]:46496 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pRF0E-0000aO-1h for submit@debbugs.gnu.org; Sun, 12 Feb 2023 11:14:58 -0500 Original-Received: from mx3.muc.de ([193.149.48.5]:29487) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pRF0C-0000a8-0f for 61453@debbugs.gnu.org; Sun, 12 Feb 2023 11:14:56 -0500 Original-Received: (qmail 56677 invoked by uid 3782); 12 Feb 2023 17:14:50 +0100 Original-Received: from acm.muc.de (pd953a525.dip0.t-ipconnect.de [217.83.165.37]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Sun, 12 Feb 2023 17:14:49 +0100 Original-Received: (qmail 10330 invoked by uid 1000); 12 Feb 2023 16:14:49 -0000 Content-Disposition: inline In-Reply-To: <83fsbbgcra.fsf@gnu.org> X-Submission-Agent: TMDA/1.3.x (Ph3nix) X-Primary-Address: acm@muc.de 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:255422 Archived-At: Hello, Eli. On Sun, Feb 12, 2023 at 16:49:13 +0200, Eli Zaretskii wrote: > > Date: Sun, 12 Feb 2023 14:42:38 +0000 > > Cc: 61453@debbugs.gnu.org, acm@muc.de > > From: Alan Mackenzie > > I've looked at the pp command, and I think it is only capable of > > displaying objects from within the Lisp environment; it won't display > > Lisp_Object's in the C environment. > Nonsense, I use it every day when debugging the C code. The GDB > command "pp" can display any Lisp object defined by a C expression. OK, thanks! I see now that pp was producing output, but like you say, on the target Emacs (in an untidy way), not on the debugging Emacs. > > > You do need to have a running Emacs for "pp", but if you attach to a > > > running Emacs, you already have that. I guess the problem is that the > > > output of "pp" goes to the same display as the one Emacs uses, ..... > > I have an Emacs running gdb, and a seperate "target" Emacs, the one being > > debugged. I'm not sure which one you mean as "... the one Emacs uses". > I mean the Emacs you debug. Thanks. > > > But does it really work? You use $arg0, but that means you cannot > > > have an arbitrary expression as an argument, and have to be very > > > cautious with blanks and other delimiters, because GDB could decide > > > that $arg0 is just part of the argument. > > Thanks, that's a good point I wasn't aware of. One way out of that would > > be to test gdb's $argc is exactly 1, and throw an error message if not. > How will this help? You will ask people to deliberately remove any > delimiters from what they type? That's a terrible annoyance. It > means, for example, that you cannot simply copy/paste code fragments. It seems that the same problem exists with pp. It transfers $arg0 to the target Emacs and ignores any further arguments. It seems the overwhelming bulk of the use of all these commands is for just a single argument. It is certainly so for the bulk of the commands I've amended. I'm not removing any facilities here, so people can continue to use print followed by, say, xpr with no arguments, when that's appropriate. Most of the time, xpr will work just fine. > > Presumably, there will be some way to quote arguments to gdb functions, > > I'll have to read the fine manual a bit more closely. I've experimented with "if $argc > 1 printf "Error message.\n", which seems to work OK. > Even if there are such quoting methods (I'm not sure), using them will > be a significant annoyance. Having to use print to print out something nobody's interested in, which takes up two lines in the gdb window, is a significant annoyance. Otherwise I wouldn't have invested several hours in trying to fix it. -- Alan Mackenzie (Nuremberg, Germany).