This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: fail to attach to process on Solaris


I took a look at the other places where changes might be needed, and I
only found one.  But I'm not completely sure about it.  

There are also a couple of places where the return code from
p_td_thr_get_info() is compared against the value TD_NOTHR, but the
documentation doesn't list that as a possible return value.  Probably
TD_BADTH is better.

I suggest these changes in addition to your patch.

*** sol-thread.c.orig   2011-09-21 18:42:12.506406776 -0400
--- sol-thread.c        2011-09-21 18:58:55.600242634 -0400
***************
*** 261,267 ****
      error (_("thread_to_lwp: td_ta_map_id2thr %s"), td_err_string
(val));
  
    val = p_td_thr_get_info (&th, &ti);
!   if (val == TD_NOTHR)
      return pid_to_ptid (-1);  /* Thread must have terminated.  */
    else if (val != TD_OK)
      error (_("thread_to_lwp: td_thr_get_info: %s"), td_err_string
(val));
--- 261,267 ----
      error (_("thread_to_lwp: td_ta_map_id2thr %s"), td_err_string
(val));
  
    val = p_td_thr_get_info (&th, &ti);
!   if (val == TD_BADTH)
      return pid_to_ptid (-1);  /* Thread must have terminated.  */
    else if (val != TD_OK)
      error (_("thread_to_lwp: td_thr_get_info: %s"), td_err_string
(val));
***************
*** 310,319 ****
      error (_("lwp_to_thread: td_thr_validate: %s."), td_err_string
(val));
  
    val = p_td_thr_get_info (&th, &ti);
!   if (val == TD_NOTHR)
      return pid_to_ptid (-1);  /* Thread must have terminated.  */
    else if (val != TD_OK)
      error (_("lwp_to_thread: td_thr_get_info: %s."), td_err_string
(val));
  
    return BUILD_THREAD (ti.ti_tid, PIDGET (lwp));
  }
--- 310,321 ----
      error (_("lwp_to_thread: td_thr_validate: %s."), td_err_string
(val));
  
    val = p_td_thr_get_info (&th, &ti);
!   if (val == TD_BADTH)
      return pid_to_ptid (-1);  /* Thread must have terminated.  */
    else if (val != TD_OK)
      error (_("lwp_to_thread: td_thr_get_info: %s."), td_err_string
(val));
+   else if (ti.ti_state == TD_THR_ZOMBIE)
+     return pid_to_ptid (-1);    /* Thread has terminated */
  
    return BUILD_THREAD (ti.ti_tid, PIDGET (lwp));
  }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]