From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29779 invoked by alias); 19 Mar 2014 04:03:19 -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 29766 invoked by uid 89); 19 Mar 2014 04:03:19 -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; Wed, 19 Mar 2014 04:03:15 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1WQ7ii-0003JK-Al from Hui_Zhu@mentor.com ; Tue, 18 Mar 2014 21:03:12 -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); Tue, 18 Mar 2014 21:03:12 -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; Tue, 18 Mar 2014 21:03:11 -0700 Message-ID: <532916F6.9000808@mentor.com> Date: Wed, 19 Mar 2014 04:03: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: gdb-patches ml CC: Pedro Alves Subject: [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> In-Reply-To: <53281C69.7090703@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/msg00438.txt.bz2 We found that the issue can be found by regression test. So make a patch to make attach.exp can test "gdb -p xxx". Thanks, Hui 2014-03-19 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,48 @@ 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" + expect { + -re "Reading symbols from.*$gdb_prompt $" { + pass "starting with --pid=$testpid" + } + timeout { fail "(timeout) starting with --pid=$testpid" } + } + + # Get rid of the process + + remote_exec build "kill -9 ${testpid}" +} + # Start with a fresh gdb @@ -404,4 +446,8 @@ gdb_start gdb_reinitialize_dir $srcdir/$subdir do_call_attach_tests +# Test "gdb --pid" + +do_command_attach_tests + return 0