diff options
author | Chris Moller <cmoller@cygnus> | 2010-04-23 12:08:07 +0000 |
---|---|---|
committer | Chris Moller <cmoller@cygnus> | 2010-04-23 12:08:07 +0000 |
commit | 8bd10a10b3917698e13bb1101d13c93d8c1db3a1 (patch) | |
tree | fca410c452286453fc101dc0fcd5baf810499a4a | |
parent | f6973bdcb778ca7a54817a696cb0c6457f4ae96f (diff) | |
download | gdb-8bd10a10b3917698e13bb1101d13c93d8c1db3a1.zip gdb-8bd10a10b3917698e13bb1101d13c93d8c1db3a1.tar.gz gdb-8bd10a10b3917698e13bb1101d13c93d8c1db3a1.tar.bz2 |
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.
* gdb.base/Makefile.in (EXECUTABLES): Added pr10179.
* gdb.base/pr10179-a.c:
* gdb.base/pr10179-b.c:
* gdb.base/pr10179.exp: New files.
* gdb.texinfo (Setting Breakpoints): Added description of
filename-qualified rbreak.
* refcard.tex (Breakpoints and Watchpoints): Added brief
description of filename-qualified rbreak.
-rw-r--r-- | gdb/ChangeLog | 8 | ||||
-rw-r--r-- | gdb/NEWS | 4 | ||||
-rw-r--r-- | gdb/doc/ChangeLog | 7 | ||||
-rw-r--r-- | gdb/doc/gdb.texinfo | 15 | ||||
-rw-r--r-- | gdb/doc/refcard.tex | 3 | ||||
-rw-r--r-- | gdb/symtab.c | 25 | ||||
-rw-r--r-- | gdb/testsuite/ChangeLog | 9 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/Makefile.in | 3 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/pr10179-a.c | 17 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/pr10179-b.c | 6 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/pr10179.exp | 38 |
11 files changed, 131 insertions, 4 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index e0e3353..12057a4 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,11 @@ +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. @@ -47,6 +47,10 @@ qGetTIBAddr 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> diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index 268f3a7..a96ce2f 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,10 @@ +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. diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index d53d521..5ff37a2 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -3355,7 +3355,7 @@ See also @ref{Conditions, ,Break Conditions}. @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 @@ -3385,6 +3385,19 @@ The @code{rbreak} command can be used to set breakpoints in (@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{]} diff --git a/gdb/doc/refcard.tex b/gdb/doc/refcard.tex index ff10d1b..3d6303f 100644 --- a/gdb/doc/refcard.tex +++ b/gdb/doc/refcard.tex @@ -325,7 +325,8 @@ break $\ldots$ if {\it expr}&break conditionally on nonzero {\it expr}\cr 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 diff --git a/gdb/symtab.c b/gdb/symtab.c index 28084e7..1d6b648 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -3248,8 +3248,31 @@ rbreak_command (char *regexp, int from_tty) 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); diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 025e50d..b663907 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,12 @@ +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. diff --git a/gdb/testsuite/gdb.base/Makefile.in b/gdb/testsuite/gdb.base/Makefile.in index 12db521..5e8e385 100644 --- a/gdb/testsuite/gdb.base/Makefile.in +++ b/gdb/testsuite/gdb.base/Makefile.in @@ -12,7 +12,8 @@ EXECUTABLES = all-types annota1 bitfields break \ 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 diff --git a/gdb/testsuite/gdb.base/pr10179-a.c b/gdb/testsuite/gdb.base/pr10179-a.c new file mode 100644 index 0000000..de5dcde --- /dev/null +++ b/gdb/testsuite/gdb.base/pr10179-a.c @@ -0,0 +1,17 @@ +#include <stdio.h> + +extern int foo2(); + +int +foo1() +{ +} + +int +bar1() +{ +} + +main() +{ +} diff --git a/gdb/testsuite/gdb.base/pr10179-b.c b/gdb/testsuite/gdb.base/pr10179-b.c new file mode 100644 index 0000000..dcc5d9b --- /dev/null +++ b/gdb/testsuite/gdb.base/pr10179-b.c @@ -0,0 +1,6 @@ +#include <stdio.h> + +int +foo2() +{ +} diff --git a/gdb/testsuite/gdb.base/pr10179.exp b/gdb/testsuite/gdb.base/pr10179.exp new file mode 100644 index 0000000..b8bacaf --- /dev/null +++ b/gdb/testsuite/gdb.base/pr10179.exp @@ -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 <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\]*.*" |