This is the mail archive of the 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: Printing binary data in embedded C

I should add that I am trying to make sure this works with older versions 
of systemTap like 0.5.12 and I noticed that the definitions of _stp_print 
has undergone some changes between 0.5.12 and CVS head such as supporting 
only C-style strings in the past to supporting both "String" and C-style 


Perry Cheng/Watson/IBM@IBMUS 
Sent by:
12/21/07 11:50 PM


Printing binary data in embedded C

I've been trying to convert some of my existing scripts from printing 
ascii data to binary data to improve probe speed.  I've stated using the 
%b modifier via _stp_printf with success.  However, my data naturally 
comes in as a char[] of known length and printing it one word at a time 
with %4b doesn't seem like the best way.  On the other hand, I can't use a 

bulk function like _stp_print since it interprets the buffer as a C string 

and will misinterpret my binary 0's as a string terminator.  Looking at 
the implementation of _stp_print, it's clear that this is an easy feature 
to add. 

Is there an existing function that I have missed or is there a simple 
workaround?  If not, how fragile is it for me to clone _stp_print and then 

replace the call to strlen with the my buffer length?


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