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]

GDB sysv signal handling patch


Hi,

Some time ago I sent the following rather trivial patch (bundled
with another, since obsoleted patch) to the bug-gcc mailing list,
but I notice that it is not present in the gdb-980122 snapshot that
was recently announced on the EGCS mailing list by Jason Molenda
<jsm@cygnus.com>.  Its purpose is to prevent gdb from dumping
core on a sysv host when ctl-\ is hit twice (this happens
because the sysv "signal" call, unlike its BSD counterpart,
causes the signal handler to be uninstalled when the signal
handler is invoked).  I have successfully used this patch in a
Solaris2.4_x86-hosted gdb-4.16 cross debugger since May 1996
(and more recently in a Solaris2.5.1 native debugger).  Today
I updated the patch against the gdb-980122 snapshot, as
requested in Jason's announcement.

Mike
--
C. M. Heard/VVNET, Inc.
heard@vvnet.com

Thu Feb  5 14:55:15 1996  C. M. Heard  <heard@vvnet.com>

	* top.c (do_nothing) -- restore the signal handler so
	that under System V the second and subsequent occurrences
	of SIGQUIT (ctl-\) will be caught rather than causing gdb
	to dump core.

*** top.c.orig	Mon Jan 19 14:30:40 1998
--- top.c	Thu Feb  5 14:55:15 1998
***************
*** 1914,1919 ****
--- 1914,1926 ----
  do_nothing (signo)
  int signo;
  {
+   /* Under System V the default disposition of a signal is reinstated after
+      the signal is caught and delivered to an application process.  On such
+      systems one must restore the replacement signal handler if one wishes
+      to continue handling the signal in one's program.  On BSD systems this
+      is not needed but it is harmless, and it simplifies the code to just do
+      it unconditionally. */
+   signal (signo, do_nothing);
  }
  
  static void