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: can't print a target pointer string field


On 09/07/2012 05:26 PM, Jeff Haran wrote:
> struct net_device
> {
>         ...
>         char                    name[IFNAMSIZ];
>         ...
> };
> 
> So skb->dev->name looks like a string to me.
> 
> Why the reported type mismatch? And how can I display the name field, if that's possible?

We treat char[] the same as char*, and when you read any pointer in stap
it's carried around as a long (int64_t).  That's why it won't match the
%s, but %d/%x/%p would all be fine.

To use it as a stap string, it must be converted, for instance by
calling kernel_string($skb->dev->name).  If you're on at least stap 1.3,
you can use the pretty-print suffix ($skb->dev->name$).

Both of those assume there's always a \0 terminator.  If that name might
sometimes fill the whole IFNAMSIZ without a \0, then you'll need to use
kernel_string_n() explicitly.


Josh


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