From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20088 invoked by alias); 20 Apr 2010 19:21:20 -0000 Received: (qmail 20068 invoked by uid 22791); 20 Apr 2010 19:21:18 -0000 X-SWARE-Spam-Status: No, hits=-6.8 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,TW_CP,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 20 Apr 2010 19:21:12 +0000 Received: from int-mx03.intmail.prod.int.phx2.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o3KJLAhf007708 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 20 Apr 2010 15:21:10 -0400 Received: from qcore.mollernet.net (vpn-9-39.rdu.redhat.com [10.11.9.39]) by int-mx03.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o3KJL9bF000315 for ; Tue, 20 Apr 2010 15:21:10 -0400 Message-ID: <4BCDFEA5.9090501@redhat.com> Date: Tue, 20 Apr 2010 19:21:00 -0000 From: Chris Moller User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1b3pre) Gecko/20090513 Fedora/3.0-2.3.beta2.fc11 Thunderbird/3.0b2 MIME-Version: 1.0 To: gdb-patches@sourceware.org Subject: PR10179, Add support to set a breakpoint at every function in a file Content-Type: multipart/mixed; boundary="------------000708090603070500010008" X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2010-04/txt/msg00630.txt.bz2 This is a multi-part message in MIME format. --------------000708090603070500010008 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 202 Allows the argument to rbreak to specify a file to which to limit the regex search for function names. This allows, e.g., rbr file.c : .* which sets bps in every function in the specified file. --------------000708090603070500010008 Content-Type: text/x-patch; name="pr10179.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="pr10179.patch" Content-length: 5800 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\]*.*" --------------000708090603070500010008 Content-Type: text/x-patch; name="pr10179-dum.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="pr10179-dum.diff" Content-length: 1502 --- virgin.sum 2010-04-20 07:57:00.781326349 -0400 +++ patched.sum 2010-04-20 14:58:34.042326421 -0400 @@ -1,4 +1,4 @@ -Test Run By moller on Tue Apr 20 07:47:19 2010 +Test Run By moller on Tue Apr 20 13:49:38 2010 Native configuration is i686-pc-linux-gnu === gdb tests === @@ -5982,6 +5982,10 @@ PASS: gdb.base/pointers.exp: ptype pppppC PASS: gdb.base/pointers.exp: ptype ppppppC PASS: gdb.base/pointers.exp: p instance.array_variable + 0 +Running ../../../src/gdb/testsuite/gdb.base/pr10179.exp ... +PASS: gdb.base/pr10179.exp: rbreak foo.* +PASS: gdb.base/pr10179.exp: rbreak pr10179-a.c:foo.* +PASS: gdb.base/pr10179.exp: rbreak pr10179-a.c : .* Running ../../../src/gdb/testsuite/gdb.base/pr11022.exp ... PASS: gdb.base/pr11022.exp: set breakpoint PASS: gdb.base/pr11022.exp: set watchpoint @@ -16452,7 +16456,7 @@ PASS: gdb.threads/watchthreads.exp: successfully compiled posix threads test case PASS: gdb.threads/watchthreads.exp: watch args[0] PASS: gdb.threads/watchthreads.exp: watch args[1] -PASS: gdb.threads/watchthreads.exp: disable 3 +PASS: gdb.threads/watchthreads.exp: disable 2 PASS: gdb.threads/watchthreads.exp: threaded watch loop PASS: gdb.threads/watchthreads.exp: first watchpoint on args[0] hit PASS: gdb.threads/watchthreads.exp: first watchpoint on args[1] hit @@ -16733,7 +16737,7 @@ === gdb Summary === -# of expected passes 15909 +# of expected passes 15912 # of unexpected failures 19 # of expected failures 44 # of untested testcases 4 --------------000708090603070500010008--