From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23397 invoked by alias); 6 Jun 2014 11:34:25 -0000 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 Received: (qmail 23385 invoked by uid 89); 6 Jun 2014 11:34:24 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 06 Jun 2014 11:34:23 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s56BYLnj020366 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 6 Jun 2014 07:34:21 -0400 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id s56BYJgq000902; Fri, 6 Jun 2014 07:34:20 -0400 Message-ID: <5391A73A.6000107@redhat.com> Date: Fri, 06 Jun 2014 11:34:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-Version: 1.0 To: "Breazeal, Don" , lgustavo@codesourcery.com, gdb-patches@sourceware.org Subject: Re: [PATCH] Fix for follow-fork: followed child doesn't stop References: <1401920383-10219-1-git-send-email-donb@codesourcery.com> <53906D28.5000404@codesourcery.com> <5390E4D1.2050108@codesourcery.com> In-Reply-To: <5390E4D1.2050108@codesourcery.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-SW-Source: 2014-06/txt/msg00314.txt.bz2 On 06/05/2014 10:44 PM, Breazeal, Don wrote: > +proc test_follow_fork { who detach cmd } { > global gdb_prompt > + global srcfile > + global testfile > > - gdb_test "show follow-fork" \ > - "Debugger response to a program call of fork or vfork is \"parent\".*" \ > - "default show parent follow, no catchpoints" > + set test_name "follow $who, detach $detach, command \"$cmd\"" Instead of explicitly prepending "$test_name: " to tests, please use with_test_prefix to make test messages unique. Below, runto_main, the untested line, this "set verbose", all these look like they'll print the same message in gdb.sum. > > - gdb_test "next 2" \ > - "Detaching after fork from.*" \ > - "default parent follow, no catchpoints" > + # Start a new debugger session each time so defaults are legitimate. > + clean_restart $testfile > > - # The child has been detached; allow time for any output it might > - # generate to arrive, so that output doesn't get confused with > - # any expected debugger output from a subsequent testpoint. > - # > - exec sleep 1 > -} > + if ![runto_main] { > + untested "could not run to main" > + return -1 > + } > > -proc explicit_fork_parent_follow {} { > - global gdb_prompt > + # The "Detaching..." and "Attaching..." messages may be hidden by > + # default. > + gdb_test_no_output "set verbose" > + # Set up the output we expect to see after we run. > + set expected_re "" > + if {$who == "child"} { > + set expected_re "Attaching after.* fork to.*set breakpoint here.*" > + } elseif {$who == "parent" && $detach == "on"} { > + set expected_re "Detaching after fork from .*set breakpoint here.*" Something odd with indentation here. > + } else { > + set expected_re ".*set breakpoint here.*" > + } > + # The first two tests should be sufficient to test the defaults. > + # There is no need to test using the defaults in other permutations > + # (e.g. "default" "on", "parent" "default", etc.). > + set cases [list [list "default" "default" "next 2"] \ > + [list "default" "default" "continue"] \ > + [list "parent" "on" "next 2"] \ > + [list "parent" "on" "continue"] \ > + [list "child" "on" "next 2"] \ > + [list "child" "on" "continue"] \ > + [list "parent" "off" "next 2"] \ > + [list "parent" "off" "continue"] \ > + [list "child" "off" "next 2"] \ > + [list "child" "off" "continue"]] > + foreach args $cases { > + test_follow_fork [lindex $args 0] [lindex $args 1] [lindex $args 2] > + } This is still quite manual. Please write: foreach cmd {"next 2" "continue"} { test_follow_fork "default" "default" $cmd } # Now test all explicit permutations. foreach who {"parent" "child"} { foreach detach {"on" "off"} { foreach cmd {"next 2" "continue"} { test_follow_fork $who $detach $cmd } } } -- Pedro Alves -- Pedro Alves