From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id RpXACPh052M4BjAAWB0awg (envelope-from ) for ; Sat, 11 Feb 2023 05:59:04 -0500 Received: by simark.ca (Postfix, from userid 112) id 1541B1E221; Sat, 11 Feb 2023 05:59:04 -0500 (EST) Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=Lx71TUHc; dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RDNS_DYNAMIC,URIBL_BLOCKED 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 8390D1E0D3 for ; Sat, 11 Feb 2023 05:59:03 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C785A3857352 for ; Sat, 11 Feb 2023 10:59:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C785A3857352 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1676113141; bh=bD3Am5HHT6BzVsSJr9EoNI7CvcpbmbGyQEoa3Ym9PCc=; h=Date:To:Cc:In-Reply-To:Subject:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=Lx71TUHcEqavdux8Evg6IMVzXJs9TjzR0qIADRtupUS71DijlGvXobrwSM7AD5SmD 5VIr3aU0osq1FQptHPo0jaxCFZ25G2R8A/lbCX7UBXV4CS+3C1ALdoFRyzo5068VgV Xni1WwkJVNz3v2+s8l00S2DP3i8IP7ZTvzVerlwM= Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:470:142:3::10]) by sourceware.org (Postfix) with ESMTPS id B56B03858D32 for ; Sat, 11 Feb 2023 10:58:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B56B03858D32 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 1pQnaT-0001Kk-O9; Sat, 11 Feb 2023 05:58:33 -0500 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 1pQnaS-0004Oz-Uv; Sat, 11 Feb 2023 05:58:33 -0500 Date: Sat, 11 Feb 2023 12:58:03 +0200 Message-Id: <83a61kjwp0.fsf@gnu.org> To: Gary Johnson Cc: gdb@sourceware.org In-Reply-To: <20230211100814.GA17240@phoenix> (message from Gary Johnson on Sat, 11 Feb 2023 02:08:14 -0800) Subject: Re: [PATCH] Fix 5-line offset of edit command References: <20230211100814.GA17240@phoenix> 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: , From: Eli Zaretskii via Gdb Reply-To: Eli Zaretskii Errors-To: gdb-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb" > Date: Sat, 11 Feb 2023 02:08:14 -0800 > From: Gary Johnson > > 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. This is probably editor-specific? But I admit I cannot understand that addition, either. I could understand if we were _subtracting_ half the number of lines to list, for those editors which place the line at the top of the display.