public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* [Bug translator/13842] New: aggressive cast accessor function merging gives confusing error messages
@ 2012-03-13 22:37 mjw at redhat dot com
  2012-03-14  1:15 ` [Bug translator/13842] " jistone at redhat dot com
  2012-03-14  1:32 ` [Bug translator/13842] aggressive " jistone at redhat dot com
  0 siblings, 2 replies; 3+ messages in thread
From: mjw at redhat dot com @ 2012-03-13 22:37 UTC (permalink / raw)
  To: systemtap

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.

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

end of thread, other threads:[~2012-03-14  1:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-13 22:37 [Bug translator/13842] New: aggressive cast accessor function merging gives confusing error messages mjw at redhat dot com
2012-03-14  1:15 ` [Bug translator/13842] " jistone at redhat dot com
2012-03-14  1:32 ` [Bug translator/13842] aggressive " jistone at redhat dot com

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).