GDB sysv signal handling patch

C. M. Heard/VVNET, Inc.
Thu Feb 5 15:27:00 GMT 1998


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

C. M. Heard/VVNET, Inc.

Thu Feb  5 14:55:15 1996  C. M. Heard  <>

	* 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

More information about the Gdb mailing list