From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 608 invoked by alias); 25 Sep 2012 16:16:20 -0000 Received: (qmail 594 invoked by uid 22791); 25 Sep 2012 16:16:17 -0000 X-SWARE-Spam-Status: No, hits=-8.0 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,RP_MATCHES_RCVD,SPF_HELO_PASS 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, 25 Sep 2012 16:15:57 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q8PGFtQk016760 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 25 Sep 2012 12:15:55 -0400 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q8PGFrBE028600; Tue, 25 Sep 2012 12:15:54 -0400 Message-ID: <5061D8B8.2050209@redhat.com> Date: Tue, 25 Sep 2012 16:16:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120911 Thunderbird/15.0.1 MIME-Version: 1.0 To: Andrew Burgess CC: "gdb-patches@sourceware.org" , Sergio Durigan Junior Subject: Re: [PATCH] Failure to stop at duplicate breakpoints References: <505B31C2.5010203@broadcom.com> <505BA4D2.7070104@broadcom.com> In-Reply-To: <505BA4D2.7070104@broadcom.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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: 2012-09/txt/msg00558.txt.bz2 Hi Andrew, On 09/21/2012 12:20 AM, Andrew Burgess wrote: > 2012-09-20 Andrew Burgess > > * breakpoint.c (update_global_location_list): Ignore previous > duplicate status of a breakpoint when starting a new scan for > duplicate breakpoints. This one's okay. > --- /dev/null > +++ b/gdb/testsuite/gdb.base/duplicate-bp.c Please add the standard copyright header boilerplate. Even if the contents of the file don't have that much copyrightable content now, it's better to always add a header as a rule, than to police later changes to files and worry about having to add a header then. > @@ -0,0 +1,23 @@ > +void > +spacer () > +{ > + /* Nothing. */ > +} > + > +void > +breakpt () > +{ > + /* Nothing. */ > +} > + > +int > +main () > +{ > + spacer (); > + > + breakpt (); > + > + spacer (); > + > + return 0; > +} > diff --git a/gdb/testsuite/gdb.base/duplicate-bp.exp b/gdb/testsuite/gdb.base/duplicate-bp.exp > new file mode 100644 > index 0000000..021aa30 > --- /dev/null > +++ b/gdb/testsuite/gdb.base/duplicate-bp.exp > @@ -0,0 +1,137 @@ > +# Copyright 2012 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 . > + > +if { [prepare_for_testing duplicate-bp.exp "duplicate-bp" {duplicate-bp.c} {debug nowarnings}] } { Could you make this use standard_testfile? Like: standard_testfile if { [prepare_for_testing ${testfile}.exp ${testfile} $srcfile {debug nowarnings}] } { > + return -1 > +} > +set srcfile "duplicate-bp.c" This won't be needed then. While at it, is "nowarnings" really necessary? > + > +# Setup for the test, create COUNT breakpoints at the function BREAKPT. > +proc test_setup { count } { > + upvar srcfile srcfile It is more idiomatic in our testsuite to use "global srcfile". > + > + clean_restart duplicate-bp > + > + if ![runto_main] then { > + fail "can't run to main" > + return 0 > + } > + > + for {set i 1} {$i <= $count} {incr i} { > + gdb_breakpoint "breakpt" > + gdb_test_no_output "set \$bp_num_${i} = \$bpnum" > + } > + > + gdb_test "step" "spacer \\(\\) at .*$srcfile:\[0-9\]+.*" > + > + return 1 > +} > + > + > +# Test 1: Create two breakpoints at BREAKPT. Delete #1 and expect to stop > +# at #2. > +test_setup 2 > + > +gdb_test_no_output {delete $bp_num_1} > + > +gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, breakpt \\(\\) at .*$srcfile:\[0-9\]+.*" \ > + "delete #1, stop at #2" > + > +# Test 2: Create two breakpoints at BREAKPT. Delete #2 and expect to stop > +# at #1. > +test_setup 2 > + > +gdb_test_no_output {delete $bp_num_2} > + > +gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, breakpt \\(\\) at .*$srcfile:\[0-9\]+.*" \ > + "delete #2, stop at #1" > + > +# Test 3: Create three breakpoints at BREAKPT. Disable #1, delete #2, > +# expect to stop at #3. > +test_setup 3 > + > +gdb_test_no_output {disable $bp_num_1} > + > +gdb_test "step" ".*" > + > +gdb_test_no_output {delete $bp_num_2} > + > +gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, breakpt \\(\\) at .*$srcfile:\[0-9\]+.*" \ > + "disable #1, delete #2, stop at #3" > + > +# Test 4: Create three breakpoints at BREAKPT. Disable #2, delete #1, > +# expect to stop at #3. > +test_setup 3 > + > +gdb_test_no_output {disable $bp_num_2} > + > +gdb_test "step" ".*" > + > +gdb_test_no_output {delete $bp_num_1} > + > +gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, breakpt \\(\\) at .*$srcfile:\[0-9\]+.*" \ > + "disable #2, delete #1, stop at #3" > + > +# Test 5: Create three breakpoints at BREAKPT. Disable #1, delete #3, > +# expect to stop at #1. > +test_setup 3 > + > +gdb_test_no_output {disable $bp_num_1} > + > +gdb_test "step" ".*" > + > +gdb_test_no_output {delete $bp_num_3} > + > +gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, breakpt \\(\\) at .*$srcfile:\[0-9\]+.*" \ > + "disable #1, delete #3, stop at #1" > + > +# Test 6: Create three breakpoints at BREAKPT. Disable #3, delete #1, > +# expect to stop at #2. > +test_setup 3 > + > +gdb_test_no_output {disable $bp_num_3} > + > +gdb_test "step" ".*" > + > +gdb_test_no_output {delete $bp_num_1} > + > +gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, breakpt \\(\\) at .*$srcfile:\[0-9\]+.*" \ > + "disable #3, delete #1, stop at #2" > + > +# Test 7: Create three breakpoints at BREAKPT. Disable #2, delete #3, > +# expect to stop at #1. > +test_setup 3 > + > +gdb_test_no_output {disable $bp_num_2} > + > +gdb_test "step" ".*" > + > +gdb_test_no_output {delete $bp_num_3} > + > +gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, breakpt \\(\\) at .*$srcfile:\[0-9\]+.*" \ > + "disable #2, delete #3, stop at #1" > + > +# Test 6: Create three breakpoints at BREAKPT. Disable #3, delete #2, > +# expect to stop at #1. > +test_setup 3 > + > +gdb_test_no_output {disable $bp_num_3} > + > +gdb_test "step" ".*" > + > +gdb_test_no_output {delete $bp_num_2} > + > +gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, breakpt \\(\\) at .*$srcfile:\[0-9\]+.*" \ > + "disable #3, delete #2, stop at #1" > > There are many duplicate test output messages in the .sum file: $ cat testsuite/gdb.sum | grep PASS | sort | uniq -c | sort -n 1 PASS: gdb.base/duplicate-bp.exp: delete #1, stop at #2 1 PASS: gdb.base/duplicate-bp.exp: delete #2, stop at #1 1 PASS: gdb.base/duplicate-bp.exp: disable #1, delete #2, stop at #3 1 PASS: gdb.base/duplicate-bp.exp: disable #1, delete #3, stop at #1 1 PASS: gdb.base/duplicate-bp.exp: disable #2, delete #1, stop at #3 1 PASS: gdb.base/duplicate-bp.exp: disable #2, delete #3, stop at #1 1 PASS: gdb.base/duplicate-bp.exp: disable #3, delete #1, stop at #2 1 PASS: gdb.base/duplicate-bp.exp: disable #3, delete #2, stop at #1 2 PASS: gdb.base/duplicate-bp.exp: delete $bp_num_3 2 PASS: gdb.base/duplicate-bp.exp: disable $bp_num_1 2 PASS: gdb.base/duplicate-bp.exp: disable $bp_num_2 2 PASS: gdb.base/duplicate-bp.exp: disable $bp_num_3 3 PASS: gdb.base/duplicate-bp.exp: delete $bp_num_1 3 PASS: gdb.base/duplicate-bp.exp: delete $bp_num_2 6 PASS: gdb.base/duplicate-bp.exp: set $bp_num_3 = $bpnum 8 PASS: gdb.base/duplicate-bp.exp: set $bp_num_1 = $bpnum 8 PASS: gdb.base/duplicate-bp.exp: set $bp_num_2 = $bpnum 14 PASS: gdb.base/duplicate-bp.exp: step Could you please make them all unique? http://sourceware.org/gdb/wiki/GDBTestcaseCookbook#Make_sure_test_messages_are_unique You can use with_test_prefix to group tests, for example. Also, please get rid of the trailing whitespace the patch is adding: $ git am ~/unduplicate.mbox Applying: Failure to stop at duplicate breakpoints /home/pedro/gdb/mygit/src/.git/rebase-apply/patch:48: trailing whitespace. /home/pedro/gdb/mygit/src/.git/rebase-apply/patch:83: trailing whitespace. if ![runto_main] then { /home/pedro/gdb/mygit/src/.git/rebase-apply/patch:84: trailing whitespace. fail "can't run to main" /home/pedro/gdb/mygit/src/.git/rebase-apply/patch:94: trailing whitespace. /home/pedro/gdb/mygit/src/.git/rebase-apply/patch:110: trailing whitespace. test_setup 2 warning: 5 lines add whitespace errors. Thanks! -- Pedro Alves