Unable to use an arbitrary expression for an index value under Systemtap

Solution Verified - Updated -

Issue

  • The following Systemtap script returns a parse error, when an arbitrary expressions is used for an index value:

# cat ./example.stp
#!/usr/bin/stap

probe module("ext4").function("ext4_set_acl") {
        if ($inode->i_ino == $1) {
                for (i = 0; i < $acl->a_count; i++) {
                        if (($acl->a_entries[$i]->e_tag) & 0x2) {
                                        printf ("\tacl: %s\n", $acl->a_entries[$i]$$)
                        }
                }
        }
}
# ./example.stp 157922
parse error: expected number
        saw: identifier '$i' at ./example.stp:5:38
     source:                 if (($acl->a_entries[$i]->e_tag) & 0x2) {
                                                                 ^
1 parse error(s).
Pass 1: parse failed.  Try again with another '--vp 1' option.
#

Environment

  • Red Hat Enterprise Linux 5.4
  • Systemtap 0.9.7

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content