public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
From: "jistone at redhat dot com" <sourceware-bugzilla@sourceware.org>
To: systemtap@sourceware.org
Subject: [Bug translator/20149] New: a function probe with a line number acts like a statement probe
Date: Thu, 26 May 2016 18:13:00 -0000	[thread overview]
Message-ID: <bug-20149-6586@http.sourceware.org/bugzilla/> (raw)

https://sourceware.org/bugzilla/show_bug.cgi?id=20149

            Bug ID: 20149
           Summary: a function probe with a line number acts like a
                    statement probe
           Product: systemtap
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: translator
          Assignee: systemtap at sourceware dot org
          Reporter: jistone at redhat dot com
  Target Milestone: ---

If you probe a function with a line number different than its entry, you'll get
a warning that a statement probe was probably what you wanted.  Then it
*should* act like a function-entry probe anyway, but instead it proceeds like a
statement.

First a plain function probe:

$ stap -p2 -e 'probe process("stap").function("main@main.cxx") {next}'
# probes
process("/usr/local/bin/stap").function("main@../main.cxx:1123") /*
pc=.absolute+0xfc80 */ /* <-
process("/usr/local/bin/stap").function("main@../main.cxx:1123") */

Now change the line number:

$ stap -p2 -e 'probe process("stap").function("main@main.cxx:1223") {next}'
WARNING: For probing a particular line, use a .statement() probe, not
.function(): keyword at <input>:1:1
 source: probe process("stap").function("main@main.cxx:1223") {next}
         ^
# probes
process("/usr/local/bin/stap").function("main@../main.cxx:1223") /*
pc=.absolute+0x1056e */ /* <-
process("/usr/local/bin/stap").function("main@../main.cxx:1223") */

So we got a warning, but the pc is clearly in the middle of the function
anyway, like a statement probe.  We want function probes to always use the
entry!

This happens even if you explicitly write ".call", and even worse it happens
for ".return"!  Return probes play tricks with the architectural return
address, which will probably not work correctly at all if you're not at the
beginning of the function. (e.g. the stack pointer will often move later)

-- 
You are receiving this mail because:
You are the assignee for the bug.

             reply	other threads:[~2016-05-26 18:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-26 18:13 jistone at redhat dot com [this message]
2016-08-17 14:05 ` [Bug translator/20149] " flu 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-20149-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).