public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
From: Josh Stone <jistone@redhat.com>
To: Roland McGrath <roland@redhat.com>
Cc: systemtap@sources.redhat.com
Subject: Re: semantic error: multiple addresses for ...
Date: Tue, 24 Aug 2010 20:34:00 -0000	[thread overview]
Message-ID: <4C742CE2.7070408@redhat.com> (raw)
In-Reply-To: <20100824195519.9C0D74048C@magilla.sf.frob.com>

On 08/24/2010 12:55 PM, Roland McGrath wrote:
> Off hand, I see two potential approaches:
> 
> 1. Pay attention to is_stmt.
>    I mentioned this earlier.  To consider this, we'd really need to find
>    some cases where the current code legitimately complains as in PR1306,
>    and check whether the is_stmt flags in that DWARF info are useful.

I'm not sure how to check is_stmt, but here's a reproducer at a similar
location to the original bug report.

kernel-2.6.33.8-149.fc13.x86_64  fs/open.c:
> 1047 long do_sys_open(int dfd, const char __user *filename, int flags, int mode)
> 1048 {
> 1049         char *tmp = getname(filename);
> 1050         int fd = PTR_ERR(tmp);
> 1051 
> 1052         if (!IS_ERR(tmp)) {
> 1053                 fd = get_unused_fd_flags(flags);
> 1054                 if (fd >= 0) {
> 1055                         struct file *f = do_filp_open(dfd, tmp, flags, mode, 0);
> 1056                         if (IS_ERR(f)) {
> 1057                                 put_unused_fd(fd);
> 1058                                 fd = PTR_ERR(f);
> 1059                         } else {
> 1060                                 fsnotify_open(f->f_path.dentry);
> 1061                                 fd_install(fd, f);
> 1062                         }
> 1063                 }
> 1064                 putname(tmp);
> 1065         }
> 1066         return fd;
> 1067 }

$ stap -L 'kernel.statement("do_sys_open@fs/open.c:1053")'
semantic error: multiple addresses for fs/open.c:1053 (try
fs/open.c:1051 or fs/open.c:1058)


> 2. Apply the current rule only when there are multiple hits in the same scope.
>    This seems probably safer than relying on is_stmt, though it's not clear.
>    This should fix the case I just reported, and ones like it, where the
>    multiple hits are in entirely different instances of the same source code.

Isn't it possible for a line to legitimately occur multiple times in the
same scope?  For example, a statement within an unrolled loop *should*
get multiple probes after all, right?

The funny thing is that the current rule is only applied for statement
probes on line numbers (see the use of need_single_match).  Function
probes with line numbers are allowed to have duplicates, probably for
the exact reason you're complaining about, that there may be multiple
inline instances.


Josh

  reply	other threads:[~2010-08-24 20:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-20 20:39 Roland McGrath
2010-08-24 19:48 ` Josh Stone
2010-08-24 19:55   ` Roland McGrath
2010-08-24 20:34     ` Josh Stone [this message]
2010-08-24 23:15       ` Roland McGrath
2010-08-26 15:40       ` Frank Ch. Eigler

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=4C742CE2.7070408@redhat.com \
    --to=jistone@redhat.com \
    --cc=roland@redhat.com \
    --cc=systemtap@sources.redhat.com \
    /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).