bug-gdb
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gdb and catching SIGINT


From: Brian Eaton
Subject: gdb and catching SIGINT
Date: Wed, 15 Jun 2005 12:25:39 -0700 (PDT)

Hello all - 

I'm working on debugging a program that uses sigwait()
to wait for SIGINT to catch ctrl-C.  I normally use
"ctrl-C" in gdb to interrupt execution so I can set
breakpoints, examine variables, etc... but when I
attach to this program and use ctrl-C, the signal gets
passed to the program instead of being intercepted by
gdb.

This is somewhat bothersome.

Is what I am seeing "as-designed" behavior for gdb? 
Is there some configuration option I can set to avoid
it?

I have a test program that shows what happens.  Here's
an example of what I'm doing:

In one terminal window, I start up my test program: 
$ ./int
Program started, waiting for signal

Then, in another terminal, I attach to the program
with gdb and use "cont" to allow it to continue
executing:
$ gdb --pid=6814
GNU gdb 6.3
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General
Public License, and you are
welcome to change it and/or distribute copies of it
under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show
warranty" for details.
This GDB was configured as "i686-pc-linux-gnu".
Attaching to process 6814
Reading symbols from /home/beaton/ctrlc/int...done.
Using host libthread_db library
"/lib/tls/libthread_db.so.1".
Reading symbols from /lib/tls/libpthread.so.0...done.
[Thread debugging using libthread_db enabled]
[New Thread 1075093632 (LWP 6814)]
Loaded symbols for /lib/tls/libpthread.so.0
Reading symbols from /lib/tls/libc.so.6...done.
Loaded symbols for /lib/tls/libc.so.6
Reading symbols from /lib/ld-linux.so.2...done.
Loaded symbols for /lib/ld-linux.so.2
0xffffe410 in ?? ()
(gdb) cont

Meanwhile, my test program logs this message:
Wokeup, err = 4, sig = 0

Finally, I hit ctrl-C in the gdb terminal window. 
When that happens, my test program logs these messages
and exits: 
Wokeup, err = 0, sig = 2
Got signal 2, exiting.

And then gdb prints
Program exited normally.
(gdb)

The "handle SIGINT" command reports that gdb is set to
stop and print that signal, but not to pass it to the
program.

I'm attaching the test program to this message.

Regards,
Brian


                
__________________________________ 
Discover Yahoo! 
Stay in touch with email, IM, photo sharing and more. Check it out! 
http://discover.yahoo.com/stayintouch.html

Attachment: int.c
Description: 1602041336-int.c


reply via email to

[Prev in Thread] Current Thread [Next in Thread]