Tao Chen wrote:
> I am having a hard time starting my mdb journey.
....
> Naturally, I want to check the kernel stack to see what's
> blocking the open call, and which file it's trying to open.
> mdb seems to be much more complicated than something like kdb in AIX,
> although it does provide more functionality from what I read.
> In AIX kdb I'll run:
> kdb> th -n cp  <== get the thread slot number for cp command
> kdb> f <slot>  <== print the kernel stack for that thread
> Then from the stack frame I may find the vnode/inode pointer.
> In mdb, how do I set an "active process/thread" in order
> to get the stack?
> mdb> $c
> mdb: no process active
> I am very interested to see how you debug this kind of problem
> on Solaris. I hate to say this, but the documentation really
> doesn't help much for a newbie.
> I don't know if this problem can be reproduced at will.
> Right now 'cp' is still hanging.
> I may shutdown the machine before go to sleep though.

Hi Tao,
since you know the pid that's hung, you can get the proc_t
structure, then the kthread and it's stack:


mdb> 0t711::pid2proc | ::print proc_t p_tlist|::findstack -v

::pid2proc translates the pid to a proc_t structure, which
contains an element called "p_tlist" -- a struct kthread_t.
Struct kthread_t contains at t_pcb[1] the pointer to that
thread's stack.


You can find out a lot about the structures in the kernel
by dumping them with  (eg)

::print -t kthread_t


The mdb entry on docs.sun.com will help you more.




best regards,
James C. McPherson
--
Solaris Datapath Engineering
Data Management Group
Sun Microsystems

Reply via email to