public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* exceptions.KeyboardInterrupt is thrown in gdb.base/random-signal.exp
@ 2015-11-25 16:07 Yao Qi
  2015-11-25 16:26 ` Pedro Alves
  0 siblings, 1 reply; 7+ messages in thread
From: Yao Qi @ 2015-11-25 16:07 UTC (permalink / raw)
  To: gdb-patches

Hi,
I am fixing a fail in gdb.base/random-signal.exp like this,

Continuing.^M
PASS: gdb.base/random-signal.exp: continue
^CPython Exception <type 'exceptions.KeyboardInterrupt'> <type 'exceptions.KeyboardInterrupt'>: ^M
FAIL: gdb.base/random-signal.exp: stop with control-c (timeout)

I only see this fail out of 15~20 runs each time.  Is it because GDB
received SIGINT before async_handle_remote_sigint is installed?  so
handle_sigint is still the SIGINT handler, set_quit_flag will call
python stuff, and KeyboardInterrupt is raised as a result.

In the test, we've already been aware of that the signal handler isn't
ready, so "Continuing" is consumed and ctrl-c is delayed in 500ms.

# For this to work we must be sure to consume the "Continuing."
# message first, or GDB's signal handler may not be in place.
after 500 {send_gdb "\003"}

After I read the tcl manul about "after", I feel the usage of "after"
above isn't 100% correct.  As the manual says, the "after" command
returns immediately, and the tcl command {send_gdb "\003"} will be
executed 500 ms later.  It is an asynchronous flavour, but what we want is
a synchronous operation, like this,

after 500
send_gdb "\003"

with this change, I don't see the timeout fail again.  Is it a fix or a
hack?

-- 
Yao (齐尧)

diff --git a/gdb/testsuite/gdb.base/random-signal.exp b/gdb/testsuite/gdb.base/random-signal.exp
index 566668a..59c8f5b 100644
--- a/gdb/testsuite/gdb.base/random-signal.exp
+++ b/gdb/testsuite/gdb.base/random-signal.exp
@@ -38,5 +38,6 @@ gdb_test_multiple "continue" "continue" {
 
 # For this to work we must be sure to consume the "Continuing."
 # message first, or GDB's signal handler may not be in place.
-after 500 {send_gdb "\003"}
+after 500
+send_gdb "\003"

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

end of thread, other threads:[~2015-12-03 17:19 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-25 16:07 exceptions.KeyboardInterrupt is thrown in gdb.base/random-signal.exp Yao Qi
2015-11-25 16:26 ` Pedro Alves
2015-11-25 17:16   ` Yao Qi
2015-12-01 17:15   ` Yao Qi
2015-12-03 12:47     ` Pedro Alves
2015-12-03 17:09       ` Yao Qi
2015-12-03 17:19         ` Pedro Alves

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