public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* Re: threads/2320: When using "sigwait" GDB doesn't trap SIGINT. Ctrl+C terminates program when should break gdb.
@ 2007-09-29 20:38 Daniel Jacobowitz
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Jacobowitz @ 2007-09-29 20:38 UTC (permalink / raw)
  To: nobody; +Cc: gdb-prs

The following reply was made to PR threads/2320; it has been noted by GNATS.

From: Daniel Jacobowitz <drow@false.org>
To: jordiblasi@gmail.com
Cc: gdb-gnats@sources.redhat.com
Subject: Re: threads/2320: When using "sigwait" GDB doesn't trap SIGINT.
	Ctrl+C terminates program when should break gdb.
Date: Sat, 29 Sep 2007 16:32:44 -0400

 On Thu, Sep 20, 2007 at 08:53:13AM -0000, jordiblasi@gmail.com wrote:
 > I'm having problems getting GDB to not pass SIGINT to my program. In
 > my main thread I do a sigwait for SIGINT. When I'm debugging, while
 > gdb is running I may want to break gdb to set breakpoints or so,
 > then I hit Ctrl-C (send SIGINT) but gdb does not break, instead
 > SIGINT is passed to my program that gracefully terminates and gdb
 > prints "Program exited normally".
 
 Thanks for the clear report and test case.  I discussed this with
 Roland McGrath in the bugzilla.kernel.org entry you linked to; our
 conclusion was that the kernel is correct to not report the SIGINT
 in this case.  Of course that's not the useful behavior for GDB.
 
 I'm not planning to work on this right now, but here's some notes
 on a possible solution if anyone else wants to.
 
   - Define a new PTRACE_SETOPTIONS bit to enable the extra reporting.
 
   - Report the signal as a special event, using a new PTRACE_EVENT_FOO
     code in the high half-word of the wait status.
 
   - Adjust GDB to set the new options bit when it sets other options.
 
 -- 
 Daniel Jacobowitz
 CodeSourcery


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

* threads/2320: When using "sigwait" GDB doesn't trap SIGINT. Ctrl+C terminates program when should break gdb.
@ 2007-09-20  8:58 jordiblasi
  0 siblings, 0 replies; 2+ messages in thread
From: jordiblasi @ 2007-09-20  8:58 UTC (permalink / raw)
  To: gdb-gnats


>Number:         2320
>Category:       threads
>Synopsis:       When using "sigwait" GDB doesn't trap SIGINT. Ctrl+C terminates program when should break gdb.
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Thu Sep 20 08:58:01 UTC 2007
>Closed-Date:
>Last-Modified:
>Originator:     jordiblasi@gmail.com
>Release:        GNU gdb 6.5
>Organization:
>Environment:
GNU/Linux 2.6.20.1 #3 PREEMPT i686
gcc (GCC) 4.1.1 20060724 (prerelease) (4.1.1-3mdk)
>Description:
I'm having problems getting GDB to not pass SIGINT to my program. In my main thread I do a sigwait for SIGINT. When I'm debugging, while gdb is running I may want to break gdb to set breakpoints or so, then I hit Ctrl-C (send SIGINT) but gdb does not break, instead SIGINT is passed to my program that gracefully terminates and gdb prints "Program exited normally". Of course "info handle" shows that SIGINT should not be being passed to my program:

(gdb) info handle SIGINT
Signal        Stop      Print   Pass to program Description
SIGINT        Yes       Yes     No              Interrupt

GDB does not even print SIGINT signal delivery when I think it should.

Please check:

http://sourceware.org/ml/gdb/2006-04/msg00010.html 
http://bugzilla.kernel.org/show_bug.cgi?id=9039
>How-To-Repeat:
Compile attached "test_gdb.cpp" file and run it under gdb. While running hit Ctrl+C to interrupt GDB. Program will terminate so no chance to debug it any more.
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/x-c++src; name="test_gdb.cpp"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="test_gdb.cpp"

I2luY2x1ZGUgPHN0ZGxpYi5oPgojaW5jbHVkZSA8c3RkaW8uaD4KI2luY2x1ZGUgPGVycm5vLmg+
CiNpbmNsdWRlIDxzaWduYWwuaD4KI2luY2x1ZGUgPHN0cmluZy5oPgoKIAovLy0tLS0tLS0tLS0t
LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t
LS0tLS0tLS0tCnZvaWQg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LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t
LS0tLS0KICAgICAgICBzd2l0Y2goc2lnbmFsKQogICAgICAgIHsKICAgICAgICAgICAgY2FzZSBT
SUdURVJNOgogICAgICAgICAgICBjYXNlIFNJR0lOVDogCiAgICAgICAgICAgICAgICBwcmludGYo
IlRlcm1pbmF0aW5nLlxuIik7CiAgICAgICAgICAgICAgICBleGl0KDApOwogICAgICAgICAgICBi
cmVhazsKCiAgICAgICAgICAgIGRlZmF1bHQ6CiAgICAgICAgICAgICAgICBwcmludGYoIlVuaGFu
ZGxlZCBzaWduYWwgWyVzXVxuIixzdHJzaWduYWwoc2lnbmFsKSk7CiAgICAgICAgICAgIGJyZWFr
OwogICAgICAgIH0KICAgIH0KfQo=


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

end of thread, other threads:[~2007-09-29 20:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-09-29 20:38 threads/2320: When using "sigwait" GDB doesn't trap SIGINT. Ctrl+C terminates program when should break gdb Daniel Jacobowitz
  -- strict thread matches above, loose matches on Subject: below --
2007-09-20  8:58 jordiblasi

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