Accept all-stop alternative in mi_expect_interrupt

Message ID 1425505473-20729-1-git-send-email-simon.marchi@ericsson.com
State New, archived
Headers

Commit Message

Simon Marchi March 4, 2015, 9:44 p.m. UTC
  When interrupting a thread in non-stop vs all-stop, the signal given in
the MI *stopped event is not the same. Currently, mi_expect_interrupt only
accepts the case for non-stop, so this adds the alternative for all-stop.

gdb/testsuite/ChangeLog:

	* lib/mi-support.exp (mi_expect_interrupt): Accept
	alternative event for when in all-stop mode.
---
 gdb/testsuite/lib/mi-support.exp | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
  

Comments

Pedro Alves March 4, 2015, 10:05 p.m. UTC | #1
On 03/04/2015 09:44 PM, Simon Marchi wrote:

>  gdb/testsuite/lib/mi-support.exp | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp
> index 20546f6..b8f6334 100644
> --- a/gdb/testsuite/lib/mi-support.exp
> +++ b/gdb/testsuite/lib/mi-support.exp
> @@ -1195,14 +1195,14 @@ proc mi_expect_interrupt { test } {
>  	set prompt_re "$mi_gdb_prompt$"
>      }
>  
> -    set r "reason=\"signal-received\",signal-name=\"0\",signal-meaning=\"Signal 0\""
> -
> +    set r_nonstop "reason=\"signal-received\",signal-name=\"0\",signal-meaning=\"Signal 0\""
> +    set r_allstop "reason=\"signal-received\",signal-name=\"SIGINT\",signal-meaning=\"Interrupt\""

Add:

    set r "(${r_nonstop}|${r_allstop})"

and then you don't need this hunk below (and don't need to write the same thing twice):

>      set any "\[^\n\]*"
>  
>      # A signal can land anywhere, just ignore the location
> -    verbose -log "mi_expect_interrupt: expecting: \\*stopped,${r}$any\r\n$prompt_re"
> +    verbose -log "mi_expect_interrupt: expecting: \\*stopped,(${r_nonstop}|${r_allstop})$any\r\n$prompt_re"
>      gdb_expect {
> -	-re "\\*stopped,${r}$any\r\n$prompt_re" {
> +	-re "\\*stopped,(${r_nonstop}|${r_allstop})$any\r\n$prompt_re" {
>  	    pass "$test"
>  	    return 0
>  	}
> 

OK with that change.

Thanks,
Pedro Alves
  
Simon Marchi March 4, 2015, 10:58 p.m. UTC | #2
On 03/04/2015 05:05 PM, Pedro Alves wrote:
> On 03/04/2015 09:44 PM, Simon Marchi wrote:
> 
>>  gdb/testsuite/lib/mi-support.exp | 8 ++++----
>>  1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp
>> index 20546f6..b8f6334 100644
>> --- a/gdb/testsuite/lib/mi-support.exp
>> +++ b/gdb/testsuite/lib/mi-support.exp
>> @@ -1195,14 +1195,14 @@ proc mi_expect_interrupt { test } {
>>  	set prompt_re "$mi_gdb_prompt$"
>>      }
>>  
>> -    set r "reason=\"signal-received\",signal-name=\"0\",signal-meaning=\"Signal 0\""
>> -
>> +    set r_nonstop "reason=\"signal-received\",signal-name=\"0\",signal-meaning=\"Signal 0\""
>> +    set r_allstop "reason=\"signal-received\",signal-name=\"SIGINT\",signal-meaning=\"Interrupt\""
> 
> Add:
> 
>     set r "(${r_nonstop}|${r_allstop})"
> 
> and then you don't need this hunk below (and don't need to write the same thing twice):

Nice, done.

>>      set any "\[^\n\]*"
>>  
>>      # A signal can land anywhere, just ignore the location
>> -    verbose -log "mi_expect_interrupt: expecting: \\*stopped,${r}$any\r\n$prompt_re"
>> +    verbose -log "mi_expect_interrupt: expecting: \\*stopped,(${r_nonstop}|${r_allstop})$any\r\n$prompt_re"
>>      gdb_expect {
>> -	-re "\\*stopped,${r}$any\r\n$prompt_re" {
>> +	-re "\\*stopped,(${r_nonstop}|${r_allstop})$any\r\n$prompt_re" {
>>  	    pass "$test"
>>  	    return 0
>>  	}
>>
> 
> OK with that change.
> 
> Thanks,
> Pedro Alves

Pushed with that modification.
  

Patch

diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp
index 20546f6..b8f6334 100644
--- a/gdb/testsuite/lib/mi-support.exp
+++ b/gdb/testsuite/lib/mi-support.exp
@@ -1195,14 +1195,14 @@  proc mi_expect_interrupt { test } {
 	set prompt_re "$mi_gdb_prompt$"
     }
 
-    set r "reason=\"signal-received\",signal-name=\"0\",signal-meaning=\"Signal 0\""
-
+    set r_nonstop "reason=\"signal-received\",signal-name=\"0\",signal-meaning=\"Signal 0\""
+    set r_allstop "reason=\"signal-received\",signal-name=\"SIGINT\",signal-meaning=\"Interrupt\""
     set any "\[^\n\]*"
 
     # A signal can land anywhere, just ignore the location
-    verbose -log "mi_expect_interrupt: expecting: \\*stopped,${r}$any\r\n$prompt_re"
+    verbose -log "mi_expect_interrupt: expecting: \\*stopped,(${r_nonstop}|${r_allstop})$any\r\n$prompt_re"
     gdb_expect {
-	-re "\\*stopped,${r}$any\r\n$prompt_re" {
+	-re "\\*stopped,(${r_nonstop}|${r_allstop})$any\r\n$prompt_re" {
 	    pass "$test"
 	    return 0
 	}