From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@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 03:16:00 -0000 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> Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2014-03/txt/msg00479.txt.bz2 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