public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug python/13265] New: SIGINT handling
@ 2011-10-05 17:36 tromey at redhat dot com
  2012-01-10  1:04 ` [Bug python/13265] " khooyp at cs dot umd.edu
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: tromey at redhat dot com @ 2011-10-05 17:36 UTC (permalink / raw)
  To: gdb-prs

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

             Bug #: 13265
           Summary: SIGINT handling
           Product: gdb
           Version: unknown
            Status: NEW
          Severity: normal
          Priority: P2
         Component: python
        AssignedTo: unassigned@sourceware.org
        ReportedBy: tromey@redhat.com
    Classification: Unclassified


We recently discussed SIGINT handling in gdb; maybe Python is
installing its own SIGINT handler, causing problems in some cases.
This needs to be investigated.
Supposedly if you use the python command to write an infinite loop,
it can't be interrupted.

-- 
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] 7+ messages in thread

* [Bug python/13265] SIGINT handling
  2011-10-05 17:36 [Bug python/13265] New: SIGINT handling tromey at redhat dot com
@ 2012-01-10  1:04 ` khooyp at cs dot umd.edu
  2012-01-10  1:08 ` khooyp at cs dot umd.edu
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: khooyp at cs dot umd.edu @ 2012-01-10  1:04 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #1 from Khoo Yit Phang <khooyp at cs dot umd.edu> 2012-01-10 01:03:14 UTC ---
Created attachment 6156
  --> http://sourceware.org/bugzilla/attachment.cgi?id=6156
Patch to allow SIGINT to interrupt the "python" command.

I've attached a patch that allows SIGINT to interrupt a "python" command. It
works by installing a Python-specific SIGINT handler just before executing a
Python script, and restoring the original SIGINT handler after execution as
well as at calls to gdb.execute(...).

There's one caveat: if an inferior is running via, e.g., gdb.execute("run"),
SIGINT will interrupt the inferior but not the enclosing "python" command. I
think it would be better to also interrupt the "python" command, but I'm not
sure how to detect this case yet.

-- 
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] 7+ messages in thread

* [Bug python/13265] SIGINT handling
  2011-10-05 17:36 [Bug python/13265] New: SIGINT handling tromey at redhat dot com
  2012-01-10  1:04 ` [Bug python/13265] " khooyp at cs dot umd.edu
@ 2012-01-10  1:08 ` khooyp at cs dot umd.edu
  2012-01-10 20:53 ` tromey at redhat dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: khooyp at cs dot umd.edu @ 2012-01-10  1:08 UTC (permalink / raw)
  To: gdb-prs

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

Khoo Yit Phang <khooyp at cs dot umd.edu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |khooyp at cs dot umd.edu

-- 
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] 7+ messages in thread

* [Bug python/13265] SIGINT handling
  2011-10-05 17:36 [Bug python/13265] New: SIGINT handling tromey at redhat dot com
  2012-01-10  1:04 ` [Bug python/13265] " khooyp at cs dot umd.edu
  2012-01-10  1:08 ` khooyp at cs dot umd.edu
@ 2012-01-10 20:53 ` tromey at redhat dot com
  2012-01-10 21:06 ` khooyp at cs dot umd.edu
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: tromey at redhat dot com @ 2012-01-10 20:53 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #2 from Tom Tromey <tromey at redhat dot com> 2012-01-10 20:52:18 UTC ---
For a real review you would have to email to gdb-patches.

I think the cleanup-creating function should pass the old
signal handler as an argument to the cleanup function.
That way you can stack them without dealing with the
calls to gdbpy_restore_sigint_handler when making a cleanup.

I haven't looked into this area of gdb much; so I don't know
what to suggest about interrupting Python while the inferior
is running.

-- 
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] 7+ messages in thread

* [Bug python/13265] SIGINT handling
  2011-10-05 17:36 [Bug python/13265] New: SIGINT handling tromey at redhat dot com
                   ` (2 preceding siblings ...)
  2012-01-10 20:53 ` tromey at redhat dot com
@ 2012-01-10 21:06 ` khooyp at cs dot umd.edu
  2012-01-10 21:18 ` khooyp at cs dot umd.edu
  2013-01-11 16:39 ` tromey at redhat dot com
  5 siblings, 0 replies; 7+ messages in thread
From: khooyp at cs dot umd.edu @ 2012-01-10 21:06 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #3 from Khoo Yit Phang <khooyp at cs dot umd.edu> 2012-01-10 21:06:18 UTC ---
Thanks for the tip: I'll post to gdb-patches with a link back here.

As for the cleanup-creating function (gdbpy_suspend_sigint_handler), note that
when it calls gdbpy_resume_sigint_handler, it does not restore the original
SIGINT handler but whatever SIGINT handler that is installed at cleanup. The
idea was that, if some nested function call changes the SIGINT handler, that
should be propagated back down the call stack as well. As it is, I don't know
whether the SIGINT handler is ever changed under normal operation, so there
won't be any observable difference in behavior between my implementation and
your suggestion.

I'll update my patch with a comment to explain the above in a moment.

-- 
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] 7+ messages in thread

* [Bug python/13265] SIGINT handling
  2011-10-05 17:36 [Bug python/13265] New: SIGINT handling tromey at redhat dot com
                   ` (3 preceding siblings ...)
  2012-01-10 21:06 ` khooyp at cs dot umd.edu
@ 2012-01-10 21:18 ` khooyp at cs dot umd.edu
  2013-01-11 16:39 ` tromey at redhat dot com
  5 siblings, 0 replies; 7+ messages in thread
From: khooyp at cs dot umd.edu @ 2012-01-10 21:18 UTC (permalink / raw)
  To: gdb-prs

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

Khoo Yit Phang <khooyp at cs dot umd.edu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Attachment #6156|0                           |1
        is obsolete|                            |

--- Comment #4 from Khoo Yit Phang <khooyp at cs dot umd.edu> 2012-01-10 21:18:09 UTC ---
Created attachment 6157
  --> http://sourceware.org/bugzilla/attachment.cgi?id=6157
Patch updated with explanation of gdbpy_resume_sigint_handler

-- 
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] 7+ messages in thread

* [Bug python/13265] SIGINT handling
  2011-10-05 17:36 [Bug python/13265] New: SIGINT handling tromey at redhat dot com
                   ` (4 preceding siblings ...)
  2012-01-10 21:18 ` khooyp at cs dot umd.edu
@ 2013-01-11 16:39 ` tromey at redhat dot com
  5 siblings, 0 replies; 7+ messages in thread
From: tromey at redhat dot com @ 2013-01-11 16:39 UTC (permalink / raw)
  To: gdb-prs

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

Tom Tromey <tromey at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |7.5

--- Comment #5 from Tom Tromey <tromey at redhat dot com> 2013-01-11 16:39:40 UTC ---
I think this was fixed a while ago.

-- 
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] 7+ messages in thread

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

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-05 17:36 [Bug python/13265] New: SIGINT handling tromey at redhat dot com
2012-01-10  1:04 ` [Bug python/13265] " khooyp at cs dot umd.edu
2012-01-10  1:08 ` khooyp at cs dot umd.edu
2012-01-10 20:53 ` tromey at redhat dot com
2012-01-10 21:06 ` khooyp at cs dot umd.edu
2012-01-10 21:18 ` khooyp at cs dot umd.edu
2013-01-11 16:39 ` tromey at redhat dot com

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