public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug python/14674] New: No KeyboardInterrupt exception during gdb.execute
@ 2012-10-05  1:35 m at bruenink dot de
  2013-01-21 14:43 ` [Bug python/14674] " tromey at redhat dot com
  2013-01-22  9:39 ` m at bruenink dot de
  0 siblings, 2 replies; 3+ messages in thread
From: m at bruenink dot de @ 2012-10-05  1:35 UTC (permalink / raw)
  To: gdb-prs


http://sourceware.org/bugzilla/show_bug.cgi?id=14674

             Bug #: 14674
           Summary: No KeyboardInterrupt exception during gdb.execute
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: minor
          Priority: P2
         Component: python
        AssignedTo: unassigned@sourceware.org
        ReportedBy: m@bruenink.de
    Classification: Unclassified


This is either
1. a bug in gdb, or
2. a bug in the documentation, or
3. a feature request.

Reading the documentation at
http://sourceware.org/gdb/onlinedocs/gdb/Exception-Handling.html I expect to
get a KeyboardInterrupt exception whenever I hit C-c. I only get it while
python code is directly executed. However, I also expect to get one if I use
gdb.execute.


def stop_handler(event):
    print "Stopped: %s" % event

gdb.events.stop.connect (stop_handler)

try:
  while True:
    pass
except KeyboardInterrupt:
  print "Got keyboard interrupt #1"

try:
  gdb.execute ("c")
except KeyboardInterrupt:
  print "Got keyboard interrupt #2"


Output:
^CGot keyboard interrupt #1
^C
Program received signal SIGINT, Interrupt.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug python/14674] No KeyboardInterrupt exception during gdb.execute
  2012-10-05  1:35 [Bug python/14674] New: No KeyboardInterrupt exception during gdb.execute m at bruenink dot de
@ 2013-01-21 14:43 ` tromey at redhat dot com
  2013-01-22  9:39 ` m at bruenink dot de
  1 sibling, 0 replies; 3+ messages in thread
From: tromey at redhat dot com @ 2013-01-21 14:43 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=14674

Tom Tromey <tromey at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tromey at redhat dot com

--- Comment #1 from Tom Tromey <tromey at redhat dot com> 2013-01-21 14:43:30 UTC ---
The second C-c is delivered to the inferior.
It is in the foreground due to "c".
Then gdb intercepts that SIGINT via ptrace.
So I think this is all expected, at least if I understand it properly.

Now, the same thing happens if you attach to a program.
This case is maybe more arguable.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug python/14674] No KeyboardInterrupt exception during gdb.execute
  2012-10-05  1:35 [Bug python/14674] New: No KeyboardInterrupt exception during gdb.execute m at bruenink dot de
  2013-01-21 14:43 ` [Bug python/14674] " tromey at redhat dot com
@ 2013-01-22  9:39 ` m at bruenink dot de
  1 sibling, 0 replies; 3+ messages in thread
From: m at bruenink dot de @ 2013-01-22  9:39 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=14674

--- Comment #2 from Marc Brünink <m at bruenink dot de> 2013-01-22 09:39:04 UTC ---
I think the second C-c should raise a KeyboardInterrupt. At least as long as I
don't change how SIGINTs are handled.

At the moment it depends on which statement your python script is executing
when you hit C-c. You cannot have a single try block and catch C-c. Instead you
need a try block and similar code in the stop_handler.

I assume a user always expects the same behaviour. Thus, I think it is not
optimal that I have to handle C-c at 2 different locations.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

end of thread, other threads:[~2013-01-22  9:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-05  1:35 [Bug python/14674] New: No KeyboardInterrupt exception during gdb.execute m at bruenink dot de
2013-01-21 14:43 ` [Bug python/14674] " tromey at redhat dot com
2013-01-22  9:39 ` m at bruenink dot de

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