public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
From: "jlebon at redhat dot com" <sourceware-bugzilla@sourceware.org>
To: systemtap@sourceware.org
Subject: [Bug translator/16615] don't require access to dwarf_query in has_single_line_record()
Date: Tue, 08 Apr 2014 14:29:00 -0000	[thread overview]
Message-ID: <bug-16615-6586-TwSzC1lHbN@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-16615-6586@http.sourceware.org/bugzilla/>

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.

  parent reply	other threads:[~2014-04-08 14:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-20 20:55 [Bug translator/16615] New: " jlebon at redhat dot com
2014-02-20 20:57 ` [Bug translator/16615] " jlebon at redhat dot com
2014-04-08 14:29 ` jlebon at redhat dot com [this message]
2014-04-17 18:22 ` jlebon at redhat dot com
2014-04-17 21:56 ` jlebon 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-16615-6586-TwSzC1lHbN@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).