This is the mail archive of the gdb@sourceware.cygnus.com mailing list for the GDB project. See the GDB home page for more information.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
I would like to change the default behavior of gdb to ignore the SIGWINCH signal. Background: While debugging gdb with itself, the inferior program is often stopped because of a SIGWINCH signal that gdb doesn't ignore. The signal is generated by the readline library (version 2.2.1). (in rltty.c) Readline sets the window size as a way of making sure that the program using readline is in the foreground. More precisely: If a program using readline is started in the background, it must not fetch the tty settings -- the tty is under another program's control. The settings are probably not the same as they would be if the program using readline were in the foreground. The ioctl will cause the program to stop if it's in the background, so the user will know that he needs to foreground it before readline can be used. Another problem with gdb not ignoring the SIGWINCH signal is that every time the terminal window from where gdb is run is resized, the inferior program will be stopped. Two possible solutions: Solution 1: modify readline code to not issue a SIGWINCH: Index: rltty.c =================================================================== RCS file: /cvs/cvsfiles/devo/readline/rltty.c,v retrieving revision 1.13.42.2 diff -c -r1.13.42.2 rltty.c *** rltty.c 1998/12/31 20:52:35 1.13.42.2 --- rltty.c 1999/01/22 17:19:54 *************** *** 153,160 **** --- 153,162 ---- { struct winsize w; + #if 0 if (ioctl (tty, TIOCGWINSZ, &w) == 0) (void) ioctl (tty, TIOCSWINSZ, &w); + #endif } #else /* SHELL || !TIOCGWINSZ */ # define set_winsize(tty) This works fine, but forces us to diverge from the official readline. Moreover, this solution does not solve the problem of the inferior program being stopped when the terminal is resized. Solution 2: Change gdb default behavior on SIGWINCH: Index: infrun.c =================================================================== RCS file: /cvs/cvsfiles/devo/gdb/infrun.c,v retrieving revision 1.199 diff -c -r1.199 infrun.c *** infrun.c 1999/01/18 00:46:12 1.199 --- infrun.c 1999/01/22 17:31:51 *************** *** 3668,3673 **** --- 3668,3676 ---- signal_print[TARGET_SIGNAL_POLL] = 0; signal_stop[TARGET_SIGNAL_URG] = 0; signal_print[TARGET_SIGNAL_URG] = 0; + signal_stop[TARGET_SIGNAL_WINCH] = 0; + signal_print[TARGET_SIGNAL_WINCH] = 0; + #ifdef SOLIB_ADD add_show_from_set This takes care of both problems above. >From the documentation (gdb.texinfo): Normally, GDB is set up to ignore non-erroneous signals like SIGALRM (so as not to interfere with their role in the functioning of your program) but to stop your program immediately whenever an error signal happens. You can change these settings with the handle command. So it seems that we could include SIGWINCH in the set of ignored signals, without violating the 'intended' behavior of gdb. Any objections to us adopting solution 2 and therefore modifying gdb's behavior for SIGWINCH? Unless I hear otherwise, I'll make the changes on Friday, Jan 29. Thanks Elena -- Elena Zannoni ezannoni@cygnus.com Cygnus Solutions Ph: (617) 354-7165 955 Massachusetts Ave Fax: (617) 354-7161 Suite 401 Cambridge MA 02139