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/11353] elide side-effect-free probes


------- Additional Comments From jistone at redhat dot com  2010-03-08 20:38 -------
(In reply to comment #1)
> Skips empty probes by checking if p->body->statements.size() == 0. I had to do
> a cast to (block*), it seems like it should cast all right since
> parse_stmt_block() returns a block*. (p->body = parse_stmt_block(), 2 lines
> above changes)

If that were really guaranteed, then we should make ->body a block* -- but it's
not the case.  Some of the later optimization passes will collapse singleton
blocks.  In the extreme case, a probe can get optimized completely away, in
which it becomes just a null_statement.

At the place where the warning is actually thrown, you can see the
null_statement replacement happening -- I think that's where you should take action.

> Not sure if this is what you want, or if you just want to get rid of the
> warning message in elaborate.cxx?

I think the goal is to get rid of warning but also to not even register the
empty probe, so it incurs no overhead.

> Rudimentary tests (e.g. stap -e 'probe begin {printf("HAI") exit()} probe end
> {}') seem to work.

Something like this should be part of your test:
  probe begin { if (@defined($foo)) println("WUT?") }

Although we also need to decide what should be done if the entire script has no
useful probes -- that should probably be an outright error.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jistone at redhat dot com


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

------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]