This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: exceptions.KeyboardInterrupt is thrown in gdb.base/random-signal.exp

On 12/03/2015 05:09 PM, Yao Qi wrote:
> Pedro Alves <> 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.


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

Pedro Alves

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]