public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* Accessing structure fields
@ 2007-09-26 20:34 Mike Mason
  2007-09-26 22:55 ` Frank Ch. Eigler
  0 siblings, 1 reply; 2+ messages in thread
From: Mike Mason @ 2007-09-26 20:34 UTC (permalink / raw)
  To: systemTAP

I'm trying to understand why some recent changes in nfs_proc.stp were necessary.  There are numerous changes like the following:

-        count = $rdata->args.count
-        offset = $rdata->args.offset
+        count = $rdata->args->count
+        offset = $rdata->args->offset

rdata is a pointer to a nfs_read_data structure and args is a nfs_readargs structure within nfs_read_data.  args is not a pointer, thus the '.' syntax seems correct.  However, $rdata->args->count builds fine, while $rdata->args.count fails with the following error:

semantic error: struct/union 'args' is being accessed instead of a member of the struct/union: identifier '$data' at /usr/local/share/systemtap/tapset/nfs_proc.stp:640:17
semantic error: probe_1113 uses invalid operator: operator '.' at /usr/local/share/systemtap/tapset/nfs_proc.stp:640:28

Is '.' supported when accessing structure fields?

Interestingly, the following also builds fine:

      uid = $data->inode->i_uid

In this case, inode *is* a pointer.

Mike




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Accessing structure fields
  2007-09-26 20:34 Accessing structure fields Mike Mason
@ 2007-09-26 22:55 ` Frank Ch. Eigler
  0 siblings, 0 replies; 2+ messages in thread
From: Frank Ch. Eigler @ 2007-09-26 22:55 UTC (permalink / raw)
  To: Mike Mason; +Cc: systemTAP

Mike Mason <mmlnx@us.ibm.com> writes:

> I'm trying to understand why some recent changes in nfs_proc.stp were necessary.  There are numerous changes like the following:
>
> -        count = $rdata->args.count
> -        offset = $rdata->args.offset
> +        count = $rdata->args->count
> +        offset = $rdata->args->offset

These are correct.

> Is '.' supported when accessing structure fields?

No.  Only the "->" operator is used to traverse inclusion/pointer type
links.  It automagically does the right thing, though looks a bit
funny.  One reason for this is the "."  string concatenation operator.

- FChE

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-09-26 18:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-09-26 20:34 Accessing structure fields Mike Mason
2007-09-26 22:55 ` Frank Ch. Eigler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).