From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 5BMtOrOadWo0KBAAWB0awg (envelope-from ) for ; Fri, 07 Aug 2026 04:43:31 -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=el6m74GP; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id DAE2F1E033; Fri, 07 Aug 2026 04:43:31 -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,HTML_MESSAGE, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H2 autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.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 E4D651E033 for ; Fri, 07 Aug 2026 04:43:30 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 786E64BB58E3 for ; Fri, 7 Aug 2026 08:43:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 786E64BB58E3 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=el6m74GP Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id 1B3E24BB58B6 for ; Fri, 7 Aug 2026 08:43:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1B3E24BB58B6 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 1B3E24BB58B6 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1786092184; cv=none; b=XrExka5E1kQ+xTQ1E5E/ksuUcF1i8PWqzozj5Qw2Ihm8tVlTm0kfNjEBJqpCBVWD2HwM1bWesCOvjnXldh1gRL8sBMcycpfBtR24ugN9ZFt7xX/Sn7CqIWV0G8eOQi+rYmhk+228x3oRXLWbVmSXu7SAfTJsOs/2qxlwTUlVsUs= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1786092184; c=relaxed/simple; bh=LwprXYL4UetV52B7t06lB1L+g7R0XhDZuhUHnfkKzik=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=dwNM8E0VUk9UMgHYTynq6fXuG4G7vPVYGnnd4FeF62WKbDbVxD9KYwrjtCMIiCFQXp0h9Rxi/KQ9LwGQ+SgI51o18Fq/IZoZk9fHG18/6ZCFltC988ZXpWylz6haY4WkuxPP+b4V3o1rNtKYzfaKxzu36eNRP0ftvKrgUqaDKak= 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=el6m74GP DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1B3E24BB58B6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786092183; 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: in-reply-to:in-reply-to:references:references; bh=izishDoT8yjvPKwRyNr8dwQANX9+oxBXskyQcnDAieA=; b=el6m74GPg5zOqFtWLZzIdhLLDh4gIRDCbcDvTFMnTDI8jABUqBs93vnCSOO+cCUz0g2W8+ k0m4IiASK1wHFKX8Pfu/hmH4Rq4K7aJmqQ9q3w1WowDWIn1gK08aTw7H27iWqVnpPNnsL7 6h1pexHiseN5XS87P6OhNnxfMfpTaeA= Received: from mail-ua1-f72.google.com (mail-ua1-f72.google.com [209.85.222.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-550-paa5V14vNcKE_banJ5gBUQ-1; Fri, 07 Aug 2026 04:43:01 -0400 X-MC-Unique: paa5V14vNcKE_banJ5gBUQ-1 X-Mimecast-MFC-AGG-ID: paa5V14vNcKE_banJ5gBUQ_1786092181 Received: by mail-ua1-f72.google.com with SMTP id a1e0cc1a2514c-979f42d6f5fso270740241.3 for ; Fri, 07 Aug 2026 01:43:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786092181; x=1786696981; h=content-type:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to:content-type; bh=izishDoT8yjvPKwRyNr8dwQANX9+oxBXskyQcnDAieA=; b=VSI1iaD0EwuX4zTG99AtBQSBnHTfdtwEBbJZ+8cwgiTdBM4Cn9zj9CggUCbl1zJZRE o8/aAG5lfuITHuyp8E72PR8NQ4y+POl69GNUUSe6QXtd5GcFmvAwfCrRgy1ch2oEFMcw zL6fUtJK/v6tUAUDyyvHV6ArEw9LSitbqX3sa9rjq8Z1k9hZ9ybyO/i8RXIJyM20GcFA 2ZtQzqI+EGbVrW0Tm8HqFv9I/e/nVvznLEQnJlYZ/M1jrA82eHQB110Ht4PInih+N9Ef qOCBTnXHJnRY/uz+j4gcKDekS8GMHVpK3vqBl1CVC9wT3Gn4qEFzPlz0maRDJLCiruSF K5nw== X-Gm-Message-State: AOJu0Yz3OVvbjkMOy4V31a7f9Kw8xRhk0M6lAKedjbesfriDuVD6Npfl hHgg9P06Xzf9k9qi4Kqsd9VGl41uCCZMgYOavhdfzcPrNsYKTYwBlQkH+gt6xNVLpVAvuMCvzSP IMarsBiWz2w2ThF/it4U8pyW9oIP0VbstJZikboF1rDTZnt1oHgsARc857aYrx7epyuk/eCeuCB P0EvbLA1DuLOtoSolOuKLZ1Ee9w9Gqo5p9FlRfwzap1BhSmBnS X-Gm-Gg: AR+sD10k+bX9N5bRfAbn+BWuF9xd6u41ltyPcsB9Xqyq0iiDCJvoZlhiINLCO4KNKaG XvzTYcd5VC8Edipzs7YEBScyNwL8gdWDW3EjL2Y9C5ge7LkKqUskA06ZaCWrTYOM1FvInN+RNcU WDc9bI/AelSmke3A7esaa6e1pOtRogZ93kKRAUl7toLlNqv7DXHZPIS4k0L2E= X-Received: by 2002:a05:6102:2aca:b0:650:94b2:b209 with SMTP id ada2fe7eead31-760e72d3278mr6451206137.4.1786092180960; Fri, 07 Aug 2026 01:43:00 -0700 (PDT) X-Received: by 2002:a05:6102:2aca:b0:650:94b2:b209 with SMTP id ada2fe7eead31-760e72d3278mr6451195137.4.1786092180524; Fri, 07 Aug 2026 01:43:00 -0700 (PDT) MIME-Version: 1.0 References: <20260714094241.178097-1-ahajkova@redhat.com> <868q7dg3r3.fsf@gnu.org> In-Reply-To: <868q7dg3r3.fsf@gnu.org> From: Alexandra Petlanova Hajkova Date: Fri, 7 Aug 2026 10:42:49 +0200 X-Gm-Features: AUfX_mzT0CoFX5YeCAlOiy-oz-7HPhMM5eCWh2nc6bctOZ9vOldwNApNrKFYeG8 Message-ID: Subject: Re: [PATCH v8] gdb: Add source-tracking breakpoints feature To: Eli Zaretskii Cc: gdb-patches@sourceware.org X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: N4eM9FTwjMhyy2jwaDsTq3BqsMpTUD0XKt_PAjQwv-E_1786092181 X-Mimecast-Originator: redhat.com Content-Type: multipart/alternative; boundary="000000000000f4e97e065870fd97" 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 --000000000000f4e97e065870fd97 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Jul 14, 2026 at 2:41=E2=80=AFPM Eli Zaretskii wrote: > > From: Alexandra H=C3=A1jkov=C3=A1 > > Cc: ahajkova@redhat.com > > Date: Tue, 14 Jul 2026 11:40:52 +0200 > > > > > > gdb/NEWS | 14 + > > gdb/breakpoint.c | 487 ++++++++++++++++++ > > gdb/breakpoint.h | 16 +- > > gdb/doc/gdb.texinfo | 45 ++ > > .../gdb.base/adjust_breakpoint-2.cpp | 39 ++ > > .../gdb.base/adjust_breakpoint-3.cpp | 41 ++ > > .../gdb.base/adjust_breakpoint-4.cpp | 37 ++ > > .../adjust_breakpoint-missing-source.exp | 55 ++ > > gdb/testsuite/gdb.base/adjust_breakpoint.cpp | 40 ++ > > gdb/testsuite/gdb.base/adjust_breakpoint.exp | 168 ++++++ > > .../gdb.base/source-tracking-inline-1.c | 50 ++ > > .../gdb.base/source-tracking-inline-2.c | 49 ++ > > .../gdb.base/source-tracking-inline.exp | 80 +++ > > gdb/testsuite/gdb.base/test_source_tracking.c | 18 + > > .../gdb.base/test_source_tracking.exp | 43 ++ > > 15 files changed, 1181 insertions(+), 1 deletion(-) > > create mode 100644 gdb/testsuite/gdb.base/adjust_breakpoint-2.cpp > > create mode 100644 gdb/testsuite/gdb.base/adjust_breakpoint-3.cpp > > create mode 100644 gdb/testsuite/gdb.base/adjust_breakpoint-4.cpp > > create mode 100644 > gdb/testsuite/gdb.base/adjust_breakpoint-missing-source.exp > > create mode 100644 gdb/testsuite/gdb.base/adjust_breakpoint.cpp > > create mode 100644 gdb/testsuite/gdb.base/adjust_breakpoint.exp > > create mode 100644 gdb/testsuite/gdb.base/source-tracking-inline-1.c > > create mode 100644 gdb/testsuite/gdb.base/source-tracking-inline-2.c > > create mode 100644 gdb/testsuite/gdb.base/source-tracking-inline.exp > > create mode 100644 gdb/testsuite/gdb.base/test_source_tracking.c > > create mode 100644 gdb/testsuite/gdb.base/test_source_tracking.exp > > Thanks. > > > diff --git a/gdb/NEWS b/gdb/NEWS > > index ec9b5a33787..553d8c49ff6 100644 > > --- a/gdb/NEWS > > +++ b/gdb/NEWS > > @@ -6,6 +6,13 @@ > > * Support for the Common Trace Format (CTF) has been removed. GDB now > > saves trace information exclusively in its own "tfile" format. > > > > +* GDB now supports source-tracking breakpoints, which automatically > > + adjust their location when source code changes between rebuilds. > > + When enabled, file and line breakpoints capture the surrounding > > + source code context and use it to adjust the breakpoint line if the > > + source is modified. Source tracking can be enabled with 'set > > + breakpoint source-tracking enabled on'. > > This part is okay, but is this feature available in all builds of GDB? > For example, is the availability of the 'compile' command or being > able to rebuild the program while the GDB session is active necessary > for this to work? > > If there are preconditions, we should mention them, so users won't > expect this to work where it isn't supported. > > > +set breakpoint source-tracking enabled [on|off] > > +show breakpoint source-tracking enabled > > + Enable or disable source-tracking for file and line breakpoints. > > + When enabled, breakpoints capture surrounding source code and > > + automatically adjust their location when the source changes between > > + recompilations. > > Why aren't the maintenance commands you add called out in NEWS? > > > diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo > > index a698b2b8451..d304f885def 100644 > > --- a/gdb/doc/gdb.texinfo > > +++ b/gdb/doc/gdb.texinfo > > This part is okay. > > Reviewed-By: Eli Zaretskii > Hi Eli, This feature works in all GDB builds, it only requires that source files are accessible and the binary was compiled with debug info (line numbers). No special dependencies like `compile` are needed. The maintenance command will be added to NEWS in the next version, thanks for catching that. Thank you, Alexandra --000000000000f4e97e065870fd97 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


On Tue, Jul 14,= 2026 at 2:41=E2=80=AFPM Eli Zaretskii <= eliz@gnu.org> wrote:
> From: Alexandra H=C3=A1jkov=C3=A1 <ahajkova@redhat.com>
> Cc: ahajkova@= redhat.com
> Date: Tue, 14 Jul 2026 11:40:52 +0200
>
>
>=C2=A0 gdb/NEWS=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 |=C2=A0 14 +
>=C2=A0 gdb/breakpoint.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 | 487 ++++++++++++= ++++++
>=C2=A0 gdb/breakpoint.h=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 |=C2=A0 16 +-
>=C2=A0 gdb/doc/gdb.texinfo=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0|=C2=A0 45 ++
>=C2=A0 .../gdb.base/adjust_breakpoint-2.cpp=C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 |=C2=A0 39 ++
>=C2=A0 .../gdb.base/adjust_breakpoint-3.cpp=C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 |=C2=A0 41 ++
>=C2=A0 .../gdb.base/adjust_breakpoint-4.cpp=C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 |=C2=A0 37 ++
>=C2=A0 .../adjust_breakpoint-missing-source.exp=C2=A0 =C2=A0 =C2=A0 |= =C2=A0 55 ++
>=C2=A0 gdb/testsuite/gdb.base/adjust_breakpoint.cpp=C2=A0 |=C2=A0 40 ++=
>=C2=A0 gdb/testsuite/gdb.base/adjust_breakpoint.exp=C2=A0 | 168 ++++++<= br> >=C2=A0 .../gdb.base/source-tracking-inline-1.c=C2=A0 =C2=A0 =C2=A0 =C2= =A0|=C2=A0 50 ++
>=C2=A0 .../gdb.base/source-tracking-inline-2.c=C2=A0 =C2=A0 =C2=A0 =C2= =A0|=C2=A0 49 ++
>=C2=A0 .../gdb.base/source-tracking-inline.exp=C2=A0 =C2=A0 =C2=A0 =C2= =A0|=C2=A0 80 +++
>=C2=A0 gdb/testsuite/gdb.base/test_source_tracking.c |=C2=A0 18 +
>=C2=A0 .../gdb.base/test_source_tracking.exp=C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0|=C2=A0 43 ++
>=C2=A0 15 files changed, 1181 insertions(+), 1 deletion(-)
>=C2=A0 create mode 100644 gdb/testsuite/gdb.base/adjust_breakpoint-2.cp= p
>=C2=A0 create mode 100644 gdb/testsuite/gdb.base/adjust_breakpoint-3.cp= p
>=C2=A0 create mode 100644 gdb/testsuite/gdb.base/adjust_breakpoint-4.cp= p
>=C2=A0 create mode 100644 gdb/testsuite/gdb.base/adjust_breakpoint-miss= ing-source.exp
>=C2=A0 create mode 100644 gdb/testsuite/gdb.base/adjust_breakpoint.cpp<= br> >=C2=A0 create mode 100644 gdb/testsuite/gdb.base/adjust_breakpoint.exp<= br> >=C2=A0 create mode 100644 gdb/testsuite/gdb.base/source-tracking-inline= -1.c
>=C2=A0 create mode 100644 gdb/testsuite/gdb.base/source-tracking-inline= -2.c
>=C2=A0 create mode 100644 gdb/testsuite/gdb.base/source-tracking-inline= .exp
>=C2=A0 create mode 100644 gdb/testsuite/gdb.base/test_source_tracking.c=
>=C2=A0 create mode 100644 gdb/testsuite/gdb.base/test_source_tracking.e= xp

Thanks.

> diff --git a/gdb/NEWS b/gdb/NEWS
> index ec9b5a33787..553d8c49ff6 100644
> --- a/gdb/NEWS
> +++ b/gdb/NEWS
> @@ -6,6 +6,13 @@
>=C2=A0 * Support for the Common Trace Format (CTF) has been removed.=C2= =A0 GDB now
>=C2=A0 =C2=A0 saves trace information exclusively in its own "tfil= e" format.
>=C2=A0
> +* GDB now supports source-tracking breakpoints, which automatically > +=C2=A0 adjust their location when source code changes between rebuild= s.
> +=C2=A0 When enabled, file and line breakpoints capture the surroundin= g
> +=C2=A0 source code context and use it to adjust the breakpoint line i= f the
> +=C2=A0 source is modified.=C2=A0 Source tracking can be enabled with = 'set
> +=C2=A0 breakpoint source-tracking enabled on'.

This part is okay, but is this feature available in all builds of GDB?
For example, is the availability of the 'compile' command or being<= br> able to rebuild the program while the GDB session is active necessary
for this to work?

If there are preconditions, we should mention them, so users won't
expect this to work where it isn't supported.

> +set breakpoint source-tracking enabled [on|off]
> +show breakpoint source-tracking enabled
> +=C2=A0 Enable or disable source-tracking for file and line breakpoint= s.
> +=C2=A0 When enabled, breakpoints capture surrounding source code and<= br> > +=C2=A0 automatically adjust their location when the source changes be= tween
> +=C2=A0 recompilations.

Why aren't the maintenance commands you add called out in NEWS?

> diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
> index a698b2b8451..d304f885def 100644
> --- a/gdb/doc/gdb.texinfo
> +++ b/gdb/doc/gdb.texinfo

This part is okay.

Reviewed-By: Eli Zaretskii <eliz@gnu.org>

Hi Eli,

This feature works in all GDB builds, it only requires= that source files are accessible and the
binary was compiled with debug= info (line numbers). No special dependencies like `compile`=C2=A0
are needed.=C2=A0
=C2=A0
The maintenance c= ommand will be added to NEWS in the next version, thanks for catching that.= =C2=A0

Thank you,=C2=A0
Alexandra
<= /div>
--000000000000f4e97e065870fd97--