Binary output with byte granularity
Martin Hunt
hunt@redhat.com
Tue Oct 16 14:40:00 GMT 2007
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
More information about the Systemtap
mailing list