public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH v4] Introduce target_is_gdbserver
@ 2014-09-23 15:19 Simon Marchi
  2014-10-02 17:54 ` Simon Marchi
  2014-12-04 16:52 ` Pedro Alves
  0 siblings, 2 replies; 8+ messages in thread
From: Simon Marchi @ 2014-09-23 15:19 UTC (permalink / raw)
  To: gdb-patches; +Cc: Simon Marchi

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
+}
-- 
2.1.0

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v4] Introduce target_is_gdbserver
  2014-09-23 15:19 [PATCH v4] Introduce target_is_gdbserver Simon Marchi
@ 2014-10-02 17:54 ` Simon Marchi
  2014-10-20 17:49   ` Simon Marchi
  2014-12-04 16:52 ` Pedro Alves
  1 sibling, 1 reply; 8+ messages in thread
From: Simon Marchi @ 2014-10-02 17:54 UTC (permalink / raw)
  To: GDB Patches

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.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v4] Introduce target_is_gdbserver
  2014-10-02 17:54 ` Simon Marchi
@ 2014-10-20 17:49   ` Simon Marchi
  2014-12-01 13:37     ` Simon Marchi
  0 siblings, 1 reply; 8+ messages in thread
From: Simon Marchi @ 2014-10-20 17:49 UTC (permalink / raw)
  To: gdb-patches

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²

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v4] Introduce target_is_gdbserver
  2014-10-20 17:49   ` Simon Marchi
@ 2014-12-01 13:37     ` Simon Marchi
  0 siblings, 0 replies; 8+ messages in thread
From: Simon Marchi @ 2014-12-01 13:37 UTC (permalink / raw)
  To: gdb-patches

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.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v4] Introduce target_is_gdbserver
  2014-09-23 15:19 [PATCH v4] Introduce target_is_gdbserver Simon Marchi
  2014-10-02 17:54 ` Simon Marchi
@ 2014-12-04 16:52 ` Pedro Alves
  2014-12-05 18:34   ` [PATCH v5] Introduce target_is_gdbserver (was: v4) Simon Marchi
  1 sibling, 1 reply; 8+ messages in thread
From: Pedro Alves @ 2014-12-04 16:52 UTC (permalink / raw)
  To: Simon Marchi, gdb-patches

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v5] Introduce target_is_gdbserver (was: v4)
  2014-12-04 16:52 ` Pedro Alves
@ 2014-12-05 18:34   ` Simon Marchi
  2014-12-10 19:29     ` [PATCH v5] Introduce target_is_gdbserver Pedro Alves
  0 siblings, 1 reply; 8+ messages in thread
From: Simon Marchi @ 2014-12-05 18:34 UTC (permalink / raw)
  To: Pedro Alves, gdb-patches

On 2014-12-04 11:51 AM, Pedro Alves wrote:
> 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".

Done.

>> 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?

Damn, you are right (again). I moved it to gdb.exp in the updated patch below.

>> @@ -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.

Done.

>> +
>> +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?

Right, done.

>> +	}
>> +	-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
> 

Here is the updated patch.

From 918e76a8e4dfff49c89a8d69d6cc332e990dd4dc Mon Sep 17 00:00:00 2001
From: Simon Marchi <simon.marchi@ericsson.com>
Date: Tue, 23 Sep 2014 11:19:37 -0400
Subject: [PATCH v5] Introduce target_is_gdbserver

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 v5:

	* Move target_is_gdbserver to gdb.exp.
	* Fix formatting and typos.

gdb/testsuite/ChangeLog:

	* gdb.trace/qtro.exp: Replace gdbserver detection code by...
	* lib/gdb.exp (target_is_gdbserver): New
	procedure.
---
 gdb/testsuite/gdb.trace/qtro.exp | 13 +------------
 gdb/testsuite/lib/gdb.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/gdb.exp b/gdb/testsuite/lib/gdb.exp
index a29b661..b420e00 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -5004,5 +5004,30 @@ proc capture_command_output { command prefix } {
     return $output_string
 }

+# Return 1 if the current remote target is an instance of our 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
+}
+
 # Always load compatibility stuff.
 load_lib future.exp
