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/16615] don't require access to dwarf_query in has_single_line_record()


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

--- Comment #2 from Jonathan Lebon <jlebon at redhat dot com> ---
Looking at this again, I took the opportunity to try and do this uncoupling
properly and at the same time improve the way func@file:N statements are
implemented. The branch jlebon/pr16615 contains the relevant patch series.

I will just go through the main ways in which behaviour has changed:

1. Handling of linenos with multiple line records

We previously completely skipped those lines and threw a semantic error with
suggestions on nearby lines with single line records. This behaviour is kept
for ABSOLUTE and RELATIVE line types (i.e. the user specified a specific
lineno, so better not be ambiguous). However, for WILDCARD and RANGE line
types, we simply pick the first line record (rather than skip over them as we
did before).

$ nl -b a statement.c
     1  #include <stdio.h>
     2
     3  int foo(int a)
     4  {
     5     int b = 2;
     6     return b + a * 3;
     7  }
     8
     9  void bar(int b) { b += 2; printf("single line! %d\n", b); }
    10
    11  int main(int argc, char** argv)
    12  {
    13     if (argc != 1)
    14        return 42;
    15     foo(argv[0][0]); bar(argv[0][1]); return 0; }
$ gcc statement.c -g -o statement
$ stap -l 'process("./statement").statement("main@statement.c:*")' # OLD STAP
process("/tmp/statement").statement("main@/tmp/statement.c:12")
process("/tmp/statement").statement("main@/tmp/statement.c:13")
process("/tmp/statement").statement("main@/tmp/statement.c:14")
$ stap -l 'process("./statement").statement("main@statement.c:*")' # NEW STAP
process("/tmp/statement").statement("main@/tmp/statement.c:12")
process("/tmp/statement").statement("main@/tmp/statement.c:13")
process("/tmp/statement").statement("main@/tmp/statement.c:14")
process("/tmp/statement").statement("main@/tmp/statement.c:15")
$ stap -p2 -e 'probe process("./statement").statement("main@statement.c:15")
{}' # OLD AND NEW STAP
semantic error: multiple addresses for /tmp/statement.c:15 [man error::dwarf]
(try /tmp/statement.c:14)
semantic error: while resolving probe point: identifier 'process' at
<input>:1:7
        source: probe process("./statement").statement("main@statement.c:15")
{}
                      ^

semantic error: no match
Pass 2: analysis failed.  [man error::pass2]
$

2. Handling of RELATIVE and WILDCARD line types

We previously applied RELATIVE and WILDCARD line types to only one of the
filtered functions. Now, these are applied *per* function, so that e.g. the
following works as expected:

$ stap -l 'process("./statement").statement("[fm]*@statement.c+2")' # OLD STAP
process("/tmp/statement").statement("foo@/tmp/statement.c:6")
$ stap -l 'process("./statement").statement("[fm]*@statement.c+2")' # NEW STAP
process("/tmp/statement").statement("foo@/tmp/statement.c:6")
process("/tmp/statement").statement("main@/tmp/statement.c:14")
$

Other issues such as the one described in PR14774 then also become non-issues
and do not require special treatment.

3. Bug fixes

E.g. properly freeing memory, guarding from duplicate linenos, better handling
of libdw failures, and better error messages.

-- 
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]