This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH v2] Introduce remote_target_is_gdbserver
- From: Pedro Alves <palves at redhat dot com>
- To: Simon Marchi <simon dot marchi at ericsson dot com>, Sergio Durigan Junior <sergiodj at redhat dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Thu, 11 Sep 2014 17:46:17 +0100
- Subject: Re: [PATCH v2] Introduce remote_target_is_gdbserver
- Authentication-results: sourceware.org; auth=none
- References: <1409948495-13599-1-git-send-email-simon dot marchi at ericsson dot com> <87k35h3asl dot fsf at redhat dot com> <5411B618 dot 5060800 at ericsson dot com>
On 09/11/2014 03:47 PM, Simon Marchi wrote:
> On 14-09-05 07:30 PM, Sergio Durigan Junior wrote:
>>> # 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
>>> - }
>>> -}
>>> +# 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 $" {
>>> + pass $test
>>> + set is_gdbserver 1
>>> + }
>>> + -re "$gdb_prompt $" {
>>> + pass $test
>>> + }
>>> + default {
>>> + pass $test
>>> + }
>>
>> Do we really need these "pass"? I'd rather we don't put it, and by
>> looking at lib/gdb.exp I see many tests also don't use it.
>
> I thought so, but apparently no. I thought that each gdb_test_multiple had to be matched with one pass or fail.
FWIW, yeah, that was the original rationale behind the "pass"es
in the original code. The test was written in the form of
"Probing for GDBserver", and the idea is that if we find that we're
not running GDBserver but something else, the _probing_ itself was
still a success.
Thanks,
Pedro Alves