From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20922 invoked by alias); 11 Sep 2014 16:10:27 -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 20913 invoked by uid 89); 11 Sep 2014 16:10:26 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 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, 11 Sep 2014 16:10:25 +0000 Received: from svr-orw-fem-03.mgc.mentorg.com ([147.34.97.39]) by relay1.mentorg.com with esmtp id 1XS6ww-0003bS-FY from Luis_Gustavo@mentor.com ; Thu, 11 Sep 2014 09:10:22 -0700 Received: from [172.30.11.2] (147.34.91.1) by svr-orw-fem-03.mgc.mentorg.com (147.34.97.39) with Microsoft SMTP Server id 14.3.181.6; Thu, 11 Sep 2014 09:10:21 -0700 Message-ID: <5411C969.9050107@codesourcery.com> Date: Thu, 11 Sep 2014 16:10:00 -0000 From: Luis Machado Reply-To: User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: Simon Marchi , Subject: Re: [PATCH v3] Introduce remote_target_is_gdbserver References: <1410447276-21821-1-git-send-email-simon.marchi@ericsson.com> In-Reply-To: <1410447276-21821-1-git-send-email-simon.marchi@ericsson.com> Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2014-09/txt/msg00360.txt.bz2 On 09/11/2014 11:54 AM, 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/qtor.exp, so it replaces the code > there by a call to the new function. > > New in v3: > - Remove useless "pass" in remote_target_is_gdbserver. > - Coding style in qtro.exp (braces in condition). > - Changelog entry about qtro.exp. > > gdb/testsuite/ChangeLog: > > * gdb.trace/qtro.exp: Replace gdbserver detection code by... > * lib/gdbserver-support.exp (remote_target_is_gdbserver): New > function. > --- > gdb/testsuite/gdb.trace/qtro.exp | 14 +------------- > gdb/testsuite/lib/gdbserver-support.exp | 18 ++++++++++++++++++ > 2 files changed, 19 insertions(+), 13 deletions(-) > > diff --git a/gdb/testsuite/gdb.trace/qtro.exp b/gdb/testsuite/gdb.trace/qtro.exp > index 22b5051..700c157 100644 > --- a/gdb/testsuite/gdb.trace/qtro.exp > +++ b/gdb/testsuite/gdb.trace/qtro.exp > @@ -98,19 +98,7 @@ if { $traceframe_info_supported == -1 } { > } > > # Check whether we're testing with our own GDBserver. > -set is_gdbserver -1 > -set test "probe for GDBserver" > -gdb_test_multiple "monitor help" $test { > - -re "The following monitor commands are supported.*debug-hw-points.*remote-debug.*GDBserver.*$gdb_prompt $" { > - set is_gdbserver 1 > - pass $test > - } > - -re "$gdb_prompt $" { > - set is_gdbserver 0 > - pass $test > - } > -} > -if { $is_gdbserver == -1 } { > +if { ![remote_target_is_gdbserver] } { > return -1 > } > > diff --git a/gdb/testsuite/lib/gdbserver-support.exp b/gdb/testsuite/lib/gdbserver-support.exp > index 026a937..423c729 100644 > --- a/gdb/testsuite/lib/gdbserver-support.exp > +++ b/gdb/testsuite/lib/gdbserver-support.exp > @@ -436,3 +436,21 @@ proc mi_gdbserver_start_multi { } { > > return [mi_gdb_target_cmd $gdbserver_protocol $gdbserver_gdbport] > } > + > +# Return true if the current remote target is an instance of gdbserver. > + > +proc remote_target_is_gdbserver { } { > + global gdb_prompt > + > + set is_gdbserver 0 > + 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 > + } > + -re "$gdb_prompt $" { > + } > + } > + return $is_gdbserver > +} > Just a thought but... is there a specific reason we need to check for gdbserver explicitly as opposed to checking for a remote debugging stub feature? It sounds more appropriate to leave remote stub-based testing as generic as possible, in which case "is_gdbserver" wouldn't be needed.