public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* [Bug translator/20149] New: a function probe with a line number acts like a statement probe
@ 2016-05-26 18:13 jistone at redhat dot com
  2016-08-17 14:05 ` [Bug translator/20149] " flu at redhat dot com
  0 siblings, 1 reply; 2+ messages in thread
From: jistone at redhat dot com @ 2016-05-26 18:13 UTC (permalink / raw)
  To: systemtap

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.

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

* [Bug translator/20149] a function probe with a line number acts like a statement probe
  2016-05-26 18:13 [Bug translator/20149] New: a function probe with a line number acts like a statement probe jistone at redhat dot com
@ 2016-08-17 14:05 ` flu at redhat dot com
  0 siblings, 0 replies; 2+ messages in thread
From: flu at redhat dot com @ 2016-08-17 14:05 UTC (permalink / raw)
  To: systemtap

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

Felix Lu <flu at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |flu at redhat dot com
         Resolution|---                         |FIXED

--- Comment #1 from Felix Lu <flu at redhat dot com> ---
Commit 131d3efd8b3bb2.

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

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

end of thread, other threads:[~2016-08-17 14:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-26 18:13 [Bug translator/20149] New: a function probe with a line number acts like a statement probe jistone at redhat dot com
2016-08-17 14:05 ` [Bug translator/20149] " flu 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).