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: Language Reference, updated


On Tue, 2006-12-05 at 15:10 -0600, Robb Romans wrote:

> I've incorporated your feedback into the Language Reference, but I'd
> like clarification on one section. What do you mean by "Also mention %p
> and binary formats here" ?
> 
> Here is a description of %p for standard C:
> "Pointer to a pointer. Inputs a memory address in the same fashion of the
> %p type produced by the printf function."
> 
> Is there a difference in SystemTap's handling of %p that you want me to
> call out, or is there a special usage case that you have in mind?

You wrote that "valid types are limited to string ("%s") and integer 
("%d")"

That makes it sound like you can only use "%s" and "%d" in printf.
You can also use the standard flags and conversion specifiers from C
printf. 

> Is there a difference in SystemTap's handling of printing binary streams
> versus C standard syntax? Thanks.

Yes, C printf does not do binary output. Systemtap's printf does the
following:

%1n, %2n, %4n, %n -  These functions instruct printf to write
a binary length at this location that is the total length of
the string written by the printf.  The field width is the number
of bytes to write. The default is "2".

%1b, %2b, %4b, %8b, %b - binary write. The field width specifies the
number of bytes to write. Default is 4 (32-bits).

Examples:

stap -e 'probe begin{for(i=97;i<123;i++) printf("%3d: %1b%1b%1b\n",i,i,i-32,i-64); exit()}'

> stap -e 'probe begin{printf("%1n%b%b", 0xc0dedbad, 0x12345678);exit()}' | hexdump -C
00000000  08 ad db de c0 78 56 34  12                       |.....xV4.|

> stap -e 'probe begin{printf("%1b%1b%1blo %1b%1brld\n", 72,101,108,87,111);exit()}'
Hello World

> 
> Regards,
> Robb
> 
> - -- 
> Robb Romans                     (512) 838-0419
> Linux Commando                  T/L   678-0419
> robb@linux.vnet.ibm.com         ARS NA5TT
> .-- - ..-. ..--..
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.5 (GNU/Linux)
> Comment: Processed by Mailcrypt 3.5.8 <http://mailcrypt.sourceforge.net/>
> 
> iD8DBQFFdeA/ZyOifwSFgjQRAmCYAJ0a185d7j7jaZt93Ts7cYiZTrPeSwCgtzis
> igXOlANUokjF8PxHV59JSPE=
> =67Bh
> -----END PGP SIGNATURE-----


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