From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31148 invoked by alias); 4 Dec 2014 16:52:04 -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 31088 invoked by uid 89); 4 Dec 2014 16:52:03 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Thu, 04 Dec 2014 16:52:02 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id sB4GpvG5021641 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 4 Dec 2014 11:51:57 -0500 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id sB4GptvC022749; Thu, 4 Dec 2014 11:51:56 -0500 Message-ID: <5480912B.5090702@redhat.com> Date: Thu, 04 Dec 2014 16:52:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: Simon Marchi , gdb-patches@sourceware.org Subject: Re: [PATCH v4] Introduce target_is_gdbserver References: <1411485577-25675-1-git-send-email-simon.marchi@ericsson.com> In-Reply-To: <1411485577-25675-1-git-send-email-simon.marchi@ericsson.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2014-12/txt/msg00100.txt.bz2 On 09/23/2014 04:19 PM, Simon Marchi wrote: > This patch introduces a function in gdbserver-support.exp to find out > whether the current target is GDBserver. > > The code was inspired from gdb.trace/qtro.exp, so it replaces the code > there by a call to the new function. > > New in v4: > - Return -1 on error, and check for -1 in qtro.exp. > - Use gdb_caching_proc to cache result. > > gdb/testsuite/ChangeLog: > > * gdb.trace/qtro.exp: Replace gdbserver detection code by... > * lib/gdbserver-support.exp (target_is_gdbserver): New > fonction. "function". Or, "procedure". > diff --git a/gdb/testsuite/lib/gdbserver-support.exp b/gdb/testsuite/lib/gdbserver-support.exp > index 026a937..e3f421e 100644 > --- a/gdb/testsuite/lib/gdbserver-support.exp > +++ b/gdb/testsuite/lib/gdbserver-support.exp I don't think gdbserver-support.exp is always loaded on all targets? By putting the procedure here, ISTM that non-GDBserver testing will ERROR when the procedure is called? > @@ -436,3 +436,28 @@ proc mi_gdbserver_start_multi { } { > > return [mi_gdb_target_cmd $gdbserver_protocol $gdbserver_gdbport] > } > + > +# Return 1 if the current remote target is an instance of gdbserver, 0 > +# otherwise. Return -1 if there was an error and we can't tell. s/gdbserver/our GDBserver/ Double space after period. > + > +gdb_caching_proc target_is_gdbserver { > + global gdb_prompt > + > + set is_gdbserver -1 > + set test "Probing for GDBserver" > + > + gdb_test_multiple "monitor help" $test { > + -re "The following monitor commands are supported.*Quit GDBserver.*$gdb_prompt $" { > + set is_gdbserver 1 Indentation doesn't look right here. Should be one tab + 4 spaces? > + } > + -re "$gdb_prompt $" { > + set is_gdbserver 0 > + } > + } > + > + if { $is_gdbserver == -1 } { > + verbose -log "Unable to tell whether we are using gdbserver or not." > + } > + > + return $is_gdbserver > +} Thanks, Pedro Alves