From patchwork Wed Mar 19 04:03:02 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hui Zhu X-Patchwork-Id: 153 Return-Path: X-Original-To: siddhesh@wilcox.dreamhost.com Delivered-To: siddhesh@wilcox.dreamhost.com Received: from homiemail-mx21.g.dreamhost.com (caibbdcaaahb.dreamhost.com [208.113.200.71]) by wilcox.dreamhost.com (Postfix) with ESMTP id F306336007A for ; Tue, 18 Mar 2014 21:03:21 -0700 (PDT) Received: by homiemail-mx21.g.dreamhost.com (Postfix, from userid 14314964) id A1A031A45E4B; Tue, 18 Mar 2014 21:03:21 -0700 (PDT) X-Original-To: gdb@patchwork.siddhesh.in Delivered-To: x14314964@homiemail-mx21.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-mx21.g.dreamhost.com (Postfix) with ESMTPS id 77A50104FA9C for ; Tue, 18 Mar 2014 21:03:21 -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=BuD94fkGHl/uml2h EyVn7YfYuknAHoBcGoWksKWLhwYHCT9KBam7r5ZtSDvTH5lnHrVrTVUQd12UJ3ek 1XENZbFUcRpoq7hffZTt+yJj4Ln0L4H3g1A7Zhl6zmcknaZGTeKGM7pt1O6ZhEDd Qc2ap6x4VsN5IL8Y+MJze8008M8= 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=AtVzkGzxtmlPNcRfI7YsIu b04nc=; b=ZGPReNDqjFK+/jJgYKKD5UQOCxF32npqAOSQOIx/mu341VwGmX3UgN EoCffqvlVgNlTvt9haTUVC9OuY+xehKguoBT6zm4ZtkLMt6AfULxSkTXD5aQgQfB k5SyAlMeoumLCbnkH5EHADJhWvcGFvCUbxbcjZXTiUyq5oSCPFay0= 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-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 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 12:03:02 +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: 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> X-IsSubscribed: yes X-DH-Original-To: gdb@patchwork.siddhesh.in 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