From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id NDMpHyC/LGfNuygAWB0awg (envelope-from ) for ; Thu, 07 Nov 2024 08:22:40 -0500 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=BuPbP8Du; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 5E2791E603; Thu, 7 Nov 2024 08:22:40 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-6.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.0 Received: from server2.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 ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 817C91E601 for ; Thu, 7 Nov 2024 08:22:39 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id EC8B33858C52 for ; Thu, 7 Nov 2024 13:22:38 +0000 (GMT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTP id 1391C3858D21 for ; Thu, 7 Nov 2024 13:22:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1391C3858D21 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 1391C3858D21 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1730985737; cv=none; b=aZwLf+a1fNxoZxy7+tqgUeeMoIBLz4iIdnMTVV2cvO/FCwbOg5Zgs4OYXHzfaYn/4cUMFl0/ZGII1Wixi7d3z5LP7bofhu+gT6O9YtLgklLByDS+CE3L8yr+8xIsqQX6qPdEjPg3GgHIy7Rl83uFsQvoH0vVUpdyfXE+FU5R9jI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1730985737; c=relaxed/simple; bh=SoFJEWr/aI/vPZbmd6a21smY87pBkCaBw2L5GhcTCgw=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=IekGoWbSeZvfsMFzcTvK44ZEvXWpozpEd9+F/zbCIAAH5iEY5ci8XSNUmI1it/ppQVj5NJH9GY3VaeZB9v6bkXvb9/B20eJqinBuYeiuSkZvVkaSjcNFuR8FquWrKFNEMhezqObQbk8vqeY+gF2Bs7t5v0dXuC5Oy5TlnfTYvdw= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1730985735; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7krJ9gFgTqZZaXPm0QqoCY/bdRKjW4MsqAF0wBFtkMY=; b=BuPbP8DuhnzE0n+emitpaRH0FYJWvk2URxKhxUh3PMqBXqL67pLq8UZPDVzuX5VqYLxIVG Y6/E9H1Lx+4fu54j2kJKCMExdBj8gERusyU7uybH5O6rQX5ECNLy1rHzkGRmxXKvjJNrHR WwIPIplLEJT2D4Fgh2xz2sxu2Fawysk= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-47-e7uPxlzZPJWEFc_u14PE5g-1; Thu, 07 Nov 2024 08:22:14 -0500 X-MC-Unique: e7uPxlzZPJWEFc_u14PE5g-1 X-Mimecast-MFC-AGG-ID: e7uPxlzZPJWEFc_u14PE5g Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-4315a0f25afso6594715e9.3 for ; Thu, 07 Nov 2024 05:22:14 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730985733; x=1731590533; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fW4bzDAf3EwjG/oeYyHvjcJv7pXm//VDw5q3AZB4OB0=; b=v5H4NM4ibs5f7V7KhzNYzMhz2cf/kMH9TzVnt8+eThKUxXyaI8Wzfv0C36pvYwd+xC nZoKrEo7Gf2xd4H+9vUdSN1QJPPtkmd7UTIMswI/PUDQLUkwHQ6R66XkIWUO1aC1rEgd F1H8hl/g+T0pYSJYKTgOEXb20y0gKNRbQIi1acnrQ8izOMS0TKQ1pXKqCIDxR7U2Y4e9 3iwuoYwZjZFvHj91DaYc7A7K2YTgb2EqaeobnA0217Ve8ay+6E3vZqIBDYpBcXnVf2kW isuKTk/879li+EfiBzkChOmmlr/1Or7J525mboIg5T6MUecykAdClozkjHmm9jW454qY oY4Q== X-Gm-Message-State: AOJu0YxUo6008+eB0cNarZcI94QDG+/mhh/bmTEDYpjkv/0kRmCerB6u NqkTYAtjUb++BQKu+WIoSLH49bHjoZ/6TFfSgNMAvIMAXRhh7dLCk/tHgH9WFrIh197aJgQnVUY lpCcBVdOFSOAy/OcPDxR7s2DafTwgGgkY95IbiEqMcmqL9OW6f3R3sTcq1nUbysi/N+A= X-Received: by 2002:a05:600c:5618:b0:42c:cd88:d0f4 with SMTP id 5b1f17b1804b1-431a01782c6mr383674645e9.22.1730985731609; Thu, 07 Nov 2024 05:22:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IHUVh7YOfHbI2n/S6mPnchy7sgxycWXpfMU705PHBTTUoQJYXtLGhO1yM4YTvHZbU1z0X6t/w== X-Received: by 2002:a05:600c:5618:b0:42c:cd88:d0f4 with SMTP id 5b1f17b1804b1-431a01782c6mr383673605e9.22.1730985729709; Thu, 07 Nov 2024 05:22:09 -0800 (PST) Received: from localhost (197.209.200.146.dyn.plus.net. [146.200.209.197]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-381ed97ce1bsm1720184f8f.36.2024.11.07.05.22.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Nov 2024 05:22:09 -0800 (PST) From: Andrew Burgess To: =?utf-8?Q?Llu=C3=ADs?= Batlle i Rossell Cc: gdb-patches@sourceware.org Subject: Re: Re: [PATCH] Fix 'edit' command to go to right line In-Reply-To: References: <87pln7qotz.fsf@redhat.com> Date: Thu, 07 Nov 2024 13:22:08 +0000 Message-ID: <87jzdfqiv3.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: tqX--2nH_aoyn_hHoEYx-Z3CaIA0riuZta4A3RrSZRE_1730985733 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 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 Llu=C3=ADs Batlle i Rossell writes: > On Thu, Nov 07, 2024 at 11:13:12AM +0000, Andrew Burgess wrote: >> Llu=C3=ADs Batlle i Rossell writes: >>=20 >> > I attach this patch I used more than 20 years ago. >> > >> > I thought I had sent it in these years but apparently not. >> > From fc0f3f1200f18c86a6d90185f02b1f5ce0c0235b Mon Sep 17 00:00:00 2001 >> > From: =3D?UTF-8?q?Llu=3DC3=3DADs=3D20Batlle=3D20i=3D20Rossell?=3D >> > Date: Tue, 5 Nov 2024 23:18:30 +0100 >> > Subject: [PATCH] Fix 'edit' command to go to right line >> > >> > The cursor was placed at a line off by a bunch of lines. >>=20 >> Thanks for reporting this issue. I took a look at this patch and >> started writing some tests for the 'edit' command. It would seem that >> this was mostly untested until now! >>=20 >> Anyway, though your patch does fix some cases, I found a bunch more >> problems, so I'd like to propose the patch below as an alternative. >>=20 >> I hope this should fix the case that I think you care about, though I'm >> guessing really as you didn't describe exactly which case you believe >> this fixes. If you are willing to give this alternative patch a try, >> and report if this fixes your use case or not that would be really >> helpful. >>=20 >> Thanks, >> Andrew > > (Now replying Cc to the list) > > Sure! Use your patch. > > I have EDITOR=3Dvim. And when I'm debugging in some frame, I run 'edit' t= o > get me to that position in vim. > > I don't really understand what is the get_first_line_listed () > situation... I think it means that if 'list' has been run, then the edito= r > on 'edit' will point to the line in the middle of the last 'list'. > I like this as well, if I interpret correctly. That's correct. It means I can do: (gdb) list SOME_LINE_NUMBER (gdb) edit and GDB will start editing SOME_LINE_NUMBER. I think we were already trying to do this, but we were off by 'get_lines_to_list()' in this case. I've posted a v2 which fixes some problems with the new test. I'll leave this for a while to see if anyone else wants to comment before merging. Thanks, Andrew