This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Binary output with byte granularity


Frank Ch. Eigler wrote:
Hi -

Is there a way in SystemTap to output binary data with byte
granularity?  [...]
printf ("%1b", value)
That prints one byte. How do I print all the bytes of binary data in a buffer of arbitrary length? [...]

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.

Mike


- FChE


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]