On Wed, Apr 12, 2006 at 04:43:12PM +0800, Oliver Yang wrote:
> Jonathan Adams wrote:
> 
> >On Tue, Apr 11, 2006 at 08:22:15AM +0800, Oliver Yang wrote:
> > 
> >
> >>Sorry for raising the question again, maybe my question is not very 
> >>clear...
> >>
> >>Actually, I need check the general register's value for a specific CPU 
> >>on MP system. But, it seems like ::regs couldn't meet my requirement. 
> >>Does anybody know the other way?
> >>   
> >>
> >
> >Typically, you want to look at the trap frame on the active thread on the
> >CPU.  I haven't done this on i386 in a while; can someone chime in with the
> >procedure?
> >
> >On sparc, you just take the active thread on the cpu, do a ::findstack on 
> >it,
> >take the ktl0 frame address, and do:
> >
> >     addr::print struct frame fr_local[7] | ::print struct regs
> > 
> >
> Sorry. Thank you for your response, although I'm not familiar with sparc 
> platform. 
> 
> I ask this question because sometimes ::findstack doesn't work for me on 
> my crashdump file:
> 
> > ::cpuinfo -v
> ID ADDR     FLG NRUN BSPL PRI RNRN KRNRN SWITCH THREAD   PROC
>  0 fec22eb4  1b    1    6 165   no    no t-0    cb956de0 sched
>               |    |    |
>    RUNNING <--+    |    +--> PIL THREAD
>      READY         |           6 cb956de0
>     EXISTS         |
>     ENABLE         +-->  PRI THREAD   PROC
>                            0 cca2a600 rsh
> 
> ID ADDR     FLG NRUN BSPL PRI RNRN KRNRN SWITCH THREAD   PROC
>  1 cc1449c0  1f    2    0  -1   no    no t-0    cc2e6de0 sched
>               |    |
>    RUNNING <--+    +-->  PRI THREAD   PROC
>      READY                60 cba61de0 sched
>   QUIESCED                60 cbaa7de0 sched
>     EXISTS
>     ENABLE
> 
> > cb956de0::findstack
> stack pointer for thread cb956de0: cb956ab8
>  cb956de0 0xcc9f7130()
> > cc2e6de0::findstack
> Possible stack pointers for thread cc2e6de0:
>  cc2e6d00 (2)
>  cc2e6d54 (2)
>  cc2e6db8 (2)
> > cb956ab8,30/nap
> 
> 
> If ::findstack doesn't work, we have to check stack by stack pointer 
> register (esp) on x86.
> 
> But you know, ::regs just can output 1 cpu's register value, in above 
> case, I couldn't get cpu 1 's register value.

As part of a panic, the panicking CPU cross-calls the other CPUs, inducing
them to call panic_idle().  In panic_idle(), the stack pointer is stored
in the thread's t_pcb field.  Something like:

        addr::print kthread_t t_pcb.value[1] | $C

(where addr is the active thread on the CPU) might get you a stack trace.

Cheers,
- jonathan

-- 
Jonathan Adams, Solaris Kernel Development

Reply via email to