From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id zqOyDCbau2r4OhgAWB0awg (envelope-from ) for ; Tue, 29 Sep 2026 11:32:54 -0400 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=I4tgx/yl; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 1A1521E06B; Tue, 29 Sep 2026 11:32:54 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) 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.1 Received: from vm01.sourceware.org (vm01.sourceware.org [IPv6:2620:52:6:3111::32]) (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 21EC51E01F for ; Tue, 29 Sep 2026 11:32:53 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2184A4BA2E3E for ; Tue, 29 Sep 2026 15:32:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2184A4BA2E3E Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=I4tgx/yl 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 CBAAA4BB58F9 for ; Tue, 29 Sep 2026 15:30:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CBAAA4BB58F9 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine 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 CBAAA4BB58F9 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1790695838; cv=none; b=BTy+QUc/5xSDWqovnqg5ubI9zISSFXVfGU/Ve+SnnFAD+L0ecmRBtUy7DcP7+3E/w6ZRLf6ybibIkGz/OntZvR1n7hl/QS5jVFm0D4rFP5Iw3SpRFNmuhOCjELe9MdkfchCekMZeQ+u1iNSVWp+fQUMpwIQ7xUfkU1ykTJwS6SU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1790695838; c=relaxed/simple; bh=TRP3JFqEIWksNOxWlelXuYVhtVFNSNXBLdWsnjB3dWM=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=pnLzI4d+34rGekN7W+0iR7RPtOXWQ4tK1h7xR35d3dn/oEQametXC5mANAjKHEQcLfovVMYNJb0ytdjBX3uBsuVv+xeErTCS+fUctoBqDKZFUIMbsqkKPgxQ9gtKMN/URYwZuT5VqE9uGUzOHOCjeTUbdrTA7NoSc6qE8jh3HAM= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=I4tgx/yl DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CBAAA4BB58F9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1790695838; 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=M2MQykTX1By0ftu3jG57iCgdkomDrbr2/6M0WezguaQ=; b=I4tgx/ylT4JEeA0Fjq1KyfRApdHxRWBG2MSk0gEJ/yc4X0ujd2OQlku2W/sgR/+yhOr/PO CdBy10HC8h5LXgL+fVhiInGpX4gKMJfoyKjzYNnbWKo91pkzHmDOlA0vSt1qy3LQAcIC9l wf14BuH0bRykMT/hCVCl0N95IpPV4sM= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-621-Xrce-zdeNjq1f1VUdgH5qQ-1; Tue, 29 Sep 2026 11:30:36 -0400 X-MC-Unique: Xrce-zdeNjq1f1VUdgH5qQ-1 X-Mimecast-MFC-AGG-ID: Xrce-zdeNjq1f1VUdgH5qQ_1790695835 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-49fcd86b8d3so36839205e9.3 for ; Tue, 29 Sep 2026 08:30:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790695835; x=1791300635; h=content-transfer-encoding:content-type:mime-version:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=M2MQykTX1By0ftu3jG57iCgdkomDrbr2/6M0WezguaQ=; b=fKV17T6zWZaTlbm8q8CjJLr1lF0EvQWV98sakyBzb6ACtalu0HCWX51Snu+4UUSflI Joj7JmdhJ1bcI3SwK8sFBKeAIZ1B96zFj4gIjSBN7H1NPhQFcomOI/qd8RGREYTx37Yr uoVxF6nPrT5BF+o5EjFmGuuz0qVTTZsrqX/D+i0/YlyQf2Ek3clk+eghB+WrI9gePPtF ZjMSS9c9nMSkt96h29i3FYCt4MpT84rJ2XaGegwz2v++avLlM0qy8G36/fY7hgtl8FPE EJzxi9JiVQ1Iat3h91b6OWUZb3Qm40DNlHuHFdoVWy1oTENWgPiEmXOQssuU1/GUv60f melg== X-Forwarded-Encrypted: i=1; AKwUvByheVrS4o28U5kE795Sjk6xEy2h33duMM/Swvq/8XherYskpsd5J932LbwLino4kQU3Q/BVOzTs7pz1qg==@sourceware.org X-Gm-Message-State: AFuF++kc6sPxFymWOJ6kWKICZGQ03vQhQb9ViO+BAuPu6lHh8/KFCUPV Nq1YzADuZAOYmDY9Chv9Kk7seVH4pPqN+e5GVxiQ1mlGasQuYHTQO8okmj5X13rBkNOMXgbD5LY AGyp72j5/O2G6AfLdhCgmBDtGwBQIAWtv+dKfHtWKMy+wAD4TWpMbaNcZ/ad7VUpj9tCcE2o= X-Gm-Gg: AYBFou04fyJYiVh9/OOCuV4rUU24E88R52uor8g3/8UgJU/dYzX94Yf70us4Fun5A17 q00il5oHTzECzUwGybvPBpqYspQ0xXvR8lIcIB48fSpsiEJK5o1E/t7IOp0CGKsduxlC0VZq6iM NqLXh2cFAsjzT0oF5n/sAZAkjViRKzqLnbBUUKrXC+QFpgcI7JEu5KG7rAU6ppqWNlgggEuPQvs 35mu/y8Q4nWFiBz88KLojME9x/fJjDw8d2mQL4/lzdoJDauMalrIkxW5zXsAdMjm0YzkwhMAmLV BZKeVmoRPNY3XVoX/jb5LuBrZeLmXfuwhdMbZiQI8H0dN4OUypVbBeQukXNjO797Yrqa X-Received: by 2002:a05:600c:3550:b0:49f:fd40:80fa with SMTP id 5b1f17b1804b1-49ffd408357mr159354855e9.34.1790695835224; Tue, 29 Sep 2026 08:30:35 -0700 (PDT) X-Received: by 2002:a05:600c:3550:b0:49f:fd40:80fa with SMTP id 5b1f17b1804b1-49ffd408357mr159354425e9.34.1790695834758; Tue, 29 Sep 2026 08:30:34 -0700 (PDT) Received: from localhost ([213.31.44.29]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4a00cfe16a2sm85589435e9.4.2026.09.29.08.30.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Sep 2026 08:30:34 -0700 (PDT) From: Andrew Burgess To: Alexandra =?utf-8?B?SMOhamtvdsOh?= , gdb-patches@sourceware.org Cc: ahajkova@redhat.com Subject: Re: [PATCH v13] gdb: Add source-tracking breakpoints feature In-Reply-To: <20260924145146.172604-1-ahajkova@redhat.com> References: <20260924145146.172604-1-ahajkova@redhat.com> Date: Tue, 29 Sep 2026 16:30:33 +0100 Message-ID: <87ld8kyt0m.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: bNzyHUZ66WobBhCl44FHakympn9IQsqjqUDoU8p9gzg_1790695835 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 Alexandra H=C3=A1jkov=C3=A1 writes: > When we rerun the executable after changing its source files, > GDB would re-set all previously set breakpoints. The > breakpoints set to the function names would remain at their initial > locations. But the breakpoints which used filename:line notation would > be silently shifted following the source code changes. > > To address this, GDB now optionally captures a small window of source > code lines around each breakpoint set with filename:line notation, > when it is first set. When the binary is reloaded, GDB detects the BFD > change and tries to locate the same source context in the new file, > and if successful, re-sets the breakpoint to the matched source code > line. > > The breakpoint_source structure stores captured source code lines > around a breakpoint location, along with a reference to the BFD > that was current when the source was captured. > > When source tracking is enabled (via 'set breakpoint source-tracking > enabled on'), GDB captures 3 lines of source context > (BREAKPOINT_SRC_CTX_LINES) along with the current BFD when a > breakpoint is first set. On executable reload (detected by comparing > BFDs), it searches within a 12-line window > (BREAKPOINT_SRC_CTX_LINES * BREAKPOINT_SRC_SEARCH_MULTIPLIER) for > the best match and adjusts the breakpoint location if needed. > > If source tracking is disabled after breakpoints have been tracked, > all existing source tracking information is discarded and a message > is printed. > > Tests added: > gdb.base/adjust_breakpoint.exp > gdb.base/adjust_breakpoint-missing-source.exp > gdb.base/source-tracking-inline.exp > gdb.base/test_source_tracking.exp > > adjust_breakpoint.exp covers four scenarios: > - adjust the breakpoint when lines are deleted > - adjust the breakpoint when lines are inserted > - the tracked line disappears entirely > - verify the tracking can be disabled > > adjust_breakpoint-missing-source.exp covers the edge case where source > files are unavailable, verifying GDB falls back to non-tracking breakpoin= ts. > > source-tracking-inline.exp covers source tracking with inline functions. > > test_source_tracking.exp verifies that source context is correctly captur= ed > when the breakpoint is on the last line of the file. > > Add maintenance command to print tracked source code. > Add documentation for the new source-tracking breakpoints feature. > > Limitations of the current implementation: > > Source tracking is not enabled for pending breakpoints that become > non-pending. When a breakpoint is created pending (e.g. with 'set > breakpoint pending on'), source context is not captured at creation > time since no symtab is available yet. When the breakpoint later > resolves to a location, re_set_default() only updates existing tracked > breakpoints and does not initiate tracking for newly resolved ones. > This could be fixed in the future by initiating source tracking in > re_set_default() when a breakpoint transitions from pending to > non-pending. > > Source tracking for ranged breakpoints is not currently supported. > Ranged breakpoints have a start and end location spec, and tracking > both independently raises questions about whether to preserve the > range length or track each end separately. For now, ranged > breakpoints will never be source-tracked. > > Reviewed-By: Eli Zaretskii In case you've not merged this yet, I agree with Kevin that we should get this merged and iterate from there. I think what you have is looking pretty good now. Thanks for all your work on this. Approved-By: Andrew Burgess Thanks, Andrew