On Sun, Oct 25, 2009 at 12:43:01AM -0700, Jonathan Adams wrote:
> On Sat, Oct 24, 2009 at 09:09:38PM -0700, Ray Van Dolson wrote:
> > On Sat, Oct 24, 2009 at 01:43:48PM -0700, Jonathan Adams wrote:
> > > > My next thought is to generate a bunch of calls to mdb -k from the
> > > > shell and format everything together using awk, perl, or python.  Won't
> > > > be fast, will be kind of hacky, but probably will work.
> > > > 
> > > > Is there a better way to approach this?
> > > 
> > > One way would be to change ::lminfo to have a flag to prevent truncation,
> > > or to just write a DCMD which gives the output in exactly the format
> > > you want.
> > > 
> > > You could even just write a module based on the ::lminfo implementation,
> > > and do:
> > > 
> > > echo "::load /path/to/my/module; ::mydcmd" | mdb -k
> > > 
> > > Let me know if you need help going down this path.
> > 
> > I'm giving this a stab.  It looks like the primary change I'll need to
> > make is just to increase the size of LM_VNPATHLEN:
> > 
> >   http://arthur2.bludgeon.org/~rayvd/devel/mdb/raytest.c
> > 
> > This doesn't _quite_ compile yet:
> > 
> >   cc  -xstrconst -K pic -D_KERNEL -c ../common/raytest.c
> >   "../common/raytest.c", line 24: warning: implicit function declaration: 
> > mdb_pid2proc
> >   "../common/raytest.c", line 26: warning: implicit function declaration: 
> > mdb_vnode2path
> >   "../common/raytest.c", line 49: undefined symbol: MOD_API_VERSION
> >   "../common/raytest.c", line 49: non-constant initializer: op "NAME"
> > 
> > It doesn't look like mdb_pid2proc or mdb_vnode2path are exposed by the
> > mdb API.  Should I recreate the headers for the functions and link
> > against some library?  Or completely redefine the functions locally?
> > Perhaps I need to download a copy of the mdb source.
> 
> s/MOD_API_VERSION/MDB_API_VERSION/
> 
> The pid2proc and vnode2path functions are part of the ON-private mdb kernel
> support module.  They're not part of the public API, but you could either
> copy their declarations, or grab the "mdb_ks.h" file from 
> 
>       usr/src/cmd/mdb/common/mdb/mdb_ks.h
> 
> in the opensolaris source into the same directory as your source file, and
> include it using #include "mdb_ks.h".

Thanks Jonathan.  This is for the most part working now.  Just trying
to figure out the quirks of mdb_printf so the output all stays on one
line now when my function is not invoked directly in the mdb -k shell
by hand.

> Cheers,
> - jonathan

Thanks,
Ray

Reply via email to