On Tue, Apr 26, 2011 at 10:43 AM, Attila Rajmund Nohl
<attila.r.n...@gmail.com> wrote:
> Thanks, that helped. However, this strbuf structure has a pointer and
> I'd like to know what it points at. My guess this is also a user space
> pointer, so I should use something like this:
>
>        printf("buf: %s\n", copyinstr((uintptr_t)ctlptr->buf, ctlptr->len));

What's ctlptr point to?  If it's a user-land pointer then you have to
copyin() that structure first, and, because user-land might be running
32-bit while the kernel runs in 64-bit, you'd have to interpret the
copied-in data carefully to dig out the 'buf' field from whatever
ctlptr points to, then you have to copyinstr() that.  It's pretty
painful...

I've written many a script that did this sort of thing, and so have
others.  Anyways, if you look at blogs.sun.com, you'll find some
examples of what you trying to do, such as:

http://blogs.sun.com/peteh/entry/dereferencing_user_space_pointers_in
http://blogs.sun.com/nico/entry/using_dtrace_to_debug_encrypted
http://blogs.sun.com/nico/entry/dtracing_idmapd
http://blogs.sun.com/ahl/entry/dtrace_is_open

The last one shows you what you need to know in order to build a
script that can trace 32- and 64-bit user-land processes at once.

> but I get again an error like this:
>
> dtrace: error on enabled probe ID 2 (ID 6237: syscall::putmsg:return):
> invalid address (0xffbfeeb800000000) in action #10 at DIF offset 64

From this I gather that ctlptr points to a struct in user-land.  You
have to copy  that in first before you can get at a field of it.

Nico
--
_______________________________________________
dtrace-discuss mailing list
dtrace-discuss@opensolaris.org

Reply via email to