From: Pedro Alves <palves@redhat.com>
To: Yao Qi <qiyaoltc@gmail.com>
Cc: gdb-patches@sourceware.org
Subject: Re: exceptions.KeyboardInterrupt is thrown in gdb.base/random-signal.exp
Date: Thu, 03 Dec 2015 17:19:00 -0000 [thread overview]
Message-ID: <56607997.5070209@redhat.com> (raw)
In-Reply-To: <86oae7sbl8.fsf@gmail.com>
On 12/03/2015 05:09 PM, Yao Qi wrote:
> Pedro Alves <palves@redhat.com> writes:
>
>> IMO, if the inferior is running and target_terminal_inferior is not in
>> effect (*) then the ctrl-c should _not_ trigger a Python
>> KeyboardInterrupt, but instead
>> be sent to the target -- if the target is running and we're running some
>> not-supposed-to-be-interactive Python unwinder code while processing
>> some internal stop
>> event, we know that the Python code will finish quickly and the target
>> should stop
>> for the SIGINT very soon. IOW, we treat the ctrl-c at exactly the
>> wrong time as if
>> it had been pressed a little sooner or later, outside Python.
>>
>> (*) - and it shouldn't, while an internal event is being processed.
>
> If I understand you correctly, ctrl-c shouldn't trigger a Python
> KeyboardInterrupt, and we should fix it somewhere in GDB.
Yes.
>
>>
>> To handle the case of something going wrong and gdb getting stuck in a loop too
>> long that the target's SIGINT takes forever to be processed, we could make gdb
>> react to a _second_ (impatient) ctrl-c as "okay, I'm sick of waiting,
>> please stop
>> whatever you're doing". This is like how remote.c handles ctrl-c at exactly the
>> wrong moment (while an internal event is processed) nowadays:
>>
>> https://sourceware.org/ml/gdb-patches/2015-08/msg00574.html
>
> I don't know how is this problem related to the second ctrl-c. It is
> expected that single ctrl-c should interrupt the target, why do we need
> the second ctrl-c in this case?
>
Say the Python code has a bug and ends up stuck in a loop and
doesn't finish quickly what it's supposed to do (the target is never
re-resumed and the SIGINT stop never processed). The user types
ctrl-c, and, nothing happens. After a while, the user gets sick of waiting,
and presses ctrl-c again. At this point, we could ask the user what
do to, raise KeyboardInterrupt, Quit, etc.
Thanks,
Pedro Alves
prev parent reply other threads:[~2015-12-03 17:19 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-25 16:07 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 message]
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=56607997.5070209@redhat.com \
--to=palves@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=qiyaoltc@gmail.com \
/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