public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* [Bug uprobes/14774] New: process.statement("*@file:*") probes don't match all functions
@ 2012-10-27 15:14 tschan+sourceware at devzone dot ch
  2012-10-27 16:11 ` [Bug uprobes/14774] " tschan+sourceware at devzone dot ch
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: tschan+sourceware at devzone dot ch @ 2012-10-27 15:14 UTC (permalink / raw)
  To: systemtap

http://sourceware.org/bugzilla/show_bug.cgi?id=14774

             Bug #: 14774
           Summary: process.statement("*@file:*") probes don't match all
                    functions
           Product: systemtap
           Version: unspecified
            Status: NEW
          Severity: minor
          Priority: P2
         Component: uprobes
        AssignedTo: systemtap@sourceware.org
        ReportedBy: tschan+sourceware@devzone.ch
    Classification: Unclassified


Description of problem:
process.statement("*@file:*") probes only match a "random" subset of the
functions in the given file.

Version-Release number of selected component (if applicable):
1.7-5 on RHEL 6.

How reproducible:
Always

Steps to Reproduce:
1. Create staptest.c

#include <stdio.h>

void a()
{
  printf("a\n");
}

void b()
{
  printf("b\n");
}

void c()
{
  printf("c\n");
}

int main()
{
  a();
  b();
  c();
  return 0;
}

2. compile staptest: gcc -g staptest.c -o staptest
3. run systemtap: stap -e 'probe process.statement("*@staptest.c:*") {
log(pp()) }' -c ./staptest

Actual results:
Only functions main and c are matched:

a
b
c
process("/home/tschan/stap/staptest").statement("main@/home/tschan/stap/staptest.c:19")
process("/home/tschan/stap/staptest").statement("main@/home/tschan/stap/staptest.c:20")
process("/home/tschan/stap/staptest").statement("main@/home/tschan/stap/staptest.c:21")
process("/home/tschan/stap/staptest").statement("main@/home/tschan/stap/staptest.c:22")
process("/home/tschan/stap/staptest").statement("c@/home/tschan/stap/staptest.c:14")
process("/home/tschan/stap/staptest").statement("c@/home/tschan/stap/staptest.c:15")
process("/home/tschan/stap/staptest").statement("c@/home/tschan/stap/staptest.c:16")
process("/home/tschan/stap/staptest").statement("main@/home/tschan/stap/staptest.c:23")
process("/home/tschan/stap/staptest").statement("main@/home/tschan/stap/staptest.c:24")


Expected results:
All functions are matched:

a
b
c
process("/home/tschan/stap/staptest").statement("main@/home/tschan/stap/staptest.c:19")
process("/home/tschan/stap/staptest").statement("main@/home/tschan/stap/staptest.c:20")
process("/home/tschan/stap/staptest").statement("a@/home/tschan/stap/staptest.c:4")
process("/home/tschan/stap/staptest").statement("a@/home/tschan/stap/staptest.c:5")
process("/home/tschan/stap/staptest").statement("a@/home/tschan/stap/staptest.c:6")
process("/home/tschan/stap/staptest").statement("main@/home/tschan/stap/staptest.c:21")
process("/home/tschan/stap/staptest").statement("b@/home/tschan/stap/staptest.c:9")
process("/home/tschan/stap/staptest").statement("b@/home/tschan/stap/staptest.c:10")
process("/home/tschan/stap/staptest").statement("b@/home/tschan/stap/staptest.c:11")
process("/home/tschan/stap/staptest").statement("main@/home/tschan/stap/staptest.c:22")
process("/home/tschan/stap/staptest").statement("c@/home/tschan/stap/staptest.c:14")
process("/home/tschan/stap/staptest").statement("c@/home/tschan/stap/staptest.c:15")
process("/home/tschan/stap/staptest").statement("c@/home/tschan/stap/staptest.c:16")
process("/home/tschan/stap/staptest").statement("main@/home/tschan/stap/staptest.c:23")
process("/home/tschan/stap/staptest").statement("main@/home/tschan/stap/staptest.c:24")


Additional info:
Changing the order of the definitions of a, b, c in staptest.c changes how many
and which functions are matched.
The probe 'process.statement("*@file:1-99999")' correctly matches all functions
and can be used as a workaround.

-- 
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] 9+ messages in thread

* [Bug uprobes/14774] process.statement("*@file:*") probes don't match all functions
  2012-10-27 15:14 [Bug uprobes/14774] New: process.statement("*@file:*") probes don't match all functions tschan+sourceware at devzone dot ch
@ 2012-10-27 16:11 ` tschan+sourceware at devzone dot ch
  2012-10-27 16:22 ` [Bug translator/14774] " fche at redhat dot com
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: tschan+sourceware at devzone dot ch @ 2012-10-27 16:11 UTC (permalink / raw)
  To: systemtap

http://sourceware.org/bugzilla/show_bug.cgi?id=14774

--- Comment #1 from Daniel Tschan <tschan+sourceware at devzone dot ch> 2012-10-27 16:10:51 UTC ---
Created attachment 6704
  --> http://sourceware.org/bugzilla/attachment.cgi?id=6704
Proposed bug fix

Tracked down the bug to the method iterate_over_srcfile_lines in dwflpp.cxx by
using systemtap on itself:

  if (line_type == RELATIVE)
    {
      // body omitted
    }
  else if (line_type == WILDCARD)
    function_line (&lineno);
  else if (line_type == RANGE) { /* correct lineno */
    // body ommited
  }

  for (int l = lineno; ; l = l + 1)
    {
      // body ommited
    }

If both function name and line number are wildcards the above code matches a
"random" function in the source file an sets lineno to its start. The following
code then only looks a this matched function an all functions defined later in
the source file.
The attached patch seems to fix this problem.

-- 
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] 9+ messages in thread

* [Bug translator/14774] process.statement("*@file:*") probes don't match all functions
  2012-10-27 15:14 [Bug uprobes/14774] New: process.statement("*@file:*") probes don't match all functions tschan+sourceware at devzone dot ch
  2012-10-27 16:11 ` [Bug uprobes/14774] " tschan+sourceware at devzone dot ch
