This is the mail archive of the
mailing list for the systemtap project.
Re: Binary output with byte granularity
On Mon, 2007-10-15 at 14:06 -0700, Mike Mason wrote:
> So would this work to print raw binary data:
> function dump_binary (buffer:long, buflen:long)
> printf("%*b", buflen, buffer)
That should work with minor changes to the runtime printf
and stap. "*" field width is supported in the runtime but is untested
and doesn't look like it will work as-is with binary output. However,
stap does not recognize the syntax and will reject it.
You want to submit a PR?
For now, this should work:
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);