Hi Lally,
In order to trace data from user-land you first have to copy it into
DTrace''s
address space using either the copyin() or copyinstr() subroutines. Make
sure that the memory allocator you''re using works the way you think it
does,
and then do something like this:
pid$1::free:entry
{
trace(*(int *)copyin(arg0 - 4, sizeof (int)));
}
Adam
On Thu, Dec 20, 2007 at 10:16:02AM -0800, Lally Singh
wrote:> Hey all, I''m tracking malloc() and free calls. To count the
amount of memory freed, I can just dereference arg0-4, but I''m having
trouble getting that data. Like so:
>
> pid$1::free:entry
> {
> total_free += tracemem(arg0-4, 4);
> }
>
> This isn''t kernel space, so I figure I need to copy data from
userspace, and coerce dtrace to add its value. The code above doesn''t
work, but I was hoping someone here knew how to do it?
>
> Thanks in advance,
>
> -Lally
>
>
> --
> This message posted from opensolaris.org
> _______________________________________________
> dtrace-discuss mailing list
> dtrace-discuss at opensolaris.org
--
Adam Leventhal, FishWorks http://blogs.sun.com/ahl