[Bug breakpoints/34112] rbreak `file:regex` sets breakpoints for matches outside of `file` [reproducer attached]

cvs-commit at gcc dot gnu.org sourceware-bugzilla@sourceware.org
Tue Apr 28 13:57:37 GMT 2026


https://sourceware.org/bugzilla/show_bug.cgi?id=34112

--- Comment #5 from Sourceware Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tom de Vries <vries@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=f037ec99fa1e1e3b3dab77ce4ec7b4924e8ed1fc

commit f037ec99fa1e1e3b3dab77ce4ec7b4924e8ed1fc
Author: Tom de Vries <tdevries@suse.de>
Date:   Tue Apr 28 15:57:26 2026 +0200

    [gdb/breakpoints] Don't ignore <file> in rbreak <file>:<regexp>

    PR breakpoints/34112 reports that "rbreak <file>:<regexp>" sets breakpoints
in
    files other than <file>.

    This is a regression since commit c4c093a31f6 ("Make
    global_symbol_searcher::filenames private"), which did:
    ...
       if (file_name != nullptr)
    -    spec.filenames.push_back (file_name);
    +    spec.add_filename (std::move (file_name));
    ...

    The std::move nullifies file_name, so a subsequent file_name check:
    ...
              if (file_name != nullptr)
    ...
    now always evaluates to false.

    Fix this by:
    - introducing a variable bool file_name_p, initialized before the
      std::move, and
    - using that instead.

    Tested on x86_64-linux.

    Approved-By: Tom Tromey <tom@tromey.com>

    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=34112

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Gdb-prs mailing list