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 of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.