+/* Check if it makes sense to read $_siginfo from the current thread
+ at this point. If not, throw an error. */
+
+static void
+validate_siginfo_access (void)
+{
+ /* No current inferior, no siginfo. */
+ if (ptid_equal (inferior_ptid, null_ptid))
+ error (_("No thread selected."));
+
+ /* Don't try to read from a dead thread. */
+ if (is_exited (inferior_ptid))
+ error (_("The current thread has terminated"));
+
+ /* ... or from a spinning thread. */
+ if (is_running (inferior_ptid))
+ error (_("Selected thread is running."));
+}
+