+/* Helper for thread_db_find_new_threads_2.
+ Returns number of new threads found. */
+
+static int
+find_new_threads_once (struct thread_db_info *info, int iteration,
+ td_err_e *errp)
+{
+ volatile struct gdb_exception except;
+ struct callback_data data;
+ td_err_e err = TD_ERR;
+
+ data.info = info;
+ data.new_threads = 0;
+
+ TRY_CATCH (except, RETURN_MASK_ERROR)
+ {
+ /* Iterate over all user-space threads to discover new threads. */
+ err = info->td_ta_thr_iter_p (info->thread_agent,
+ find_new_threads_callback,
+ &data,
+ TD_THR_ANY_STATE,
+ TD_THR_LOWEST_PRIORITY,
+ TD_SIGNO_MASK,
+ TD_THR_ANY_USER_FLAGS);
+ }
+
+ if (info_verbose)
+ {
+ if (except.reason < 0)
+ exception_fprintf (gdb_stderr, except,
+ "Warning: find_new_threads_once: ");
+
+ printf_filtered (_("Found %d new threads in iteration %d.\n"),
+ data.new_threads, iteration);
+ }
+
+ if (errp != NULL)
+ *errp = err;
+
+ return data.new_threads;
+}
+