-- 
2.1.3

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v5] Introduce target_is_gdbserver
  2014-12-05 18:34   ` [PATCH v5] Introduce target_is_gdbserver (was: v4) Simon Marchi
@ 2014-12-10 19:29     ` Pedro Alves
  2014-12-10 20:16       ` Simon Marchi
  0 siblings, 1 reply; 8+ messages in thread
From: Pedro Alves @ 2014-12-10 19:29 UTC (permalink / raw)
  To: Simon Marchi, gdb-patches

On 12/05/2014 06:34 PM, Simon Marchi wrote:

> diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
> index a29b661..b420e00 100644
> --- a/gdb/testsuite/lib/gdb.exp
> +++ b/gdb/testsuite/lib/gdb.exp
> @@ -5004,5 +5004,30 @@ proc capture_command_output { command prefix } {
>      return $output_string
>  }
> 
> +# Return 1 if the current remote target is an instance of our 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
> +}
> +

I think it'd be nice to have this close to gdb_is_target_remote.
How about moving it just below that one?

Anyway, this is OK.  Please push.

Thanks,
Pedro Alves

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v5] Introduce target_is_gdbserver
  2014-12-10 19:29     ` [PATCH v5] Introduce target_is_gdbserver Pedro Alves
@ 2014-12-10 20:16       ` Simon Marchi
  0 siblings, 0 replies; 8+ messages in thread
From: Simon Marchi @ 2014-12-10 20:16 UTC (permalink / raw)
  To: Pedro Alves, gdb-patches

On 2014-12-10 02:19 PM, Pedro Alves wrote:
> On 12/05/2014 06:34 PM, Simon Marchi wrote:
> 
>> diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
>> index a29b661..b420e00 100644
>> --- a/gdb/testsuite/lib/gdb.exp
>> +++ b/gdb/testsuite/lib/gdb.exp
>> @@ -5004,5 +5004,30 @@ proc capture_command_output { command prefix } {
>>      return $output_string
>>  }
>>
>> +# Return 1 if the current remote target is an instance of our 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
>> +}
>> +
> 
> I think it'd be nice to have this close to gdb_is_target_remote.
> How about moving it just below that one?
> 
> Anyway, this is OK.  Please push.
> 
> Thanks,
> Pedro Alves

Aight, moved and pushed:

From 0a46d518c7565be02e544ab508f8b5a99b1b5192 Mon Sep 17 00:00:00 2001
From: Simon Marchi <simon.marchi@ericsson.com>
Date: Wed, 10 Dec 2014 15:12:17 -0500
Subject: [PATCH] Introduce target_is_gdbserver

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.

gdb/testsuite/ChangeLog:

	* gdb.trace/qtro.exp: Replace gdbserver detection code by...
	* lib/gdb.exp (target_is_gdbserver): New
	procedure.
---
 gdb/testsuite/ChangeLog          |  5 +++++
 gdb/testsuite/gdb.trace/qtro.exp | 13 +------------
 gdb/testsuite/lib/gdb.exp        | 25 +++++++++++++++++++++++++
 3 files changed, 31 insertions(+), 12 deletions(-)

diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 0e973f7..4abd097 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2014-12-10  Simon Marchi  <simon.marchi@ericsson.com>
+
+	* gdb.trace/qtro.exp: Replace gdbserver detection code by...
+	* lib/gdb.exp (target_is_gdbserver): New procedure.
+
 2014-12-08  Doug Evans  <dje@google.com>

 	* gdb.python/py-objfile.exp: Add tests for objfile.owner.
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/gdb.exp b/gdb/testsuite/lib/gdb.exp
index a29b661..609f22f 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -2537,6 +2537,31 @@ proc gdb_is_target_remote {} {
     return 0
 }

+# Return 1 if the current remote target is an instance of our 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
+}
+
 set compiler_info		"unknown"
 set gcc_compiled		0
 set hp_cc_compiler		0
-- 
2.1.3

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-12-10 20:16 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-23 15:19 [PATCH v4] Introduce target_is_gdbserver Simon Marchi
2014-10-02 17:54 ` Simon Marchi
2014-10-20 17:49   ` Simon Marchi
2014-12-01 13:37     ` Simon Marchi
2014-12-04 16:52 ` Pedro Alves
2014-12-05 18:34   ` [PATCH v5] Introduce target_is_gdbserver (was: v4) Simon Marchi
2014-12-10 19:29     ` [PATCH v5] Introduce target_is_gdbserver Pedro Alves
2014-12-10 20:16       ` Simon Marchi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).