public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] testsuite: expect possible pagination when starting gdb
@ 2014-09-26 21:01 Simon Marchi
  2014-10-20 17:46 ` Simon Marchi
  0 siblings, 1 reply; 5+ messages in thread
From: Simon Marchi @ 2014-09-26 21:01 UTC (permalink / raw)
  To: gdb-patches; +Cc: Simon Marchi

When gdb starts, the lines that appear before the first prompt may get
paginated if the terminal in which the tests are ran is too small (in
terms of rows). These lines include the welcome/license message and
possibly more, such as "Reading symbols from...". Pagination is disabled
right after gdb is started (with "set height 0"), but this output happens
before we are able to set height.

If these lines get paginated, gdb waits for the user to press enter and
the test harness waits for gdb to print its prompt, resulting in a
deadlock.

My first idea was to launch gdb with --quiet. However, some lines are
still printed ("Reading symbols from...", some more stuff when attaching
with --pid, etc).

The proposed solution simply expects that pagination can occur after
starting gdb. If this is the case, it sends a "\n" and loops.

gdb/testsuite/Changelog:

	* lib/gdb.exp (default_gdb_start): After starting gdb, loop
	as long as we get pagination notifications.
---
 gdb/testsuite/lib/gdb.exp | 39 ++++++++++++++++++++++++---------------
 1 file changed, 24 insertions(+), 15 deletions(-)

diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 47dc27b..820f87f 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -1451,7 +1451,7 @@ proc default_gdb_spawn { } {
 # Default gdb_start procedure.
 
 proc default_gdb_start { } {
-    global gdb_prompt
+    global gdb_prompt pagination_prompt
     global gdb_spawn_id
 
     if [info exists gdb_spawn_id] {
@@ -1466,20 +1466,29 @@ proc default_gdb_start { } {
     # When running over NFS, particularly if running many simultaneous
     # tests on different hosts all using the same server, things can
     # get really slow.  Give gdb at least 3 minutes to start up.
-    gdb_expect 360 {
-	-re "\[\r\n\]$gdb_prompt $" {
-	    verbose "GDB initialized."
-	}
-	-re "$gdb_prompt $"	{
-	    perror "GDB never initialized."
-	    unset gdb_spawn_id
-	    return -1
-	}
-	timeout	{
-	    perror "(timeout) GDB never initialized after 10 seconds."
-	    remote_close host
-	    unset gdb_spawn_id
-	    return -1
+    set loop_again 1
+    while { $loop_again } {
+	set loop_again 0
+	gdb_expect 360 {
+	    -re "$pagination_prompt" {
+		verbose "Hit pagination during startup. Pressing enter to continue."
+		send_gdb "\n"
+		set loop_again 1
+	    }
+	    -re "\[\r\n\]$gdb_prompt $" {
+		verbose "GDB initialized."
+	    }
+	    -re "$gdb_prompt $"	{
+		perror "GDB never initialized."
+		unset gdb_spawn_id
+		return -1
+	    }
+	    timeout	{
+		perror "(timeout) GDB never initialized after 10 seconds."
+		remote_close host
+		unset gdb_spawn_id
+		return -1
+	    }
 	}
     }
 
-- 
2.1.0

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

* Re: [PATCH] testsuite: expect possible pagination when starting gdb
  2014-09-26 21:01 [PATCH] testsuite: expect possible pagination when starting gdb Simon Marchi
@ 2014-10-20 17:46 ` Simon Marchi
  2014-12-01 13:30   ` Simon Marchi
  0 siblings, 1 reply; 5+ messages in thread
From: Simon Marchi @ 2014-10-20 17:46 UTC (permalink / raw)
  To: GDB Patches

On 2014-09-26 05:01 PM, Simon Marchi wrote:
> When gdb starts, the lines that appear before the first prompt may get
> paginated if the terminal in which the tests are ran is too small (in
> terms of rows). These lines include the welcome/license message and
> possibly more, such as "Reading symbols from...". Pagination is disabled
> right after gdb is started (with "set height 0"), but this output happens
> before we are able to set height.
> 
> If these lines get paginated, gdb waits for the user to press enter and
> the test harness waits for gdb to print its prompt, resulting in a
> deadlock.
> 
> My first idea was to launch gdb with --quiet. However, some lines are
> still printed ("Reading symbols from...", some more stuff when attaching
> with --pid, etc).
> 
> The proposed solution simply expects that pagination can occur after
> starting gdb. If this is the case, it sends a "\n" and loops.
> 
> gdb/testsuite/Changelog:
> 
> 	* lib/gdb.exp (default_gdb_start): After starting gdb, loop
> 	as long as we get pagination notifications.
> ---
>  gdb/testsuite/lib/gdb.exp | 39 ++++++++++++++++++++++++---------------
>  1 file changed, 24 insertions(+), 15 deletions(-)
> 
> diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
> index 47dc27b..820f87f 100644
> --- a/gdb/testsuite/lib/gdb.exp
> +++ b/gdb/testsuite/lib/gdb.exp
> @@ -1451,7 +1451,7 @@ proc default_gdb_spawn { } {
>  # Default gdb_start procedure.
>  
>  proc default_gdb_start { } {
> -    global gdb_prompt
> +    global gdb_prompt pagination_prompt
>      global gdb_spawn_id
>  
>      if [info exists gdb_spawn_id] {
> @@ -1466,20 +1466,29 @@ proc default_gdb_start { } {
>      # When running over NFS, particularly if running many simultaneous
>      # tests on different hosts all using the same server, things can
>      # get really slow.  Give gdb at least 3 minutes to start up.
> -    gdb_expect 360 {
> -	-re "\[\r\n\]$gdb_prompt $" {
> -	    verbose "GDB initialized."
> -	}
> -	-re "$gdb_prompt $"	{
> -	    perror "GDB never initialized."
> -	    unset gdb_spawn_id
> -	    return -1
> -	}
> -	timeout	{
> -	    perror "(timeout) GDB never initialized after 10 seconds."
> -	    remote_close host
> -	    unset gdb_spawn_id
> -	    return -1
> +    set loop_again 1
> +    while { $loop_again } {
> +	set loop_again 0
> +	gdb_expect 360 {
> +	    -re "$pagination_prompt" {
> +		verbose "Hit pagination during startup. Pressing enter to continue."
> +		send_gdb "\n"
> +		set loop_again 1
> +	    }
> +	    -re "\[\r\n\]$gdb_prompt $" {
> +		verbose "GDB initialized."
> +	    }
> +	    -re "$gdb_prompt $"	{
> +		perror "GDB never initialized."
> +		unset gdb_spawn_id
> +		return -1
> +	    }
> +	    timeout	{
> +		perror "(timeout) GDB never initialized after 10 seconds."
> +		remote_close host
> +		unset gdb_spawn_id
> +		return -1
> +	    }
>  	}
>      }
>  
> 

Ping.

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

* Re: [PATCH] testsuite: expect possible pagination when starting gdb
  2014-10-20 17:46 ` Simon Marchi
