Message ID | 1411485577-25675-1-git-send-email-simon.marchi@ericsson.com |
---|---|
State | Committed |
Headers |
Received: (qmail 7788 invoked by alias); 23 Sep 2014 15:19:49 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: <gdb-patches.sourceware.org> List-Unsubscribe: <mailto:gdb-patches-unsubscribe-##L=##H@sourceware.org> List-Subscribe: <mailto:gdb-patches-subscribe@sourceware.org> List-Archive: <http://sourceware.org/ml/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-help@sourceware.org>, <http://sourceware.org/ml/#faqs> Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 7775 invoked by uid 89); 23 Sep 2014 15:19:49 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: usevmg21.ericsson.net Received: from usevmg21.ericsson.net (HELO usevmg21.ericsson.net) (198.24.6.65) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Tue, 23 Sep 2014 15:19:47 +0000 Received: from EUSAAHC003.ericsson.se (Unknown_Domain [147.117.188.81]) by usevmg21.ericsson.net (Symantec Mail Security) with SMTP id 90.69.25146.FF631245; Tue, 23 Sep 2014 11:01:52 +0200 (CEST) Received: from simark-hp.mo.ca.am.ericsson.se (147.117.188.8) by smtps-am.internal.ericsson.com (147.117.188.81) with Microsoft SMTP Server (TLS) id 14.3.174.1; Tue, 23 Sep 2014 11:19:45 -0400 From: Simon Marchi <simon.marchi@ericsson.com> To: <gdb-patches@sourceware.org> CC: Simon Marchi <simon.marchi@ericsson.com> Subject: [PATCH v4] Introduce target_is_gdbserver Date: Tue, 23 Sep 2014 11:19:37 -0400 Message-ID: <1411485577-25675-1-git-send-email-simon.marchi@ericsson.com> MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes |
Commit Message
Simon Marchi
Sept. 23, 2014, 3:19 p.m. UTC
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. --- gdb/testsuite/gdb.trace/qtro.exp | 13 +------------ gdb/testsuite/lib/gdbserver-support.exp | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 12 deletions(-)
Comments
On 2014-09-23 11:19 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/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. > --- > gdb/testsuite/gdb.trace/qtro.exp | 13 +------------ > gdb/testsuite/lib/gdbserver-support.exp | 25 +++++++++++++++++++++++++ > 2 files changed, 26 insertions(+), 12 deletions(-) > > diff --git a/gdb/testsuite/gdb.trace/qtro.exp b/gdb/testsuite/gdb.trace/qtro.exp > index 22b5051..d8ffc40 100644 > --- a/gdb/testsuite/gdb.trace/qtro.exp > +++ b/gdb/testsuite/gdb.trace/qtro.exp > @@ -98,18 +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 > - } > -} > +set is_gdbserver [target_is_gdbserver] > if { $is_gdbserver == -1 } { > return -1 > } > 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 > @@ -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. > + > +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 > + } > + -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 > +} > Ping.
On 2014-10-02 01:54 PM, Simon Marchi wrote: > On 2014-09-23 11:19 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/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. >> --- >> gdb/testsuite/gdb.trace/qtro.exp | 13 +------------ >> gdb/testsuite/lib/gdbserver-support.exp | 25 +++++++++++++++++++++++++ >> 2 files changed, 26 insertions(+), 12 deletions(-) >> >> diff --git a/gdb/testsuite/gdb.trace/qtro.exp b/gdb/testsuite/gdb.trace/qtro.exp >> index 22b5051..d8ffc40 100644 >> --- a/gdb/testsuite/gdb.trace/qtro.exp >> +++ b/gdb/testsuite/gdb.trace/qtro.exp >> @@ -98,18 +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 >> - } >> -} >> +set is_gdbserver [target_is_gdbserver] >> if { $is_gdbserver == -1 } { >> return -1 >> } >> 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 >> @@ -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. >> + >> +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 >> + } >> + -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 >> +} >> > > Ping. PingĀ²
On 2014-10-20 01:49 PM, Simon Marchi wrote: > On 2014-10-02 01:54 PM, Simon Marchi wrote: >> On 2014-09-23 11:19 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/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. >>> --- >>> gdb/testsuite/gdb.trace/qtro.exp | 13 +------------ >>> gdb/testsuite/lib/gdbserver-support.exp | 25 +++++++++++++++++++++++++ >>> 2 files changed, 26 insertions(+), 12 deletions(-) >>> >>> diff --git a/gdb/testsuite/gdb.trace/qtro.exp b/gdb/testsuite/gdb.trace/qtro.exp >>> index 22b5051..d8ffc40 100644 >>> --- a/gdb/testsuite/gdb.trace/qtro.exp >>> +++ b/gdb/testsuite/gdb.trace/qtro.exp >>> @@ -98,18 +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 >>> - } >>> -} >>> +set is_gdbserver [target_is_gdbserver] >>> if { $is_gdbserver == -1 } { >>> return -1 >>> } >>> 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 >>> @@ -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. >>> + >>> +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 >>> + } >>> + -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 >>> +} >>> >> >> Ping. > > PingĀ² Ping.
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
diff --git a/gdb/testsuite/gdb.trace/qtro.exp b/gdb/testsuite/gdb.trace/qtro.exp index 22b5051..d8ffc40 100644 --- a/gdb/testsuite/gdb.trace/qtro.exp +++ b/gdb/testsuite/gdb.trace/qtro.exp @@ -98,18 +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 - } -} +set is_gdbserver [target_is_gdbserver] if { $is_gdbserver == -1 } { return -1 } 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 @@ -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. + +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 + } + -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 +}