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#61453: It is annoying to have to type 'print foo' before each .gdbinit command. Date: Sun, 12 Feb 2023 16:04:15 +0200 Message-ID: <83k00ngeu8.fsf@gnu.org> References: <83mt5jghej.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27383"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 61453@debbugs.gnu.org To: Alan Mackenzie Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Feb 12 15:05:45 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 1pRCzA-0006tS-AU for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 12 Feb 2023 15:05:44 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pRCyu-0002cU-O2; Sun, 12 Feb 2023 09:05:28 -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 1pRCyV-0002a5-1V for bug-gnu-emacs@gnu.org; Sun, 12 Feb 2023 09:05:05 -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 1pRCyU-00028e-LL for bug-gnu-emacs@gnu.org; Sun, 12 Feb 2023 09:05:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pRCyU-0005DD-BC for bug-gnu-emacs@gnu.org; Sun, 12 Feb 2023 09:05:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 12 Feb 2023 14:05:02 +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.167621069120016 (code B ref 61453); Sun, 12 Feb 2023 14:05:02 +0000 Original-Received: (at 61453) by debbugs.gnu.org; 12 Feb 2023 14:04:51 +0000 Original-Received: from localhost ([127.0.0.1]:44402 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pRCyJ-0005Cm-6w for submit@debbugs.gnu.org; Sun, 12 Feb 2023 09:04:51 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:43488) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pRCyH-0005CZ-Ps for 61453@debbugs.gnu.org; Sun, 12 Feb 2023 09:04:50 -0500 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 1pRCyB-00027I-Vt; Sun, 12 Feb 2023 09:04:44 -0500 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=Idb1fPo6MHgLVzDHysKBDBSpuOimsHYeKkjBMAFFIHw=; b=Y4bD02dHbSXi cNhvYxLl5dwMvstATQTax3dRzljujVrF4psgexZru6oILWWzjtrul9y1Z+OO18gZTLAA5VsiR+M15 GzMdawjFvndQopL1UvMkGmD/uyWSJZ/bpgGXKOk4sSPNkfWW//Chk1aZBX+OUNCBlVMegFIfnOww8 jyiYPjtqHDxCHqATqMB2AfTBVUILxpPkyyaPHf6g5AYSJyrD+ueEgIpvfaDxNBHENe5nQcVtVtRKd D4sENDy2vijSAsQwLz9qJdryDLBmOPobU07KhBnj9ADgpwfxBvU/YSuEe0hpSapheU8zMCZpKsTcV TpvH++0J+XOYAeW5Erafow==; 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 1pRCyA-0000EI-VQ; Sun, 12 Feb 2023 09:04:43 -0500 In-Reply-To: (message from Alan Mackenzie on Sun, 12 Feb 2023 13:34:36 +0000) 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:255414 Archived-At: > Date: Sun, 12 Feb 2023 13:34:36 +0000 > Cc: 61453@debbugs.gnu.org > From: Alan Mackenzie > > > What's wrong with the existing "pp" command? I think it covers all > > your needs, and doesn't need any changes to existing xFOO commands. > > The pp comand does nothing on my setup except for scrolling the gdb > window up one line. Its help text says "Works only when an inferior > emacs is executing.". I normally start the target Emacs on a separate > Linux console, then attach it to my gdb session with the attach command. > I don't really know what "an inferior emacs" means, though I'm sure I > could find out if I read etc/DEBUG more carefully. 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, since you are running a -nw session, right? Maybe you should try "set new-console 1", or start GDB on a separate console (if that is possible with the console you are using). > So, I still think my patch would be a good idea. 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. Observe: (gdb) define foo > print $arg0 > end (gdb) foo 1 + 2 + 3 $1 = 1 But (gdb) print 1 + 2 + 3 $2 = 6 and (gdb) p Vmost_positive_fixnum - 1 $1 = 6917529027641081854 (gdb) xint $2 = 2305843009213693950 So the existing commands accept/interpret arbitrary expressions, whereas your changed commands will not necessarily do so. Which means they can silently produce incorrect results, and the user will be none the wiser.