1 # $NetBSD: lwps,v 1.2 2009/07/28 10:38:20 skrll Exp $
8 set $p = allproc.lh_first
11 printf "\t lwp pid lid flag wchan\n"
14 set $l = $p->p_lwps.lh_first
16 while ($j < $p->p_nlwps)
17 printf "0x%16lx %5d %5d %8x 0x%16lx", \
18 $l, $p->p_pid, $l->l_lid, $l->l_flag, $l->l_wchan
20 printf " (%s)", (char *)$l->l_wmesg
21 # If the preceding command cannot dereference the pointer, use this instead:
22 # printf " (%lx)", $l->l_wmesg
24 set $l = $l->l_sibling.le_next
28 set $p = $p->p_list.le_next
42 set $p = allproc.lh_first
45 set $l = $p->p_lwps.lh_first
47 while ($j < $p->p_nlwps)
49 printf "proc: %16lx %5d %8x %4x %5d %16lx %s", \
51 $p->p_flag, $p->p_stat, $p->p_nlwps, $p->p_lwps.lh_first, \
54 printf "Thread: %16lx %5d %5d %8x %16lx\n", \
55 $l, $p->p_pid, $l->l_lid, $l->l_flag, $l->l_wchan
60 set $l = $l->l_sibling.le_next
63 set $p = $p->p_list.le_next
69 Print out the stack of all threads in the system.
73 set $ld = (struct lockdebug *)ld_rb_tree
75 set $b = (volatile void *)$arg0
77 while ($ld && $a != $b)
79 set $ld = (struct lockdebug *)$ld->ld_rb_node.rb_nodes[1]
82 set $ld = (struct lockdebug *)$ld->ld_rb_node.rb_nodes[0]
88 # printf "a=%lx b=%lx ld=%lx a<b %d a>b %d\n", $a, $b, $ld, ($a < $b), ($a > $b)
91 printf "lock address : %#018lx type : ", \
93 if ($ld->ld_flags & 0x2)
94 printf "sleep/adaptive\n"
98 printf "initialized : %#018lx", \
99 (long)$ld->ld_initaddr
100 if ($ld->ld_lockops->lo_type == 0x2)
101 printf " interlock: %#018lx\n", $ld->ld_locked
104 printf "shared holds : %18u exclusive: ", \
106 if (($ld->ld_flags & 0x1) != 0)
111 printf "shares wanted: %18u exclusive: %18u\n", \
112 (unsigned)$ld->ld_shwant, (unsigned)$ld->ld_exwant
113 printf "cpu last held: %18u\n", \
114 (unsigned)$ld->ld_cpu
115 printf "current lwp : %#018lx last held: %#018lx\n", \
116 (long)0, (long)$ld->ld_lwp
117 printf "last locked : %#018lx unlocked : %#018lx\n", \
118 (long)$ld->ld_locked, (long)$ld->ld_unlocked
123 Print out lockdebug info like ddb does.