-thread_db_create_event (CORE_ADDR where)
-{
- td_event_msg_t msg;
- td_err_e err;
- struct lwp_info *lwp;
- struct thread_db *thread_db = current_process ()->private->thread_db;
-
- if (thread_db->td_ta_event_getmsg_p == NULL)
- fatal ("unexpected thread_db->td_ta_event_getmsg_p == NULL");
-
- if (debug_threads)
- fprintf (stderr, "Thread creation event.\n");
-
- /* FIXME: This assumes we don't get another event.
- In the LinuxThreads implementation, this is safe,
- because all events come from the manager thread
- (except for its own creation, of course). */
- err = thread_db->td_ta_event_getmsg_p (thread_db->thread_agent, &msg);
- if (err != TD_OK)
- fprintf (stderr, "thread getmsg err: %s\n",
- thread_db_err_str (err));
-
- /* If we do not know about the main thread yet, this would be a good time to
- find it. We need to do this to pick up the main thread before any newly
- created threads. */
- lwp = get_thread_lwp (current_inferior);
- if (lwp->thread_known == 0)
- find_one_thread (lwp->head.id);
-
- /* msg.event == TD_EVENT_CREATE */
-
- find_new_threads_callback (msg.th_p, NULL);
-
- return 0;
-}
-
-static int
-thread_db_enable_reporting ()
-{
- td_thr_events_t events;
- td_notify_t notify;
- td_err_e err;
- struct thread_db *thread_db = current_process ()->private->thread_db;
-
- if (thread_db->td_ta_set_event_p == NULL
- || thread_db->td_ta_event_addr_p == NULL
- || thread_db->td_ta_event_getmsg_p == NULL)
- /* This libthread_db is missing required support. */
- return 0;
-
- /* Set the process wide mask saying which events we're interested in. */
- td_event_emptyset (&events);
- td_event_addset (&events, TD_CREATE);
-
- err = thread_db->td_ta_set_event_p (thread_db->thread_agent, &events);
- if (err != TD_OK)
- {
- warning ("Unable to set global thread event mask: %s",
- thread_db_err_str (err));
- return 0;
- }
-
- /* Get address for thread creation breakpoint. */
- err = thread_db->td_ta_event_addr_p (thread_db->thread_agent, TD_CREATE,
- ¬ify);
- if (err != TD_OK)
- {
- warning ("Unable to get location for thread creation breakpoint: %s",
- thread_db_err_str (err));
- return 0;
- }
- set_breakpoint_at ((CORE_ADDR) (unsigned long) notify.u.bptaddr,
- thread_db_create_event);
-
- return 1;
-}
-
-static int