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]

[Bug translator/13842] New: aggressive cast accessor function merging gives confusing error messages


http://sourceware.org/bugzilla/show_bug.cgi?id=13842

             Bug #: 13842
           Summary: aggressive cast accessor function merging gives
                    confusing error messages
           Product: systemtap
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: translator
        AssignedTo: systemtap@sourceware.org
        ReportedBy: mjw@redhat.com
    Classification: Unclassified


There are two (bad) @casts in the following script:

$ stap -e 'global v=0; probe process("/bin/ls").function("main") { if (v == 1)
{ v = @cast(v, "timespec")->tv_sec } else { v = @cast(v + 1,
"timespec")->tv_sec } }' -c '/bin/ls /dev/zero'
/dev/zero
ERROR: kernel read fault at 0x0000000000000001 (addr) near identifier '@cast'
at <input>:1:75
WARNING: Number of errors: 1, skipped probes: 0
WARNING: /usr/bin/staprun exited with status: 1
Pass 5: run failed.  Try again with another '--vp 00001' option.

Note that the error message points to the wrong @cast (the first, while the
second triggered the bad read).

When using -u the error message is correct:

$ stap -u -e 'global v=0; probe process("/bin/ls").function("main") { if (v ==
1) { v = @cast(v, "timespec")->tv_sec } else { v = @cast(v + 1,
"timespec")->tv_sec } }' -c '/bin/ls /dev/zero'
/dev/zero
ERROR: kernel read fault at 0x0000000000000001 (addr) near identifier '@cast'
at <input>:1:117
WARNING: Number of errors: 1, skipped probes: 0
WARNING: /usr/bin/staprun exited with status: 1
Pass 5: run failed.  Try again with another '--vp 00001' option.

Also note that this can also happen with different structures where the field
accessed is at the same offset in each.

Things especially get confusing if one of these @casts is wrapped in a try {
... } catch { ... }. Then the user might get an error about a location (inside
the try_block) where no such error can occur.

Three small other observations about this error message:
- It isn't a "kernel read" really, but a "user space read".
- Why does the error message say (addr)?
- If you switch the v == 1 to v == 0 (or remove the + 1 from v + 1) the error
message becomes "read fault at 0x          (null) (addr)". weird...

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


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