Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Alexandra Petlanova Hajkova <ahajkova@redhat.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH v8] gdb: Add source-tracking breakpoints feature
Date: Fri, 7 Aug 2026 10:42:49 +0200	[thread overview]
Message-ID: <CAJVr-ENHVQYhOtuSMYpJ5vtKN4711KeJd0ssAQ3WY_xgJP6+YA@mail.gmail.com> (raw)
In-Reply-To: <868q7dg3r3.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 4101 bytes --]

On Tue, Jul 14, 2026 at 2:41 PM Eli Zaretskii <eliz@gnu.org> wrote:

> > From: Alexandra Hájková <ahajkova@redhat.com>
> > 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 <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`
are needed.

The maintenance command will be added to NEWS in the next version, thanks
for catching that.

Thank you,
Alexandra

[-- Attachment #2: Type: text/html, Size: 5234 bytes --]

  reply	other threads:[~2026-08-07  8:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-14  9:40 Alexandra Hájková
2026-07-14 11:23 ` Andrew Burgess
2026-07-14 12:22 ` Eli Zaretskii
2026-08-07  8:42   ` Alexandra Petlanova Hajkova [this message]
2026-08-07 11:14     ` Eli Zaretskii
2026-07-18  3:31 ` Kevin Buettner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAJVr-ENHVQYhOtuSMYpJ5vtKN4711KeJd0ssAQ3WY_xgJP6+YA@mail.gmail.com \
    --to=ahajkova@redhat.com \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox