[BACK]Return to pthread_dbg.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / lib / libpthread_dbg

Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.

Diff for /src/lib/libpthread_dbg/Attic/pthread_dbg.c between version 1.7 and 1.8

version 1.7, 2003/06/26 21:51:59 version 1.8, 2003/07/17 21:14:49
Line 178  td_thr_iter(td_proc_t *proc, int (*call)
Line 178  td_thr_iter(td_proc_t *proc, int (*call)
                         return 0;                          return 0;
   
                 val = READ(proc,                  val = READ(proc,
                     next + offsetof(struct pthread_st, pt_allq.ptqe_next),                      next + offsetof(struct __pthread_st, pt_allq.ptqe_next),
                     &next, sizeof(next));                      &next, sizeof(next));
                 if (val != 0)                  if (val != 0)
                         return val;                          return val;
Line 201  td_thr_info(td_thread_t *thread, td_thre
Line 201  td_thr_info(td_thread_t *thread, td_thre
   
         info->thread_addr = thread->addr;          info->thread_addr = thread->addr;
         if ((val = READ(thread->proc,          if ((val = READ(thread->proc,
             thread->addr + offsetof(struct pthread_st, pt_state),              thread->addr + offsetof(struct __pthread_st, pt_state),
             &tmp, sizeof(tmp))) != 0)              &tmp, sizeof(tmp))) != 0)
                 return val;                  return val;
         switch (tmp) {          switch (tmp) {
Line 225  td_thr_info(td_thread_t *thread, td_thre
Line 225  td_thr_info(td_thread_t *thread, td_thre
         }          }
   
         if ((val = READ(thread->proc,          if ((val = READ(thread->proc,
             thread->addr + offsetof(struct pthread_st, pt_type),              thread->addr + offsetof(struct __pthread_st, pt_type),
             &tmp, sizeof(tmp))) != 0)              &tmp, sizeof(tmp))) != 0)
                 return val;                  return val;
         switch (tmp) {          switch (tmp) {
Line 241  td_thr_info(td_thread_t *thread, td_thre
Line 241  td_thr_info(td_thread_t *thread, td_thre
         }          }
   
         if ((val = READ(thread->proc,          if ((val = READ(thread->proc,
             thread->addr + offsetof(struct pthread_st, pt_stack),              thread->addr + offsetof(struct __pthread_st, pt_stack),
             &info->thread_stack, sizeof(stack_t))) != 0)              &info->thread_stack, sizeof(stack_t))) != 0)
                 return val;                  return val;
   
         if ((val = READ(thread->proc,          if ((val = READ(thread->proc,
             thread->addr + offsetof(struct pthread_st, pt_joiners),              thread->addr + offsetof(struct __pthread_st, pt_joiners),
             &queue, sizeof(queue))) != 0)              &queue, sizeof(queue))) != 0)
                 return val;                  return val;
   
Line 256  td_thr_info(td_thread_t *thread, td_thre
Line 256  td_thr_info(td_thread_t *thread, td_thre
                 info->thread_hasjoiners = 1;                  info->thread_hasjoiners = 1;
   
         if ((val = READ(thread->proc,          if ((val = READ(thread->proc,
             thread->addr + offsetof(struct pthread_st, pt_errno),              thread->addr + offsetof(struct __pthread_st, pt_errno),
             &info->thread_errno, sizeof(info->thread_errno))) != 0)              &info->thread_errno, sizeof(info->thread_errno))) != 0)
                 return val;                  return val;
   
         if ((val = READ(thread->proc,          if ((val = READ(thread->proc,
             thread->addr + offsetof(struct pthread_st, pt_num),              thread->addr + offsetof(struct __pthread_st, pt_num),
             &info->thread_id, sizeof(info->thread_id))) != 0)              &info->thread_id, sizeof(info->thread_id))) != 0)
                 return val;                  return val;
   
         if ((val = READ(thread->proc,          if ((val = READ(thread->proc,
             thread->addr + offsetof(struct pthread_st, pt_sigmask),              thread->addr + offsetof(struct __pthread_st, pt_sigmask),
             &info->thread_sigmask, sizeof(info->thread_sigmask))) != 0)              &info->thread_sigmask, sizeof(info->thread_sigmask))) != 0)
                 return val;                  return val;
   
         if ((val = READ(thread->proc,          if ((val = READ(thread->proc,
             thread->addr + offsetof(struct pthread_st, pt_siglist),              thread->addr + offsetof(struct __pthread_st, pt_siglist),
             &info->thread_sigpending, sizeof(info->thread_sigpending))) != 0)              &info->thread_sigpending, sizeof(info->thread_sigpending))) != 0)
                 return val;                  return val;
   
Line 293  td_thr_getname(td_thread_t *thread, char
Line 293  td_thr_getname(td_thread_t *thread, char
                 return TD_ERR_BADTHREAD;                  return TD_ERR_BADTHREAD;
   
         if ((val = READ(thread->proc,          if ((val = READ(thread->proc,
             thread->addr + offsetof(struct pthread_st, pt_name),              thread->addr + offsetof(struct __pthread_st, pt_name),
             &nameaddr, sizeof(nameaddr))) != 0)              &nameaddr, sizeof(nameaddr))) != 0)
                 return val;                  return val;
   
Line 314  td_thr_getregs(td_thread_t *thread, int 
Line 314  td_thr_getregs(td_thread_t *thread, int 
         ucontext_t uc;          ucontext_t uc;
   
         val = READ(thread->proc,          val = READ(thread->proc,
             thread->addr + offsetof(struct pthread_st, pt_state),              thread->addr + offsetof(struct __pthread_st, pt_state),
             &tmp, sizeof(tmp));              &tmp, sizeof(tmp));
         if (val != 0)          if (val != 0)
                 return val;                  return val;
Line 337  td_thr_getregs(td_thread_t *thread, int 
Line 337  td_thr_getregs(td_thread_t *thread, int 
                  * of the thread structure.                   * of the thread structure.
                  */                   */
                 val = READ(thread->proc,                  val = READ(thread->proc,
                     thread->addr + offsetof(struct pthread_st, pt_trapuc),                      thread->addr + offsetof(struct __pthread_st, pt_trapuc),
                     &addr, sizeof(addr));                      &addr, sizeof(addr));
                 if (val != 0)                  if (val != 0)
                         return val;                          return val;
                 if (addr == 0) {                  if (addr == 0) {
                         val = READ(thread->proc,                          val = READ(thread->proc,
                             thread->addr + offsetof(struct pthread_st, pt_uc),                              thread->addr + offsetof(struct __pthread_st, pt_uc),
                             &addr, sizeof(addr));                              &addr, sizeof(addr));
                         if (val != 0)                          if (val != 0)
                                 return val;                                  return val;
Line 380  td_thr_setregs(td_thread_t *thread, int 
Line 380  td_thr_setregs(td_thread_t *thread, int 
         ucontext_t uc;          ucontext_t uc;
   
         val = READ(thread->proc,          val = READ(thread->proc,
             thread->addr + offsetof(struct pthread_st, pt_state),              thread->addr + offsetof(struct __pthread_st, pt_state),
             &tmp, sizeof(tmp));              &tmp, sizeof(tmp));
         if (val != 0)          if (val != 0)
                 return val;                  return val;
Line 406  td_thr_setregs(td_thread_t *thread, int 
Line 406  td_thr_setregs(td_thread_t *thread, int 
                  * besides the registers that should be preserved.                   * besides the registers that should be preserved.
                  */                   */
                 val = READ(thread->proc,                  val = READ(thread->proc,
                     thread->addr + offsetof(struct pthread_st, pt_trapuc),                      thread->addr + offsetof(struct __pthread_st, pt_trapuc),
                     &addr, sizeof(addr));                      &addr, sizeof(addr));
                 if (val != 0)                  if (val != 0)
                         return val;                          return val;
                 if (addr == 0) {                  if (addr == 0) {
                         val = READ(thread->proc,                          val = READ(thread->proc,
                             thread->addr + offsetof(struct pthread_st, pt_uc),                              thread->addr + offsetof(struct __pthread_st, pt_uc),
                             &addr, sizeof(addr));                              &addr, sizeof(addr));
                         if (val != 0)                          if (val != 0)
                                 return val;                                  return val;
Line 459  td_thr_join_iter(td_thread_t *thread, in
Line 459  td_thr_join_iter(td_thread_t *thread, in
         struct pthread_queue_t queue;          struct pthread_queue_t queue;
   
         if ((val = READ(thread->proc,          if ((val = READ(thread->proc,
             thread->addr + offsetof(struct pthread_st, pt_joiners),              thread->addr + offsetof(struct __pthread_st, pt_joiners),
             &queue, sizeof(queue))) != 0)              &queue, sizeof(queue))) != 0)
                 return val;                  return val;
   
Line 473  td_thr_join_iter(td_thread_t *thread, in
Line 473  td_thr_join_iter(td_thread_t *thread, in
                         return 0;                          return 0;
   
                 val = READ(thread->proc,                  val = READ(thread->proc,
                     next + offsetof(struct pthread_st, pt_sleep.ptqe_next),                      next + offsetof(struct __pthread_st, pt_sleep.ptqe_next),
                     &next, sizeof(next));                      &next, sizeof(next));
                 if (val != 0)                  if (val != 0)
                         return val;                          return val;
Line 500  td_sync_info(td_sync_t *s, td_sync_info_
Line 500  td_sync_info(td_sync_t *s, td_sync_info_
         switch (magic) {          switch (magic) {
         case _PT_MUTEX_MAGIC:          case _PT_MUTEX_MAGIC:
                 info->sync_type = TD_SYNC_MUTEX;                  info->sync_type = TD_SYNC_MUTEX;
                 info->sync_size = sizeof(struct pthread_mutex_st);                  info->sync_size = sizeof(struct __pthread_mutex_st);
                 if ((val = READ(s->proc,                  if ((val = READ(s->proc,
                     s->addr + offsetof(struct pthread_mutex_st, ptm_blocked),                      s->addr + offsetof(struct __pthread_mutex_st, ptm_blocked),
                     &queue, sizeof(queue))) != 0)                      &queue, sizeof(queue))) != 0)
                 return val;                  return val;
   
Line 514  td_sync_info(td_sync_t *s, td_sync_info_
Line 514  td_sync_info(td_sync_t *s, td_sync_info_
                  * from __cpu_simple_lock_t.                   * from __cpu_simple_lock_t.
                  */                   */
                 if ((val = READ(s->proc,                  if ((val = READ(s->proc,
                     s->addr + offsetof(struct pthread_mutex_st, ptm_lock),                      s->addr + offsetof(struct __pthread_mutex_st, ptm_lock),
                     (void *)&slock, sizeof(slock))) != 0)                      (void *)&slock, sizeof(slock))) != 0)
                         return val;                          return val;
                 if (slock == __SIMPLELOCK_LOCKED) {                  if (slock == __SIMPLELOCK_LOCKED) {
                         info->sync_data.mutex.locked = 1;                          info->sync_data.mutex.locked = 1;
                         if ((val = READ(s->proc,                          if ((val = READ(s->proc,
                             s->addr + offsetof(struct pthread_mutex_st,                              s->addr + offsetof(struct __pthread_mutex_st,
                                 ptm_owner),                                  ptm_owner),
                             &taddr, sizeof(taddr))) != 0)                              &taddr, sizeof(taddr))) != 0)
                                 return val;                                  return val;
Line 532  td_sync_info(td_sync_t *s, td_sync_info_
Line 532  td_sync_info(td_sync_t *s, td_sync_info_
                 break;                  break;
         case _PT_COND_MAGIC:          case _PT_COND_MAGIC:
                 info->sync_type = TD_SYNC_COND;                  info->sync_type = TD_SYNC_COND;
                 info->sync_size = sizeof(struct pthread_cond_st);                  info->sync_size = sizeof(struct __pthread_cond_st);
                 if ((val = READ(s->proc,                  if ((val = READ(s->proc,
                     s->addr + offsetof(struct pthread_cond_st, ptc_waiters),                      s->addr + offsetof(struct __pthread_cond_st, ptc_waiters),
                     &queue, sizeof(queue))) != 0)                      &queue, sizeof(queue))) != 0)
                         return val;                          return val;
                 if (!PTQ_EMPTY(&queue))                  if (!PTQ_EMPTY(&queue))
Line 542  td_sync_info(td_sync_t *s, td_sync_info_
Line 542  td_sync_info(td_sync_t *s, td_sync_info_
                 break;                  break;
         case _PT_SPINLOCK_MAGIC:          case _PT_SPINLOCK_MAGIC:
                 info->sync_type = TD_SYNC_SPIN;                  info->sync_type = TD_SYNC_SPIN;
                 info->sync_size = sizeof(struct pthread_spinlock_st);                  info->sync_size = sizeof(struct __pthread_spinlock_st);
                 if ((val = READ(s->proc,                  if ((val = READ(s->proc,
                     s->addr + offsetof(struct pthread_spinlock_st, pts_spin),                      s->addr + offsetof(struct __pthread_spinlock_st, pts_spin),
                     (void *)&slock, sizeof(slock))) != 0)                      (void *)&slock, sizeof(slock))) != 0)
                         return val;                          return val;
                 if (slock == __SIMPLELOCK_LOCKED)                  if (slock == __SIMPLELOCK_LOCKED)
Line 552  td_sync_info(td_sync_t *s, td_sync_info_
Line 552  td_sync_info(td_sync_t *s, td_sync_info_
                 break;                  break;
         case PT_MAGIC:          case PT_MAGIC:
                 info->sync_type = TD_SYNC_JOIN;                  info->sync_type = TD_SYNC_JOIN;
                 info->sync_size = sizeof(struct pthread_st);                  info->sync_size = sizeof(struct __pthread_st);
                 td__getthread(s->proc, s->addr,                  td__getthread(s->proc, s->addr,
                     &info->sync_data.join.thread);                      &info->sync_data.join.thread);
                 if ((val = READ(s->proc,                  if ((val = READ(s->proc,
                     s->addr + offsetof(struct pthread_st, pt_joiners),                      s->addr + offsetof(struct __pthread_st, pt_joiners),
                     &queue, sizeof(queue))) != 0)                      &queue, sizeof(queue))) != 0)
                         return val;                          return val;
   
Line 565  td_sync_info(td_sync_t *s, td_sync_info_
Line 565  td_sync_info(td_sync_t *s, td_sync_info_
                 break;                  break;
         case (int)_PT_RWLOCK_MAGIC:          case (int)_PT_RWLOCK_MAGIC:
                 info->sync_type = TD_SYNC_RWLOCK;                  info->sync_type = TD_SYNC_RWLOCK;
                 info->sync_size = sizeof(struct pthread_rwlock_st);                  info->sync_size = sizeof(struct __pthread_rwlock_st);
                 if ((val = READ(s->proc,                  if ((val = READ(s->proc,
                     s->addr + offsetof(struct pthread_rwlock_st, ptr_rblocked),                      s->addr + offsetof(struct __pthread_rwlock_st, ptr_rblocked),
                     &queue, sizeof(queue))) != 0)                      &queue, sizeof(queue))) != 0)
                         return val;                          return val;
                 if (!PTQ_EMPTY(&queue))                  if (!PTQ_EMPTY(&queue))
                         info->sync_haswaiters = 1;                          info->sync_haswaiters = 1;
   
                 if ((val = READ(s->proc,                  if ((val = READ(s->proc,
                     s->addr + offsetof(struct pthread_rwlock_st, ptr_wblocked),                      s->addr + offsetof(struct __pthread_rwlock_st, ptr_wblocked),
                     &queue, sizeof(queue))) != 0)                      &queue, sizeof(queue))) != 0)
                         return val;                          return val;
                 if (!PTQ_EMPTY(&queue))                  if (!PTQ_EMPTY(&queue))
Line 583  td_sync_info(td_sync_t *s, td_sync_info_
Line 583  td_sync_info(td_sync_t *s, td_sync_info_
   
                 info->sync_data.rwlock.locked = 0;                  info->sync_data.rwlock.locked = 0;
                 if ((val = READ(s->proc,                  if ((val = READ(s->proc,
                     s->addr + offsetof(struct pthread_rwlock_st, ptr_nreaders),                      s->addr + offsetof(struct __pthread_rwlock_st, ptr_nreaders),
                     &n, sizeof(n))) != 0)                      &n, sizeof(n))) != 0)
                         return val;                          return val;
                 info->sync_data.rwlock.readlocks = n;                  info->sync_data.rwlock.readlocks = n;
Line 591  td_sync_info(td_sync_t *s, td_sync_info_
Line 591  td_sync_info(td_sync_t *s, td_sync_info_
                         info->sync_data.rwlock.locked = 1;                          info->sync_data.rwlock.locked = 1;
   
                 if ((val = READ(s->proc,                  if ((val = READ(s->proc,
                     s->addr + offsetof(struct pthread_rwlock_st, ptr_writer),                      s->addr + offsetof(struct __pthread_rwlock_st, ptr_writer),
                     &taddr, sizeof(taddr))) != 0)                      &taddr, sizeof(taddr))) != 0)
                         return val;                          return val;
                 if (taddr != 0) {                  if (taddr != 0) {
Line 626  td_sync_waiters_iter(td_sync_t *s, int (
Line 626  td_sync_waiters_iter(td_sync_t *s, int (
         switch (magic) {          switch (magic) {
         case _PT_MUTEX_MAGIC:          case _PT_MUTEX_MAGIC:
                 if ((val = READ(s->proc,                  if ((val = READ(s->proc,
                     s->addr + offsetof(struct pthread_mutex_st, ptm_blocked),                      s->addr + offsetof(struct __pthread_mutex_st, ptm_blocked),
                     &queue, sizeof(queue))) != 0)                      &queue, sizeof(queue))) != 0)
                         return val;                          return val;
                 break;                  break;
         case _PT_COND_MAGIC:          case _PT_COND_MAGIC:
                 if ((val = READ(s->proc,                  if ((val = READ(s->proc,
                     s->addr + offsetof(struct pthread_cond_st, ptc_waiters),                      s->addr + offsetof(struct __pthread_cond_st, ptc_waiters),
                     &queue, sizeof(queue))) != 0)                      &queue, sizeof(queue))) != 0)
                         return val;                          return val;
                 break;                  break;
         case PT_MAGIC:          case PT_MAGIC:
                 /* Redundant with join_iter, but what the hell... */                  /* Redundant with join_iter, but what the hell... */
                 if ((val = READ(s->proc,                  if ((val = READ(s->proc,
                     s->addr + offsetof(struct pthread_st, pt_joiners),                      s->addr + offsetof(struct __pthread_st, pt_joiners),
                     &queue, sizeof(queue))) != 0)                      &queue, sizeof(queue))) != 0)
                         return val;                          return val;
                 break;                  break;
Line 657  td_sync_waiters_iter(td_sync_t *s, int (
Line 657  td_sync_waiters_iter(td_sync_t *s, int (
                         return 0;                          return 0;
   
                 val = READ(s->proc,                  val = READ(s->proc,
                     next + offsetof(struct pthread_st, pt_sleep.ptqe_next),                      next + offsetof(struct __pthread_st, pt_sleep.ptqe_next),
                     &next, sizeof(next));                      &next, sizeof(next));
                 if (val != 0)                  if (val != 0)
                         return val;                          return val;
Line 732  td_map_id2thr(td_proc_t *proc, int threa
Line 732  td_map_id2thr(td_proc_t *proc, int threa
         next = (void *)allq.ptqh_first;          next = (void *)allq.ptqh_first;
         while (next != NULL) {          while (next != NULL) {
                 val = READ(proc,                  val = READ(proc,
                     next + offsetof(struct pthread_st, pt_num),                      next + offsetof(struct __pthread_st, pt_num),
                     &num, sizeof(num));                      &num, sizeof(num));
   
                 if (num == threadid)                  if (num == threadid)
                         break;                          break;
   
                 val = READ(proc,                  val = READ(proc,
                     next + offsetof(struct pthread_st, pt_allq.ptqe_next),                      next + offsetof(struct __pthread_st, pt_allq.ptqe_next),
                     &next, sizeof(next));                      &next, sizeof(next));
                 if (val != 0)                  if (val != 0)
                         return val;                          return val;
Line 863  td_thr_sleepinfo(td_thread_t *thread, td
Line 863  td_thr_sleepinfo(td_thread_t *thread, td
         caddr_t addr;          caddr_t addr;
   
         if ((val = READ(thread->proc,          if ((val = READ(thread->proc,
             thread->addr + offsetof(struct pthread_st, pt_sleepobj),              thread->addr + offsetof(struct __pthread_st, pt_sleepobj),
             &addr, sizeof(addr))) != 0)              &addr, sizeof(addr))) != 0)
                 return val;                  return val;
   
Line 936  td_thr_tsd(td_thread_t *thread, pthread_
Line 936  td_thr_tsd(td_thread_t *thread, pthread_
         int val;          int val;
   
         val = READ(thread->proc, thread->addr +          val = READ(thread->proc, thread->addr +
             offsetof(struct pthread_st, pt_specific) +              offsetof(struct __pthread_st, pt_specific) +
             key * sizeof(void *), value, sizeof(*value));              key * sizeof(void *), value, sizeof(*value));
   
         return val;          return val;

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8

CVSweb <webmaster@jp.NetBSD.org>