> > The mdb_get_xdata() api (see the docs for info) is used to read these 
> > buffers.
> > Feel free to add more if they are needed and useful.  Note that the pshandle
> > itself is exported, so you can read it directly and then get to other 
> > things.
> > Some example code to do this for per-lwp cursig values is below.
> 
> Thanks Mike, this is very helpful. Is there any programmatic support for LWP 
> iteration similar to Plwp_iter_all()? 

Your code example actually answers this question:

static int
cursig(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
{
        struct ps_prochandle *P;
        const pstatus_t *psp;

        if ((P = curproc()) == NULL)
                return (DCMD_ERR);

        if ((psp = Pstatus(P)) == NULL) {
                mdb_warn("Pstatus failed");
                return (DCMD_ERR);
        }

        (void) lwp_cursig(P, &psp->pr_lwp);
        (void) Plwp_iter(P, (proc_lwp_f *)lwp_cursig, NULL);
        return (DCMD_OK);
}

So, in general, I can I use any libproc functions from MDB proc target 
modules?

- Alexander Kolbasov


Reply via email to