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/20149] New: a function probe with a line number acts like a statement probe


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.

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