+2010-04-20 Chris Moller <cmoller@redhat.com>
+
+ PR 10179
+
+ * symtab.c (rbreak_command): Added code to include a filename
+ specification in the rbreak argument.
+ * NEWS: Added a brief description of filename-qualified rbreak.
+
2010-04-22 Jan Kratochvil <jan.kratochvil@redhat.com>
Fix crashes on dangling display expressions.
single `break' command creates multiple breakpoints (e.g.,
breakpoints on overloaded c++ functions).
+* The `rbreak' command now accepts a filename specification as part of
+ its argument, limiting the functions selected by the regex to those
+ in the specified file.
+
* New commands
save breakpoints <filename>
+2010-04-20 Chris Moller <cmoller@redhat.com>
+
+ * gdb.texinfo (Setting Breakpoints): Added description of
+ filename-qualified rbreak.
+ * refcard.tex (Breakpoints and Watchpoints): Added brief
+ description of filename-qualified rbreak.
+
2010-04-22 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.texinfo (Data): New @menu reference to Pretty Printing.
@kindex rbreak
@cindex regular expression
-@cindex breakpoints in functions matching a regexp
+@cindex breakpoints at functions matching a regexp
@cindex set breakpoints in many functions
@item rbreak @var{regex}
Set breakpoints on all functions matching the regular expression
(@value{GDBP}) rbreak .
@end smallexample
+@item rbreak @var{file}:@var{regex}
+If @code{rbreak} is called with a filename qualification, it limits
+the search for functions matching the given regular expression to the
+specified @var{file}. This can be used, for example, to set breakpoints on
+every function in a given file:
+
+@smallexample
+(@value{GDBP}) rbreak file.c:.
+@end smallexample
+
+The colon separating the filename qualifier from the regex may
+optionally be surrounded by spaces.
+
@kindex info breakpoints
@cindex @code{$_} and @code{info breakpoints}
@item info breakpoints @r{[}@var{n}@r{]}
cond {\it n} \opt{\it expr}&new conditional expression on breakpoint
{\it n}; make unconditional if no {\it expr}\cr
tbreak $\ldots$&temporary break; disable when reached\cr
-rbreak {\it regex}&break on all functions matching {\it regex}\cr
+rbreak \opt{\it file\tt:}{\it regex}&break on all functions matching {\it
+regex} \opt{in \it file}\cr
watch {\it expr}&set a watchpoint for expression {\it expr}\cr
catch {\it event}&break at {\it event}, which may be {\tt catch}, {\tt throw},
{\tt exec}, {\tt fork}, {\tt vfork}, {\tt load}, or {\tt unload}.\cr
struct cleanup *old_chain;
char *string = NULL;
int len = 0;
+ char **files = NULL;
+ int nfiles = 0;
- search_symbols (regexp, FUNCTIONS_DOMAIN, 0, (char **) NULL, &ss);
+ if (regexp)
+ {
+ char *colon = strchr (regexp, ':');
+ if (colon && *(colon + 1) != ':')
+ {
+ int colon_index;
+ char * file_name;
+
+ colon_index = colon - regexp;
+ file_name = alloca (colon_index + 1);
+ memcpy (file_name, regexp, colon_index);
+ file_name[colon_index--] = 0;
+ while (isspace (file_name[colon_index]))
+ file_name[colon_index--] = 0;
+ files = &file_name;
+ nfiles = 1;
+ regexp = colon + 1;
+ while (isspace (*regexp)) regexp++;
+ }
+ }
+
+ search_symbols (regexp, FUNCTIONS_DOMAIN, nfiles, files, &ss);
old_chain = make_cleanup_free_search_symbols (ss);
make_cleanup (free_current_contents, &string);
+2010-04-20 Chris Moller <cmoller@redhat.com>
+
+ PR 10179
+
+ * gdb.base/Makefile.in (EXECUTABLES): Added pr10179.
+ * gdb.base/pr10179-a.c:
+ * gdb.base/pr10179-b.c:
+ * gdb.base/pr10179.exp: New files.
+
2010-04-22 Jan Kratochvil <jan.kratochvil@redhat.com>
Fix crashes on dangling display expressions.
scope section_command setshow setvar shmain sigall signals \
solib solib_sl so-impl-ld so-indr-cl \
step-line step-test structs structs2 \
- twice-tmp varargs vforked-prog watchpoint whatis catch-syscall
+ twice-tmp varargs vforked-prog watchpoint whatis catch-syscall \
+ pr10179
MISCELLANEOUS = coremmap.data ../foobar.baz \
shr1.sl shr2.sl solib_sl.sl solib1.sl solib2.sl
--- /dev/null
+#include <stdio.h>
+
+extern int foo2();
+
+int
+foo1()
+{
+}
+
+int
+bar1()
+{
+}
+
+main()
+{
+}
--- /dev/null
+#include <stdio.h>
+
+int
+foo2()
+{
+}
--- /dev/null
+# Copyright 2010 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+set testname pr10179
+set sources "pr10179-a.c pr10179-b.c"
+
+if {[build_executable ${testname}.exp $testname $sources {debug}] == -1} {
+ return -1
+}
+
+clean_restart ${testname}
+
+if ![runto_main] {
+ untested pr10179
+ return -1
+}
+
+gdb_test "rbreak foo.*" "Breakpoint \[0-9\]+\[^\\n\]*\\nint foo\[12\]\[^\\n\]*\\nBreakpoint \[0-9\]+\[^\\n\]*\\nint foo\[12\].*"
+
+gdb_test "delete breakpoints" ".*" "" "Delete all breakpoints.*" "y"
+
+gdb_test "rbreak pr10179-a.c:foo.*" "Breakpoint \[0-9\]+\[^\\n\]*\\nint foo.*"
+
+gdb_test "delete breakpoints" ".*" "" "Delete all breakpoints.*" "y"
+
+gdb_test "rbreak pr10179-a.c : .*" "Breakpoint \[0-9\]+\[^\\n\]*\\nint bar1\[^\\n\]*\\nBreakpoint \[0-9\]+\[^\\n\]*\\nint foo1\[^\\n\]*\\nBreakpoint \[0-9\]+\[^\\n\]*\\nint main\[^\\n\]*.*"