From patchwork Thu Mar 20 03:16:25 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hui Zhu X-Patchwork-Id: 185 Return-Path: X-Original-To: siddhesh@wilcox.dreamhost.com Delivered-To: siddhesh@wilcox.dreamhost.com Received: from homiemail-mx23.g.dreamhost.com (caibbdcaabja.dreamhost.com [208.113.200.190]) by wilcox.dreamhost.com (Postfix) with ESMTP id 0B0B436018E for ; Wed, 19 Mar 2014 20:16:44 -0700 (PDT) Received: by homiemail-mx23.g.dreamhost.com (Postfix, from userid 14314964) id AAB3461CB0D9B; Wed, 19 Mar 2014 20:16:44 -0700 (PDT) X-Original-To: gdb@patchwork.siddhesh.in Delivered-To: x14314964@homiemail-mx23.g.dreamhost.com Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by homiemail-mx23.g.dreamhost.com (Postfix) with ESMTPS id 88ABC61CB0D90 for ; Wed, 19 Mar 2014 20:16:44 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:message-id:date:from:mime-version:to:cc :subject:references:in-reply-to:content-type :content-transfer-encoding; q=dns; s=default; b=lJ5Cs3Ii73NOGnsH +o/7LyIbRN5VtX1R5phEOyMbHIbzWVGqzgrn9i/ObuBXeZK5iLtJ7bTg23ST/VPD 0ig+sSPJKdQD1z+etiLAOEbhD7nAB2zT9iu/nC5/Ka3m9ma19TpTALs4uNR69N3H hBaJigjNhpSmnIJ+uTmsomb9n4Q= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:message-id:date:from:mime-version:to:cc :subject:references:in-reply-to:content-type :content-transfer-encoding; s=default; bh=JoTje99IJbb2WRmgSbd+DU 7jXgI=; b=rJlsttqkWgGFXBjQGi9PLTmw8GLxiZIY9vRTrx+dBmcZx0DF1JdQtw t1kTp/Z/+XcltIo1v2WMtoP64XrBytApIzyHn3mEbqcq5+Szy9RjWqQFIQHO0qC2 nQVZvKvruQsZj/KvMJ96VzcUWXla5gOtJzN0Drmw90BKs5F5fOWTA= Received: (qmail 24037 invoked by alias); 20 Mar 2014 03:16:42 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 24022 invoked by uid 89); 20 Mar 2014 03:16:41 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL, BAYES_00 autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 20 Mar 2014 03:16:40 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1WQTTA-0006Se-BC from Hui_Zhu@mentor.com ; Wed, 19 Mar 2014 20:16:36 -0700 Received: from SVR-ORW-FEM-03.mgc.mentorg.com ([147.34.97.39]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Wed, 19 Mar 2014 20:16:36 -0700 Received: from localhost.localdomain (147.34.91.1) by svr-orw-fem-03.mgc.mentorg.com (147.34.97.39) with Microsoft SMTP Server id 14.2.247.3; Wed, 19 Mar 2014 20:16:35 -0700 Message-ID: <532A5D89.1060108@mentor.com> Date: Thu, 20 Mar 2014 11:16:25 +0800 From: Hui Zhu User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 MIME-Version: 1.0 To: Pedro Alves CC: gdb-patches ml Subject: Re: [PATCH 1/1] Fix internal warning when "gdb -p xxx" (test) References: <53271C09.5000709@mentor.com> <53271ED2.6010707@redhat.com> <53272958.1080605@redhat.com> <5327F7D0.1050304@mentor.com> <53281C69.7090703@redhat.com> <532916F6.9000808@mentor.com> <53297165.70007@redhat.com> In-Reply-To: <53297165.70007@redhat.com> X-IsSubscribed: yes X-DH-Original-To: gdb@patchwork.siddhesh.in On 03/19/14 18:28, Pedro Alves wrote: > On 03/19/2014 04:03 AM, Hui Zhu wrote: > >> + eval "spawn $GDB $INTERNAL_GDBFLAGS $GDBFLAGS --pid=$testpid" >> + expect { >> + -re "Reading symbols from.*$gdb_prompt $" { >> + pass "starting with --pid=$testpid" > > Don't add the $testpid to the PASS/FAIL line, as it'll change between > testsuite runs, making gdb.sum diffs harder. > >> + } >> + timeout { fail "(timeout) starting with --pid=$testpid" } > > Instead of repeating the text, write: > > set test "starting with --pid" > expect { > -re "Reading symbols from.*$gdb_prompt $" { > pass "$test" > } > timeout { > fail "$test (timeout)" > } > } > > Otherwise OK. > > Thanks! > Make a new version according to your comments. Please help me review it. Thanks, Hui 2014-03-20 Hui Zhu * gdb.base/attach.exp (do_command_attach_tests): New. --- a/gdb/testsuite/gdb.base/attach.exp +++ b/gdb/testsuite/gdb.base/attach.exp @@ -384,6 +384,51 @@ proc do_call_attach_tests {} { remote_exec build "kill -9 ${testpid}" } +proc do_command_attach_tests {} { + global gdb_prompt + global binfile + global verbose + global GDB + global INTERNAL_GDBFLAGS + global GDBFLAGS + + if ![isnative] then { + unsupported "command attach test" + return 0 + } + + # Start the program running and then wait for a bit, to be sure + # that it can be attached to. + + set testpid [eval exec $binfile &] + exec sleep 2 + if { [istarget "*-*-cygwin*"] } { + # testpid is the Cygwin PID, GDB uses the Windows PID, which might be + # different due to the way fork/exec works. + set testpid [ exec ps -e | gawk "{ if (\$1 == $testpid) print \$4; }" ] + } + + gdb_exit + if $verbose>1 then { + send_user "Spawning $GDB $INTERNAL_GDBFLAGS $GDBFLAGS --pid=$testpid\n" + } + + eval "spawn $GDB $INTERNAL_GDBFLAGS $GDBFLAGS --pid=$testpid" + set test "starting with --pid" + expect { + -re "Reading symbols from.*$gdb_prompt $" { + pass "$test" + } + timeout { + fail "$test (timeout)" + } + } + + # Get rid of the process + + remote_exec build "kill -9 ${testpid}" +} + # Start with a fresh gdb @@ -404,4 +449,8 @@ gdb_start gdb_reinitialize_dir $srcdir/$subdir do_call_attach_tests +# Test "gdb --pid" + +do_command_attach_tests + return 0