@ 2014-12-01 13:30   ` Simon Marchi
  2014-12-13 14:26     ` Joel Brobecker
  0 siblings, 1 reply; 5+ messages in thread
From: Simon Marchi @ 2014-12-01 13:30 UTC (permalink / raw)
  To: GDB Patches

On 2014-10-20 01:46 PM, Simon Marchi wrote:
> On 2014-09-26 05:01 PM, Simon Marchi wrote:
>> When gdb starts, the lines that appear before the first prompt may get
>> paginated if the terminal in which the tests are ran is too small (in
>> terms of rows). These lines include the welcome/license message and
>> possibly more, such as "Reading symbols from...". Pagination is disabled
>> right after gdb is started (with "set height 0"), but this output happens
>> before we are able to set height.
>>
>> If these lines get paginated, gdb waits for the user to press enter and
>> the test harness waits for gdb to print its prompt, resulting in a
>> deadlock.
>>
>> My first idea was to launch gdb with --quiet. However, some lines are
>> still printed ("Reading symbols from...", some more stuff when attaching
>> with --pid, etc).
>>
>> The proposed solution simply expects that pagination can occur after
>> starting gdb. If this is the case, it sends a "\n" and loops.
>>
>> gdb/testsuite/Changelog:
>>
>> 	* lib/gdb.exp (default_gdb_start): After starting gdb, loop
>> 	as long as we get pagination notifications.
>> ---
>>  gdb/testsuite/lib/gdb.exp | 39 ++++++++++++++++++++++++---------------
>>  1 file changed, 24 insertions(+), 15 deletions(-)
>>
>> diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
>> index 47dc27b..820f87f 100644
>> --- a/gdb/testsuite/lib/gdb.exp
>> +++ b/gdb/testsuite/lib/gdb.exp
>> @@ -1451,7 +1451,7 @@ proc default_gdb_spawn { } {
>>  # Default gdb_start procedure.
>>  
>>  proc default_gdb_start { } {
>> -    global gdb_prompt
>> +    global gdb_prompt pagination_prompt
>>      global gdb_spawn_id
>>  
>>      if [info exists gdb_spawn_id] {
>> @@ -1466,20 +1466,29 @@ proc default_gdb_start { } {
>>      # When running over NFS, particularly if running many simultaneous
>>      # tests on different hosts all using the same server, things can
>>      # get really slow.  Give gdb at least 3 minutes to start up.
>> -    gdb_expect 360 {
>> -	-re "\[\r\n\]$gdb_prompt $" {
>> -	    verbose "GDB initialized."
>> -	}
>> -	-re "$gdb_prompt $"	{
>> -	    perror "GDB never initialized."
>> -	    unset gdb_spawn_id
>> -	    return -1
>> -	}
>> -	timeout	{
>> -	    perror "(timeout) GDB never initialized after 10 seconds."
>> -	    remote_close host
>> -	    unset gdb_spawn_id
>> -	    return -1
>> +    set loop_again 1
>> +    while { $loop_again } {
>> +	set loop_again 0
>> +	gdb_expect 360 {
>> +	    -re "$pagination_prompt" {
>> +		verbose "Hit pagination during startup. Pressing enter to continue."
>> +		send_gdb "\n"
>> +		set loop_again 1
>> +	    }
>> +	    -re "\[\r\n\]$gdb_prompt $" {
>> +		verbose "GDB initialized."
>> +	    }
>> +	    -re "$gdb_prompt $"	{
>> +		perror "GDB never initialized."
>> +		unset gdb_spawn_id
>> +		return -1
>> +	    }
>> +	    timeout	{
>> +		perror "(timeout) GDB never initialized after 10 seconds."
>> +		remote_close host
>> +		unset gdb_spawn_id
>> +		return -1
>> +	    }
>>  	}
>>      }
>>  
>>
> 
> Ping.

Ping.

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

* Re: [PATCH] testsuite: expect possible pagination when starting gdb
  2014-12-01 13:30   ` Simon Marchi
@ 2014-12-13 14:26     ` Joel Brobecker
  2014-12-15 16:51       ` Simon Marchi
  0 siblings, 1 reply; 5+ messages in thread
From: Joel Brobecker @ 2014-12-13 14:26 UTC (permalink / raw)
  To: Simon Marchi; +Cc: GDB Patches

> >> The proposed solution simply expects that pagination can occur after
> >> starting gdb. If this is the case, it sends a "\n" and loops.
> >>
> >> gdb/testsuite/Changelog:
> >>
> >> 	* lib/gdb.exp (default_gdb_start): After starting gdb, loop
> >> 	as long as we get pagination notifications.

Sorry for the delay. This looks good to me, so go ahead and apply.

Thank you,
-- 
Joel

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

* Re: [PATCH] testsuite: expect possible pagination when starting gdb
  2014-12-13 14:26     ` Joel Brobecker
@ 2014-12-15 16:51       ` Simon Marchi
  0 siblings, 0 replies; 5+ messages in thread
From: Simon Marchi @ 2014-12-15 16:51 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: GDB Patches

On 2014-12-13 09:25 AM, Joel Brobecker wrote:
>>>> The proposed solution simply expects that pagination can occur after
>>>> starting gdb. If this is the case, it sends a "\n" and loops.
>>>>
>>>> gdb/testsuite/Changelog:
>>>>
>>>> 	* lib/gdb.exp (default_gdb_start): After starting gdb, loop
>>>> 	as long as we get pagination notifications.
> 
> Sorry for the delay. This looks good to me, so go ahead and apply.
> 
> Thank you,

Pushed, thanks.

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

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

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-26 21:01 [PATCH] testsuite: expect possible pagination when starting gdb Simon Marchi
2014-10-20 17:46 ` Simon Marchi
2014-12-01 13:30   ` Simon Marchi
2014-12-13 14:26     ` Joel Brobecker
2014-12-15 16:51       ` 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).