public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
From: Mark Wielaard <mjw@redhat.com>
To: wenji.huang@oracle.com
Cc: "Frank Ch. Eigler" <fche@redhat.com>,
	        SystemTAP <systemtap@sources.redhat.com>
Subject: Re: Avoid assertion error for statement probe
Date: Mon, 10 Aug 2009 18:53:00 -0000	[thread overview]
Message-ID: <1249930423.3491.10.camel@springer.wildebeest.org> (raw)
In-Reply-To: <4A7FE7A1.4090607@oracle.com>

On Mon, 2009-08-10 at 17:25 +0800, Wenji Huang wrote:
> Frank Ch. Eigler wrote:
> [...]
> >> $ stap -e 'probe process("./stap").statement("foo@main.cxx:*") {}'
> >> semantic error: no matched function 'foo' in main.cxx
> >> semantic error: no probes found
> > 
> > Not a bad idea, but perhaps we don't need that particular "no matched
> > function" message that covers just this case, considering that the "no
> > probes found" message can/should be paired with the probe point.

I always found the extra "no probes found" exception error message
confusing. Clearly stap did find a probe, that is why is was giving an
error about it in the first place. Adding "no probes found" after that
is IMHO confusing. It should only say that if there were no other
errors. The following makes it that way:

commit 8c938ec723aad41c6cafcdef24679d40f310396c
Author: Mark Wielaard <mjw@redhat.com>
Date:   Mon Aug 10 17:44:31 2009 +0200

    Only add extra error on no probes found if no previous errors already shown.
    
    * elaborate.cxx (semantic_pass): Don't add "no probes found" if session
      already had other errors.

diff --git a/elaborate.cxx b/elaborate.cxx
index 9350023..1d7f793 100644
--- a/elaborate.cxx
+++ b/elaborate.cxx
@@ -1455,7 +1455,7 @@ semantic_pass (systemtap_session& s)
       if (rc == 0) rc = semantic_pass_vars (s);
       if (rc == 0) rc = semantic_pass_stats (s);
 
-      if (s.probes.size() == 0 && !s.listing_mode)
+      if (s.num_errors() == 0 && s.probes.size() == 0 && !s.listing_mode)
         throw semantic_error ("no probes found");
     }
   catch (const semantic_error& e)

> How about to defer the error to the outer calling ?
> 
> $ stap -e 'probe process("./stap").statement("foo@main.cxx:1025-1026") {}'
> semantic error: no match while resolving probe point 
> process("./stap").statement("foo@main.cxx:1025-1026")
> semantic error: no probes found
> Pass 2: analysis failed.  Try again with another '--vp 01' option.

Yes, I think this is a more informative error than your first version.

Cheers,

Mark

      reply	other threads:[~2009-08-10 18:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-07  2:54 Wenji Huang
2009-08-07 16:59 ` Frank Ch. Eigler
2009-08-10  9:29   ` Wenji Huang
2009-08-10 18:53     ` Mark Wielaard [this message]

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=1249930423.3491.10.camel@springer.wildebeest.org \
    --to=mjw@redhat.com \
    --cc=fche@redhat.com \
    --cc=systemtap@sources.redhat.com \
    --cc=wenji.huang@oracle.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).