@ 2012-10-27 16:22 ` fche at redhat dot com
  2012-10-27 22:38 ` tschan+sourceware at devzone dot ch
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: fche at redhat dot com @ 2012-10-27 16:22 UTC (permalink / raw)
  To: systemtap

http://sourceware.org/bugzilla/show_bug.cgi?id=14774

Frank Ch. Eigler <fche at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fche at redhat dot com
          Component|uprobes                     |translator

--- Comment #2 from Frank Ch. Eigler <fche at redhat dot com> 2012-10-27 16:22:31 UTC ---
That looks correct to me.
Could you run the testsuite before & after your fix, to see if there are any
differences?  Your fix might change the results.  If not, would you like to try
adding a new systemtap.base/* test case?

-- 
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] 9+ messages in thread

* [Bug translator/14774] process.statement("*@file:*") probes don't match all functions
  2012-10-27 15:14 [Bug uprobes/14774] New: process.statement("*@file:*") probes don't match all functions tschan+sourceware at devzone dot ch
  2012-10-27 16:11 ` [Bug uprobes/14774] " tschan+sourceware at devzone dot ch
  2012-10-27 16:22 ` [Bug translator/14774] " fche at redhat dot com
@ 2012-10-27 22:38 ` tschan+sourceware at devzone dot ch
  2012-10-27 23:38 ` fche at redhat dot com
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: tschan+sourceware at devzone dot ch @ 2012-10-27 22:38 UTC (permalink / raw)
  To: systemtap

http://sourceware.org/bugzilla/show_bug.cgi?id=14774

--- Comment #3 from Daniel Tschan <tschan+sourceware at devzone dot ch> 2012-10-27 22:38:35 UTC ---
I tried running the test suite. But apparently 8 GB RAM are not enough to run
all the tests and I have no machine available that has more RAM. As far as the
test suite did run (it stopped at semko/nodwf03.stp) there were no differences
with and without the fix.
I'll try to write a test case though.
Meanwhile I noticed that lineno is zero-based. So it should be set to 0, not 1
if the function name is a wildcard. I'll update the patch together with the
test case.

-- 
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] 9+ messages in thread

* [Bug translator/14774] process.statement("*@file:*") probes don't match all functions
  2012-10-27 15:14 [Bug uprobes/14774] New: process.statement("*@file:*") probes don't match all functions tschan+sourceware at devzone dot ch
                   ` (2 preceding siblings ...)
  2012-10-27 22:38 ` tschan+sourceware at devzone dot ch
@ 2012-10-27 23:38 ` fche at redhat dot com
  2012-10-29 20:01 ` fche at redhat dot com
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: fche at redhat dot com @ 2012-10-27 23:38 UTC (permalink / raw)
  To: systemtap

http://sourceware.org/bugzilla/show_bug.cgi?id=14774

--- Comment #4 from Frank Ch. Eigler <fche at redhat dot com> 2012-10-27 23:37:33 UTC ---
(FWIW, we run the testsuite on 1-2 GB machines regularly.)

-- 
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] 9+ messages in thread

* [Bug translator/14774] process.statement("*@file:*") probes don't match all functions
  2012-10-27 15:14 [Bug uprobes/14774] New: process.statement("*@file:*") probes don't match all functions tschan+sourceware at devzone dot ch
                   ` (3 preceding siblings ...)
  2012-10-27 23:38 ` fche at redhat dot com
@ 2012-10-29 20:01 ` fche at redhat dot com
  2012-10-30 11:52 ` tschan+sourceware at devzone dot ch
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: fche at redhat dot com @ 2012-10-29 20:01 UTC (permalink / raw)
  To: systemtap

http://sourceware.org/bugzilla/show_bug.cgi?id=14774

Frank Ch. Eigler <fche at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

--- Comment #5 from Frank Ch. Eigler <fche at redhat dot com> 2012-10-29 20:01:24 UTC ---
commit 78e2a671 fixes this.
A test case would still be nice.

-- 
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] 9+ messages in thread

* [Bug translator/14774] process.statement("*@file:*") probes don't match all functions
  2012-10-27 15:14 [Bug uprobes/14774] New: process.statement("*@file:*") probes don't match all functions tschan+sourceware at devzone dot ch
                   ` (4 preceding siblings ...)
  2012-10-29 20:01 ` fche at redhat dot com
@ 2012-10-30 11:52 ` tschan+sourceware at devzone dot ch
  2012-10-30 15:08 ` fche at redhat dot com
  2012-11-03 19:19 ` tschan+sourceware at devzone dot ch
  7 siblings, 0 replies; 9+ messages in thread
From: tschan+sourceware at devzone dot ch @ 2012-10-30 11:52 UTC (permalink / raw)
  To: systemtap

http://sourceware.org/bugzilla/show_bug.cgi?id=14774

--- Comment #6 from Daniel Tschan <tschan+sourceware at devzone dot ch> 2012-10-30 11:51:54 UTC ---
Created attachment 6709
  --> http://sourceware.org/bugzilla/attachment.cgi?id=6709
Differences of test suite runs before and after patch.

Thank you for committing the patch. Test case to follow.
Turns out that I have to run the test suite as root, otherwise the semko.exp
test case runs indefinitely, or rather till the system runs out of memory. Now
after the complete test suite ran through I see some differences before and
after my fix. There are 4 fewer unexpected failures, see attached diff.

-- 
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] 9+ messages in thread

* [Bug translator/14774] process.statement("*@file:*") probes don't match all functions
  2012-10-27 15:14 [Bug uprobes/14774] New: process.statement("*@file:*") probes don't match all functions tschan+sourceware at devzone dot ch
                   ` (5 preceding siblings ...)
  2012-10-30 11:52 ` tschan+sourceware at devzone dot ch
@ 2012-10-30 15:08 ` fche at redhat dot com
  2012-11-03 19:19 ` tschan+sourceware at devzone dot ch
  7 siblings, 0 replies; 9+ messages in thread
From: fche at redhat dot com @ 2012-10-30 15:08 UTC (permalink / raw)
  To: systemtap

http://sourceware.org/bugzilla/show_bug.cgi?id=14774

--- Comment #7 from Frank Ch. Eigler <fche at redhat dot com> 2012-10-30 15:07:39 UTC ---
> Turns out that I have to run the test suite as root, otherwise the semko.exp
> test case runs indefinitely, or rather till the system runs out of memory.

That's not supposed to happen; will try to reproduce that here.

-- 
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] 9+ messages in thread

* [Bug translator/14774] process.statement("*@file:*") probes don't match all functions
  2012-10-27 15:14 [Bug uprobes/14774] New: process.statement("*@file:*") probes don't match all functions tschan+sourceware at devzone dot ch
                   ` (6 preceding siblings ...)
  2012-10-30 15:08 ` fche at redhat dot com
@ 2012-11-03 19:19 ` tschan+sourceware at devzone dot ch
  7 siblings, 0 replies; 9+ messages in thread
From: tschan+sourceware at devzone dot ch @ 2012-11-03 19:19 UTC (permalink / raw)
  To: systemtap

http://sourceware.org/bugzilla/show_bug.cgi?id=14774

--- Comment #8 from Daniel Tschan <tschan+sourceware at devzone dot ch> 2012-11-03 19:19:01 UTC ---
Created attachment 6713
  --> http://sourceware.org/bugzilla/attachment.cgi?id=6713
Proposed test case

-- 
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] 9+ messages in thread

end of thread, other threads:[~2012-11-03 19:19 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-27 15:14 [Bug uprobes/14774] New: process.statement("*@file:*") probes don't match all functions tschan+sourceware at devzone dot ch
2012-10-27 16:11 ` [Bug uprobes/14774] " tschan+sourceware at devzone dot ch
2012-10-27 16:22 ` [Bug translator/14774] " fche at redhat dot com
2012-10-27 22:38 ` tschan+sourceware at devzone dot ch
2012-10-27 23:38 ` fche at redhat dot com
2012-10-29 20:01 ` fche at redhat dot com
2012-10-30 11:52 ` tschan+sourceware at devzone dot ch
2012-10-30 15:08 ` fche at redhat dot com
2012-11-03 19:19 ` tschan+sourceware at devzone dot ch

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