* 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.
This commit is contained in:
Chris Moller 2010-04-23 12:08:07 +00:00
parent f6973bdcb7
commit 8bd10a10b3
11 changed files with 131 additions and 4 deletions

View file

@ -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.

View file

@ -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>

View file

@ -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.

View file

@ -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{]}

View file

@ -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

View file

@ -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);

View file

@ -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.

View file

@ -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

View file

@ -0,0 +1,17 @@
#include <stdio.h>
extern int foo2();
int
foo1()
{
}
int
bar1()
{
}
main()
{
}

View file

@ -0,0 +1,6 @@
#include <stdio.h>
int
foo2()
{
}

View file

@ -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\]*.*"