From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 7fuhFDGu6GP0yTAAWB0awg (envelope-from ) for ; Sun, 12 Feb 2023 04:15:29 -0500 Received: by simark.ca (Postfix, from userid 112) id 42EAD1E221; Sun, 12 Feb 2023 04:15:29 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.2 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=3.4.6 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id D6FE11E0D3 for ; Sun, 12 Feb 2023 04:15:27 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C62D63858433 for ; Sun, 12 Feb 2023 09:15:26 +0000 (GMT) Received: from mail.spocom.com (mail.spocom.com [206.63.224.240]) by sourceware.org (Postfix) with ESMTP id A588F3858D32 for ; Sun, 12 Feb 2023 09:15:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A588F3858D32 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=spocom.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=spocom.com Received: from localhost (137.sub-75-213-6.myvzw.com [75.213.6.137]) by mail.spocom.com with SMTP; Sun, 12 Feb 2023 01:14:52 -0800 Date: Sun, 12 Feb 2023 01:15:34 -0800 From: Gary Johnson To: gdb-patches@sourceware.org Subject: [PATCH] Fix 5-line offset of edit command Message-ID: <20230212091534.GA27308@phoenix> Mail-Followup-To: gdb-patches@sourceware.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Operating-System: Linux 2.6.32-74-generic GNU/Linux User-Agent: Mutt/1.5.20 (2009-06-14) X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" [I originally sent this to the gdb list by mistake.] When gdb is paused at a line and I open the current file with the edit command, gdb uses vim to open the file at the current line, but the line number given to vim is always too high by 5. For example, using gdb-12.1 and the gdb-12.1 source, cd to gdb-12.1/gdb and run gdb on itself. $ gdb gdb (gdb) b main (gdb) run Gdb will stop at line 25. (gdb) edit will open vim at line 30. Executing :ps -fH confirms that vim was started with the argument "+30". The problem appears to be in the edit_command() function in cli-cmds.c, at line 966 in version 12.1. The solution is to delete that line. The patch is below. Regards, Gary -------------------------------------------------------------------- --- cli-cmds.c.orig 2022-05-01 11:46:31.000000000 -0700 +++ cli-cmds.c 2023-02-11 00:54:01.695108617 -0800 @@ -963,7 +963,6 @@ { if (sal.symtab == 0) error (_("No default source file yet.")); - sal.line += get_lines_to_list () / 2; } else {