[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
4 files changed