Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Yao Qi <qiyaoltc@gmail.com>
To: gdb-patches@sourceware.org
Subject: exceptions.KeyboardInterrupt is thrown in gdb.base/random-signal.exp
Date: Wed, 25 Nov 2015 16:07:00 -0000	[thread overview]
Message-ID: <86ziy2xdt7.fsf@gmail.com> (raw)

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"


             reply	other threads:[~2015-11-25 16:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-25 16:07 Yao Qi [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86ziy2xdt7.fsf@gmail.com \
    --to=qiyaoltc@gmail.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox