On Wed, Apr 26, 2006 at 06:06:43AM -0700, James Col3man wrote:
> Hello,
> 
>  I'm finding some of mdb syntax a bit confusing :) despite reading 
>  what I can find on the web. I can script around things but I have
>  the feeling I could do more on the mdb command-line if I could
>  just implant some of the right mdb concepts in my head. Hopefully 
>  someone might be able to point me in the right direction? 
> 
...
>
>  Some explaination of the pipe follows:
> 
> > ::walk umem_alloc_96
> 
>  Gives a list of addresses of each buffer in that block.
>  (you may have noticed by now I'm using libumem)
> 
>  I wish to process each of those libumem buffers, get the address 
>  in the debug metadata located at the end of the buffer, then call
>  ::bufctl_audit and examine the stack trace kept for each buffer.
> 
>  One address + offset (0x60 is 96) + 8 bytes to pointer to bufctl 
>  and 64bit pointers.
> 
> > 120003f00+0x60+8/1J 
> 0x120003f68:    120009380     
>  
>  I can add offset to the address and call bufctl_audit directly in a 
>  pipeline:
> 
> > 11a8024c0 +0x3008/1J| ::bufctl_audit 

You want ::map:

::walk umem_alloc_96 | ::map '*(.+60+8)' | ::bufctl_audit

but there's actually an easier way;  get the address of the umem_alloc_96
cache, and use the "bufctl" walker:

> ::umem_cache ! grep umem_alloc_96
000000010020c028 umem_alloc_96             020f 80000000       96      512
> 10020c028::walk bufctl | ::bufctl_audit
... data dumps here ...
>

But ::map and ::grep are workhorses in MDB pipelines;  I'd recommend
learning how to use them.

On Solaris 10 and later, '::bufctl -v' is equivalent to ::bufctl_audit,
and also allows for all kinds of filtering (see '::help bufctl').

You may also want to look at the output of '::umausers', which groups
allocations by stack trace.

Cheers,
- jonathan

-- 
Jonathan Adams, Solaris Kernel Development

Reply via email to