From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21057 invoked by alias); 5 Jan 2015 19:02:08 -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 21041 invoked by uid 89); 5 Jan 2015 19:02:07 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,SPF_PASS 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; Mon, 05 Jan 2015 19:02:05 +0000 Received: from svr-orw-fem-04.mgc.mentorg.com ([147.34.97.41]) by relay1.mentorg.com with esmtp id 1Y8Cug-0003gz-FV from Don_Breazeal@mentor.com ; Mon, 05 Jan 2015 11:02:02 -0800 Received: from [172.30.2.206] (147.34.91.1) by SVR-ORW-FEM-04.mgc.mentorg.com (147.34.97.41) with Microsoft SMTP Server (TLS) id 14.3.224.2; Mon, 5 Jan 2015 11:02:01 -0800 Message-ID: <54AADFA1.9040003@codesourcery.com> Date: Mon, 05 Jan 2015 19:02:00 -0000 From: "Breazeal, Don" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-Version: 1.0 To: Pedro Alves , Yao Qi CC: Subject: Re: [PATCH 5/5] Test attaching to a program that constantly spawns short-lived threads References: <1418748834-27545-1-git-send-email-palves@redhat.com> <1418748834-27545-6-git-send-email-palves@redhat.com> <87wq5qsfaf.fsf@codesourcery.com> <54921989.4060005@redhat.com> In-Reply-To: <54921989.4060005@redhat.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2015-01/txt/msg00052.txt.bz2 On 12/17/2014 4:02 PM, Pedro Alves wrote: > diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp > index 08087f2..83fa1d0 100644 > --- a/gdb/testsuite/lib/gdb.exp > +++ b/gdb/testsuite/lib/gdb.exp > @@ -3413,12 +3413,36 @@ proc gdb_exit { } { > catch default_gdb_exit > } > > +# Return true if we can spawn a program on the target and attach to > +# it. > + > +proc can_spawn_for_attach { } { > + # We use TCL's exec to get the inferior's pid. > + if [is_remote target] then { > + return 0 > + } > + > + # The "attach" command doesn't make sense when the target is > + # stub-like, where GDB finds the program already started on > + # initial connection. > + if {[target_info exists use_gdb_stub]} { > + return 0 > + } > + > + # Assume yes. > + return 1 > +} > + This solves the problem that I was working on here: https://sourceware.org/ml/gdb-patches/2014-12/msg00520.html When I call can_spawn_for_attach in the misbehaving attach tests I was working on, they no longer spawn processes for 'target remote' that they can't attach to. Thanks! > # Start a set of programs running and then wait for a bit, to be sure > # that they can be attached to. Return a list of the processes' PIDs. > > proc spawn_wait_for_attach { executable_list } { > set pid_list {} > > + if ![can_spawn_for_attach] { > + error "can't spawn for attach with this target/board" > + } Should this be calling "error", or should it call something like "untested" or "unsupported", since it isn't expected to work in these cases? Thanks --Don