Index: ChangeLog =================================================================== RCS file: /cvs/src/src/gdb/ChangeLog,v retrieving revision 1.11638 diff -u -r1.11638 ChangeLog --- ChangeLog 19 Apr 2010 17:06:08 -0000 1.11638 +++ ChangeLog 20 Apr 2010 19:14:05 -0000 @@ -1,3 +1,13 @@ +2010-04-20 Chris Moller + + PR filename-filtered rbreak/10179 + + * symtab.c (rbreak_command): Added code to detect a filename + specification in conjunction with the function specification (in + the form of "filename : regex", checking to make sure that the + colon isn't part of a qualified function name). If the filename + is discovered, it's passed to search_symbols. + 2010-04-19 Pedro Alves * ada-lang.c (print_recreate_exception) Index: symtab.c =================================================================== RCS file: /cvs/src/src/gdb/symtab.c,v retrieving revision 1.231 diff -u -r1.231 symtab.c --- symtab.c 9 Apr 2010 15:31:41 -0000 1.231 +++ symtab.c 20 Apr 2010 19:14:09 -0000 @@ -3248,8 +3248,30 @@ 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 ix; + char * ta; + + ix = colon - regexp; + ta = alloca (ix + 1); + memcpy (ta, regexp, ix); + ta[ix--] = 0; + while (isspace (ta[ix])) { ta[ix--] = 0; } + files = &ta; + 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); Index: testsuite/ChangeLog =================================================================== RCS file: /cvs/src/src/gdb/testsuite/ChangeLog,v retrieving revision 1.2237 diff -u -r1.2237 ChangeLog --- testsuite/ChangeLog 19 Apr 2010 03:13:06 -0000 1.2237 +++ testsuite/ChangeLog 20 Apr 2010 19:14:25 -0000 @@ -1,3 +1,12 @@ +2010-04-20 Chris Moller + + PR filename-filtered rbreak/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-19 Jan Kratochvil * gdb.base/solib-display.exp: Replace gdb_exit, gdb_start, Index: testsuite/gdb.base/Makefile.in =================================================================== RCS file: /cvs/src/src/gdb/testsuite/gdb.base/Makefile.in,v retrieving revision 1.5 diff -u -r1.5 Makefile.in --- testsuite/gdb.base/Makefile.in 15 Sep 2009 03:30:08 -0000 1.5 +++ testsuite/gdb.base/Makefile.in 20 Apr 2010 19:14:26 -0000 @@ -12,7 +12,8 @@ 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 Index: testsuite/gdb.base/pr10179-a.c =================================================================== RCS file: testsuite/gdb.base/pr10179-a.c diff -N testsuite/gdb.base/pr10179-a.c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ testsuite/gdb.base/pr10179-a.c 20 Apr 2010 19:14:26 -0000 @@ -0,0 +1,17 @@ +#include + +extern int foo2(); + +int +foo1() +{ +} + +int +bar1() +{ +} + +main() +{ +} Index: testsuite/gdb.base/pr10179-b.c =================================================================== RCS file: testsuite/gdb.base/pr10179-b.c diff -N testsuite/gdb.base/pr10179-b.c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ testsuite/gdb.base/pr10179-b.c 20 Apr 2010 19:14:26 -0000 @@ -0,0 +1,6 @@ +#include + +int +foo2() +{ +} Index: testsuite/gdb.base/pr10179.exp =================================================================== RCS file: testsuite/gdb.base/pr10179.exp diff -N testsuite/gdb.base/pr10179.exp --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ testsuite/gdb.base/pr10179.exp 20 Apr 2010 19:14:26 -0000 @@ -0,0 +1,38 @@ +# 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 . + +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\]*.*"