GDB is introducing an experimental feature called source-tracking breakpoints that automatically adjusts breakpoint line numbers when source code is edited and recompiled. When enabled with 'set breakpoint source-tracking enabled on', GDB captures a small window of surrounding source code at each breakpoint. On reload, it searches within a 12-line window to find the new location and updates the breakpoint accordingly. Limitations include requiring exact string matches (whitespace changes break it), a maximum 12-line search window, no support for pending breakpoints, ranged breakpoints, or inline functions expanding to multiple locations. The feature is not yet in a stable release but can be tested via a Fedora COPR repository or by building from source with the upstream patch applied.

4m read timeFrom fedoramagazine.org
Post cover image
Table of contents
IntroductionSetting a source-tracking breakpointLimitationsHow to try this experimental featureConclusion

Sort: