This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: Binary output with byte granularity
On Tue, 2007-10-16 at 10:24 -0400, Martin Hunt wrote:
> function dump_binary (num:long, addr:long)
> %{
> char *inptr = (char *)(unsigned long)THIS->addr;
> char *ptr = _stp_reserve_bytes(THIS->num);
> if (likely(ptr != NULL))
> memcpy(ptr, inptr, THIS->num);
BTW, don't really do memcpy unless you are certain it is safe. Use an
appropriate safe copy function here. copy_from_user, deref, etc.
Martin