This is the mail archive of the
mailing list for the systemtap project.
Re: Binary output with byte granularity
Frank Ch. Eigler wrote:
That prints one byte. How do I print all the bytes of binary data in a
buffer of arbitrary length? [...]
printf ("%1b", value)
Is there a way in SystemTap to output binary data with byte
Well, we don't have buffers of arbitrary length in the script
language, so this issue doesn't arise there. (But see bug #4706.)
If the buffer excluded \0, then one could use ordinary %s to format
it; if we needed a programmable substring length, we could add a "*"
width specifier as in libc -- printf("%*s", 40, "foo"). Worthwhile?
So would this work to print raw binary data:
function dump_binary (buffer:long, buflen:long)
printf("%*b", buflen, buffer)
I don't want it formatted. I just want the raw data.