public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
From: "mjw at redhat dot com" <sourceware-bugzilla@sourceware.org>
To: systemtap@sourceware.org
Subject: [Bug translator/13842] New: aggressive cast accessor function merging gives confusing error messages
Date: Tue, 13 Mar 2012 22:37:00 -0000	[thread overview]
Message-ID: <bug-13842-6586@http.sourceware.org/bugzilla/> (raw)

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.

             reply	other threads:[~2012-03-13 22:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-13 22:37 mjw at redhat dot com [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-13842-6586@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=systemtap@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).