]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Be more robust to the situation where a signal arrives, and there is a
authorJulian Seward <jseward@acm.org>
Thu, 13 Jun 2002 17:47:05 +0000 (17:47 +0000)
committerJulian Seward <jseward@acm.org>
Thu, 13 Jun 2002 17:47:05 +0000 (17:47 +0000)
handler, but in the interval between the signal arriving and it being
delivered to the client, the handler is removed.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@416

coregrind/vg_signals.c
vg_signals.c

index 7270450e54a2f40ad480d8cb056701cc4906c69f..cb9d53f92bec7ff0d6bbeef63b1f058f8ce57277 100644 (file)
@@ -1099,6 +1099,22 @@ Bool VG_(deliver_signals) ( void )
          are delivering the signal in the usual way.  And that the
          client really has a handler for this thread! */
       vg_assert(vg_dcss.dcss_sigpending[sigNo]);
+
+      /* A recent addition, so as to stop seriously wierd progs dying
+         at the following assertion (which this renders redundant,
+         btw). */
+      if (vg_scss.scss_per_sig[sigNo].scss_handler == VKI_SIG_IGN
+          || vg_scss.scss_per_sig[sigNo].scss_handler == VKI_SIG_DFL) {
+         /* Strange; perhaps the handler disappeared before we could
+            deliver the signal. */
+         VG_(message)(Vg_DebugMsg,
+            "discarding signal %d for thread %d because handler missing",
+            sigNo, tid );
+         vg_dcss.dcss_sigpending[sigNo] = False;
+         vg_dcss.dcss_destthread[sigNo] = VG_INVALID_THREADID;
+         continue; /* for (sigNo = 1; ...) loop */
+      }
+
       vg_assert(vg_scss.scss_per_sig[sigNo].scss_handler != VKI_SIG_IGN
                 && vg_scss.scss_per_sig[sigNo].scss_handler != VKI_SIG_DFL);
 
index 7270450e54a2f40ad480d8cb056701cc4906c69f..cb9d53f92bec7ff0d6bbeef63b1f058f8ce57277 100644 (file)
@@ -1099,6 +1099,22 @@ Bool VG_(deliver_signals) ( void )
          are delivering the signal in the usual way.  And that the
          client really has a handler for this thread! */
       vg_assert(vg_dcss.dcss_sigpending[sigNo]);
+
+      /* A recent addition, so as to stop seriously wierd progs dying
+         at the following assertion (which this renders redundant,
+         btw). */
+      if (vg_scss.scss_per_sig[sigNo].scss_handler == VKI_SIG_IGN
+          || vg_scss.scss_per_sig[sigNo].scss_handler == VKI_SIG_DFL) {
+         /* Strange; perhaps the handler disappeared before we could
+            deliver the signal. */
+         VG_(message)(Vg_DebugMsg,
+            "discarding signal %d for thread %d because handler missing",
+            sigNo, tid );
+         vg_dcss.dcss_sigpending[sigNo] = False;
+         vg_dcss.dcss_destthread[sigNo] = VG_INVALID_THREADID;
+         continue; /* for (sigNo = 1; ...) loop */
+      }
+
       vg_assert(vg_scss.scss_per_sig[sigNo].scss_handler != VKI_SIG_IGN
                 && vg_scss.scss_per_sig[sigNo].scss_handler != VKI_SIG_DFL);