From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id VE3FLglp52PW/i8AWB0awg (envelope-from ) for ; Sat, 11 Feb 2023 05:08:09 -0500 Received: by simark.ca (Postfix, from userid 112) id B32DA1E221; Sat, 11 Feb 2023 05:08:09 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RDNS_DYNAMIC autolearn=ham autolearn_force=no version=3.4.6 Received: from sourceware.org (ip-8-43-85-97.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 293991E0D3 for ; Sat, 11 Feb 2023 05:08:09 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 69918385B520 for ; Sat, 11 Feb 2023 10:08:08 +0000 (GMT) Received: from mail.spocom.com (mail.spocom.com [206.63.224.240]) by sourceware.org (Postfix) with ESMTP id A69903858D32 for ; Sat, 11 Feb 2023 10:07:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A69903858D32 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; Sat, 11 Feb 2023 02:07:33 -0800 Date: Sat, 11 Feb 2023 02:08:14 -0800 From: Gary Johnson To: gdb@sourceware.org Subject: [PATCH] Fix 5-line offset of edit command Message-ID: <20230211100814.GA17240@phoenix> Mail-Followup-To: gdb@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@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb" 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 {